]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerSegmentationV2.cxx
Use of appropriate sensor depending response objects in SPD simulation
[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   AliMpPad pad = 
258     fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE);
259         
260   if ( pad != AliMpPad::Invalid() )
261         {
262                 Int_t ix = pad.GetIndices().GetFirst();
263                 Int_t iy = pad.GetIndices().GetSecond();
264     ILoc2IGlo(ix,iy,ixGlo,iyGlo);
265         }
266   else
267         {
268                 ixGlo=iyGlo=-1;
269         }
270   AliDebug(2,Form("ixGlo,iyGlo=%d,%d\n",ixGlo,iyGlo));
271 }
272
273 //_____________________________________________________________________________
274 void
275 AliMUONTriggerSegmentationV2::GetPadLoc2Glo(Int_t ix, Int_t iy,
276                                             Int_t& ixGlo, Int_t& iyGlo) const
277 {
278   //
279   // Converts from local (in PC convention) to (ix,iy) to global (ix,iy)
280   //
281
282   ixGlo=iyGlo=-1; // starts with invalid values
283   
284   if ( fPlaneType == kBendingPlane )
285   {
286     ixGlo = 10*LineNumber() + ix;
287     iyGlo = iy - fgIntOffset;
288   }
289   else if ( fPlaneType == kNonBendingPlane )
290   {
291     Int_t i = fSlat->GetLayer(0)->FindPCBIndex(ix-fgIntOffset);
292     if (i<0)
293     {
294       AliError(Form("Invalid local (ix=%d,iy=%d) ?",ix,iy));
295       return ;
296     }
297     AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ix-fgIntOffset);
298     iyGlo = ix - pcb->Ixmin() - fgIntOffset;
299     if ( LineNumber() == 5 ) ++i;
300     ixGlo = 10*LineNumber() + i + fgIntOffset; 
301   }
302 }
303
304 //_____________________________________________________________________________
305 void
306 AliMUONTriggerSegmentationV2::GetPadGlo2Loc(Int_t ixGlo, Int_t iyGlo,
307                                             Int_t& ix, Int_t& iy) const
308 {
309   //
310   // Converts from global (ix,iy) to local (ix,iy) (in PC convention)
311   //
312   
313   ix=iy=-1; // starts with invalid values
314
315   if ( abs(ixGlo) == 51 ) return;
316   
317   Int_t column = ModuleColNum(ixGlo);
318
319   if ( fPlaneType == kBendingPlane )
320   {
321     ix = column + fgIntOffset;
322     iy = iyGlo + fgIntOffset;
323   }
324   else if ( fPlaneType == kNonBendingPlane )
325   {
326     if ( LineNumber()==5 ) --column;
327     AliMpPCB* pcb = fSlat->GetLayer(0)->GetPCB(column);
328     if (!pcb)
329     {
330       AliError(Form("Invalid global (ix=%d,iy=%d)",ixGlo,iyGlo));
331       return;
332     }
333     ix = pcb->Ixmin() + iyGlo + fgIntOffset;
334     iy = fgIntOffset;
335   }
336 }
337
338 //_____________________________________________________________________________
339 void 
340 AliMUONTriggerSegmentationV2::GiveTestPoints(Int_t&,Float_t*,Float_t*) const
341 {
342   AliFatal("Not Implemented");
343 }
344
345 //_____________________________________________________________________________
346 Bool_t
347 AliMUONTriggerSegmentationV2::HasPad(Float_t x, Float_t y, Float_t)
348 {
349   //
350   // Well, 2 implementations are possible here
351   // Either reuse HasPad(int,int), or get it from scratch using
352   // underlying fSlatSegmentation.
353   // Took second option, but w/o checking whether this is the faster.
354   // The second option is commented out below, for the record.
355   
356 //  Int_t ix, iy;
357 //  GetPadI(x,y,z,ix,iy);
358 //  Int_t ixLA, iyLA;
359 //  IGlo2ILoc(ix,iy,ixLA,iyLA);
360 //  Int_t ixPC, iyPC;
361 //  LA2PC(ixLA,iyLA,ixPC,iyPC);
362 //  Bool_t ok1 = HasPad(ixPC,iyPC);
363
364   AliMpPad pad = 
365   fSlatSegmentation->PadByPosition(TVector2(x,y),kFALSE);
366   return pad.IsValid();
367 }
368
369 //_____________________________________________________________________________
370 Bool_t
371 AliMUONTriggerSegmentationV2::HasPad(Int_t ixGlo, Int_t iyGlo)
372 {
373   Int_t ixLA, iyLA;
374   IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA);
375   return fSlatSegmentation->HasPad(AliMpIntPair(ixLA,iyLA));
376 }
377
378 //_____________________________________________________________________________
379 void
380 AliMUONTriggerSegmentationV2::IGlo2ILoc(Int_t ixGlo, Int_t iyGlo,
381                                         Int_t& ixLA, Int_t& iyLA)
382 {
383   Int_t ixPC, iyPC;
384   GetPadGlo2Loc(ixGlo,iyGlo,ixPC,iyPC);
385   PC2LA(ixPC,iyPC,ixLA,iyLA);
386 }
387
388 //_____________________________________________________________________________
389 void
390 AliMUONTriggerSegmentationV2::ILoc2IGlo(Int_t ixLA, Int_t iyLA,
391                                         Int_t& ixGlo, Int_t& iyGlo)
392 {
393   Int_t ixPC, iyPC;
394   LA2PC(ixLA,iyLA,ixPC,iyPC);
395   GetPadLoc2Glo(ixPC,iyPC,ixGlo,iyGlo);
396 }
397
398 //_____________________________________________________________________________
399 void
400 AliMUONTriggerSegmentationV2::Init(int)
401 {
402   AliWarning("Not Implemented because not needed ;-)");
403 }
404
405 //_____________________________________________________________________________
406 Int_t
407 AliMUONTriggerSegmentationV2::ISector()
408 {
409   // FIXME: remove the usage of ISector from all the code.
410   return -10;
411 }
412
413 //_____________________________________________________________________________
414 void AliMUONTriggerSegmentationV2::IntegrationLimits(Float_t& x1, 
415                                                      Float_t& x2,
416                                                      Float_t& x3, 
417                                                      Float_t& x4) 
418 {
419   // x1 : hit x(y) position
420   // x2 : x(y) coordinate of the main strip
421   // x3 : current strip real x(y) coordinate  
422   // x4 : dist. between x(y) hit pos. and the closest border of the current strip
423   //
424   // Note : need to return (only) x4.
425   
426   AliFatal("Check me before usage. ResponseTrigger does not use me, while"
427            "ResponseTriggerV1 does ?");
428     
429   AliMpPad strip = 
430   fSlatSegmentation->PadByPosition(TVector2(fXhit,fYhit),kFALSE);
431   if ( !strip.IsValid() )
432   {
433     AliWarning(Form("%s got invalid fXhit,fYhit=%e,%e\n",
434                     fSlatSegmentation->GetName(),fXhit,fYhit));
435     x1=x2=x3=x4=0;
436   }
437   else
438   {
439     Double_t xstrip = strip.Position().X();
440     Double_t ystrip = strip.Position().Y();
441     AliDebug(1,Form("fXhit,Yhit=%e,%e xstrip,ystrip=%e,%e\n",
442                     fXhit,fYhit,xstrip,ystrip));
443     x1 = (fPlaneType==kBendingPlane) ? fYhit : fXhit;
444     x2 = (fPlaneType==kBendingPlane) ? ystrip : xstrip;
445     x3 = (fPlaneType==kBendingPlane) ? 
446       fCurrentPad.Position().Y() : fCurrentPad.Position().X();
447     Double_t xmin = 0.0;
448     Double_t xmax = 0.0;
449     if (fPlaneType==kBendingPlane)
450     {
451       xmin = x3 - fCurrentPad.Dimensions().X();
452       xmax = x3 + fCurrentPad.Dimensions().X();
453     }
454     else
455     {
456       xmin = x3 - fCurrentPad.Dimensions().Y();
457       xmax = x3 + fCurrentPad.Dimensions().Y();
458     }
459     // dist. between the hit and the closest border of the current strip
460     x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ? 
461       TMath::Abs(xmin-x1):TMath::Abs(xmax-x1);    
462     
463     AliDebug(1,Form("Bending %d x1=%e x2=%e x3=%e x4=%e xmin,max=%e,%e\n",
464                     fPlaneType,x1,x2,x3,x4,xmin,xmax));
465
466   }
467 }  
468
469 //_____________________________________________________________________________
470 Int_t 
471 AliMUONTriggerSegmentationV2::Ix()
472 {
473   if ( fCurrentPad.IsValid() )
474   {
475     Int_t ixGlo,iyGlo;
476     ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(),
477               fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo);
478     return ixGlo;
479   }
480   return -1;
481 }
482
483 //_____________________________________________________________________________
484 Int_t 
485 AliMUONTriggerSegmentationV2::Iy()
486 {
487   if ( fCurrentPad.IsValid() )
488   {
489     Int_t ixGlo,iyGlo;
490     ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(),
491               fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo);
492     return iyGlo;
493   }
494   return -1;
495 }
496
497
498 //_____________________________________________________________________________
499 void
500 AliMUONTriggerSegmentationV2::LA2PC(Int_t ixLA, Int_t iyLA,
501                                     Int_t& ixPC, Int_t& iyPC)
502 {
503   //
504   // From LA to PC conventions for integers indices.
505   //
506   ixPC=iyPC=-1;
507   
508   if ( ixLA<0 || iyLA<0 ) return;
509   
510   ixPC = ixLA + 1;
511   iyPC = iyLA + 1;
512   
513   if ( fPlaneType == kBendingPlane )
514   {
515     if ( LineNumber()==5 )
516     {
517       ++ixPC;
518     }
519     if ( LineNumber()==4 && ixLA==0 )
520     {
521       iyPC -= 16;
522     }
523   }
524   
525   AliDebug(3,Form("ix,iy LA (%d,%d) -> PC (%d,%d)",ixLA,iyLA,ixPC,iyPC));
526   
527 }
528
529 //_____________________________________________________________________________
530 Int_t
531 AliMUONTriggerSegmentationV2::LineNumber() const
532 {
533   return 10-fLineNumber;
534 }
535
536 //_____________________________________________________________________________
537 Int_t
538 AliMUONTriggerSegmentationV2::ModuleColNum(Int_t ixGlo) const
539 {
540   // returns column number (from 0 to 6) in which the (global) module 
541   // ix is sitting (could return 7 if ix=isec)
542   return TMath::Abs(ixGlo)-Int_t(TMath::Abs(ixGlo)/10)*10-1;
543 }
544
545 //_____________________________________________________________________________
546 Int_t
547 AliMUONTriggerSegmentationV2::MorePads()
548 {
549   AliFatal("Not implemented");
550   return 0;
551 }
552
553 //_____________________________________________________________________________
554 void AliMUONTriggerSegmentationV2::Neighbours(Int_t /*iX*/, Int_t /*iY*/, 
555                                               Int_t* /*Nlist*/, 
556                                               Int_t /*Xlist*/[10], 
557                                               Int_t /*Ylist*/[10]) 
558 {
559   //-----------------BENDING-----------------------------------------
560   // Returns list of 10 next neighbours for given X strip (ix, iy)  
561   // neighbour number 4 in the list -                     
562   // neighbour number 3 in the list  |                    
563   // neighbour number 2 in the list  |_ Upper part             
564   // neighbour number 1 in the list  |            
565   // neighbour number 0 in the list -           
566   //      X strip (ix, iy) 
567   // neighbour number 5 in the list -       
568   // neighbour number 6 in the list  | _ Lower part
569   // neighbour number 7 in the list  |
570   // neighbour number 8 in the list  | 
571   // neighbour number 9 in the list -
572   
573   //-----------------NON-BENDING-------------------------------------
574   // Returns list of 10 next neighbours for given Y strip (ix, iy)  
575   // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
576   //                  \_______/                    \_______/
577   //                    left                         right
578   AliFatal("Please implement me");
579 }
580
581 //_____________________________________________________________________________
582 void
583 AliMUONTriggerSegmentationV2::NextPad()
584 {
585   AliFatal("Not implemented");
586 }
587
588 //_____________________________________________________________________________
589 Int_t
590 AliMUONTriggerSegmentationV2::Npx() const
591 {
592   return 124;// FIXME: this should not have to be done, if only we'd stick 
593   // to a local (ix,iy) convention !!! 
594   // return fSlatSegmentation->MaxPadIndexX()+1;
595 }
596
597 //_____________________________________________________________________________
598 Int_t
599 AliMUONTriggerSegmentationV2::Npy() const
600 {
601   return 64;
602 //  return fSlatSegmentation->MaxPadIndexY()+1;
603 }
604
605 //_____________________________________________________________________________
606 void
607 AliMUONTriggerSegmentationV2::PC2LA(Int_t ixPC, Int_t iyPC,
608                                     Int_t& ixLA, Int_t& iyLA)
609 {
610   //
611   // From PC to LA conventions for integers indices.
612   //
613   ixLA=iyLA=-1;
614   
615   if ( ixPC<0 || iyPC<0 ) return;
616   
617   ixLA = ixPC - 1;
618   iyLA = iyPC - 1;
619   
620   if ( fPlaneType == kBendingPlane )
621   {
622     if ( LineNumber()==5 )
623     {
624       --ixLA;
625     }
626     if ( LineNumber()==4 && ixLA==0 )
627     {
628       iyLA += 16;
629     }
630   }
631   
632   AliDebug(3,Form("ix,iy PC (%d,%d) -> LA (%d,%d)",ixPC,iyPC,ixLA,iyLA));
633 }
634
635 //_____________________________________________________________________________
636 void
637 AliMUONTriggerSegmentationV2::Print(Option_t* opt) const
638 {
639   TString sopt(opt);
640   
641   cout << "DetElemId=" << fDetElemId << " PlaneType=" 
642     << fPlaneType << " Npx=" << Npx() << " Npy=" << Npy() << endl;
643   if ( ( sopt.Contains("SEG") || sopt.Contains("ALL") ) && fSlatSegmentation )
644   {
645     fSlatSegmentation->Print();
646   }
647   if ( sopt.Contains("ALL") && fSlat )
648   {
649     fSlat->Print();
650   }
651 }
652
653 //_____________________________________________________________________________
654 void 
655 AliMUONTriggerSegmentationV2::ReadMappingData()
656 {
657   fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>
658   (AliMUONSegmentationManager::Segmentation(fDetElemId,fPlaneType));
659   
660         if (!fSlatSegmentation)
661         {
662                 AliFatal("Wrong segmentation type encountered");
663         }
664   fSlat = fSlatSegmentation->Slat();
665   TString id(fSlat->GetID());
666   Ssiz_t pos = id.Last('L');
667   if ( pos <= 0 )
668   {
669     AliFatal(Form("Cannot infer line number for slat %s",id.Data()));
670   }
671   fLineNumber = TString(id(pos+1),1).Atoi();
672 }
673
674 //_____________________________________________________________________________
675 Int_t
676 AliMUONTriggerSegmentationV2::Sector(Int_t ix, Int_t iy)
677 {
678   Int_t ixLA, iyLA;
679   IGlo2ILoc(ix,iy,ixLA,iyLA);
680   AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE);
681   if ( !pad.IsValid() ) return -1;
682   return Code(ixLA,iyLA);
683   
684 //  AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ixLA);
685 //  if (!pcb)
686 //  {
687 //    AliError(Form("Could not find a pcb at (%d,%d) for slat %s",
688 //             ix,iy,fSlat->GetName()));
689 //    return -1;
690 //  }
691 //  if ( pcb->PadSizeX()==-1.0 )
692 //  {
693 //    // special case of column 7 non-bending.
694 //    return SPECIAL_SECTOR;
695 //  }
696 //  return fSlat->GetLayer(0)->FindPCBIndex(ixLA);
697 }
698
699 //_____________________________________________________________________________
700 Int_t
701 AliMUONTriggerSegmentationV2::Sector(Float_t, Float_t)
702 {
703   AliFatal("Not implemented");
704   return 0;
705 }
706
707 //_____________________________________________________________________________
708 void
709 AliMUONTriggerSegmentationV2::SetCorrFunc(Int_t,TF1*)
710 {
711   AliFatal("Not Implemented");
712 }
713
714 //_____________________________________________________________________________
715 void
716 AliMUONTriggerSegmentationV2::SetDAnod(float)
717 {
718   AliFatal("Not Implemented");
719 }
720
721 //_____________________________________________________________________________
722 void
723 AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y)
724 {
725   fXhit = x;
726   fYhit = y;
727         
728   //
729   // insure we're within the slat limits. If not, issue an error and sets
730   // the current hit to slat center.
731   // FIXME: this should probably a) not happen at all b) be a fatal error
732   //
733   if ( fXhit < -fSlat->DX() || fXhit > fSlat->DX() ||
734        fYhit < -fSlat->DY() || fYhit > fSlat->DY() )
735         {
736                 AliError(Form("Hit outside slat %s limits (x,y)hit = (%e,%e)."
737                   " Forcing to (0,0)",fSlat->GetID(),fXhit,fYhit));
738                 fXhit = 0.0;
739                 fYhit = 0.0;
740         }
741   
742 }
743
744 //_____________________________________________________________________________
745 void
746 AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y, Float_t)
747 {
748   SetHit(x,y);
749 }
750
751 //_____________________________________________________________________________
752 void
753 AliMUONTriggerSegmentationV2::SetPad(Int_t ix, Int_t iy)
754 {
755   Int_t ixLA, iyLA;
756   IGlo2ILoc(ix,iy,ixLA,iyLA);
757   fCurrentPad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kTRUE);
758   if ( !fCurrentPad.IsValid() )
759         {
760                 AliError(Form("Setting current pad to invalid ! (ix,iy)=(%4d,%4d)",ix,iy));
761         }
762 }
763
764 //_____________________________________________________________________________
765 void
766 AliMUONTriggerSegmentationV2::SetPadSize(float,float)
767 {
768   AliFatal("Not Implemented");
769 }
770
771 //_____________________________________________________________________________
772 Int_t 
773 AliMUONTriggerSegmentationV2::SigGenCond(Float_t,Float_t,Float_t)
774 {
775   AliFatal("Not Implemented");
776   return 0;
777 }
778
779 //_____________________________________________________________________________
780 void 
781 AliMUONTriggerSegmentationV2::SigGenInit(Float_t,Float_t,Float_t)
782 {
783   AliFatal("Not Implemented");
784 }
785
786 //_____________________________________________________________________________
787 void
788 AliMUONTriggerSegmentationV2::Streamer(TBuffer &R__b)
789 {
790   if (R__b.IsReading()) 
791         {
792     AliMUONTriggerSegmentationV2::Class()->ReadBuffer(R__b, this);
793     ReadMappingData();
794   } 
795   else 
796         {
797     AliMUONTriggerSegmentationV2::Class()->WriteBuffer(R__b, this);
798   }
799 }
800
801
802
803
804
805
806