]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSectorSegmentation.cxx
b61a7a16b80e421b12f8ea576e79991c4067225b
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSectorSegmentation.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 // $MpId: AliMpSectorSegmentation.cxx,v 1.15 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19
20 //-----------------------------------------------------------------------------
21 // Class AliMpSectorSegmentation
22 // -----------------------------
23 // Class describing the segmentation of the sector.        
24 // Provides methods related to pads:
25 // conversion between pad indices, pad location, pad position;
26 // finding pad neighbour.
27 //
28 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
29 //-----------------------------------------------------------------------------
30
31 #include "AliMpSectorSegmentation.h"
32 #include "AliMpSector.h"
33 #include "AliMpZone.h"
34 #include "AliMpSubZone.h"
35 #include "AliMpRow.h"
36 #include "AliMpVRowSegment.h"
37 #include "AliMpMotifMap.h"
38 #include "AliMpVMotif.h"
39 #include "AliMpMotifPosition.h"
40 #include "AliMpConnection.h"
41 #include "AliMpNeighboursPadIterator.h"
42 #include "AliMpSectorAreaHPadIterator.h"
43 #include "AliMpSectorAreaVPadIterator.h"
44 #include "AliMpSectorPadIterator.h"
45 #include "AliMpIntPair.h"
46 #include "AliMpArea.h"
47 #include "AliMpConstants.h"
48
49 #include "AliLog.h"
50
51 #include <Riostream.h>
52 #include <TMath.h>
53
54 /// \cond CLASSIMP
55 ClassImp(AliMpSectorSegmentation)
56 /// \endcond
57
58 #ifdef WITH_ROOT
59 const Double_t AliMpSectorSegmentation::fgkS1 = 100000.;
60 const Double_t AliMpSectorSegmentation::fgkS2 = 1000.;
61 #endif
62
63 //______________________________________________________________________________
64 AliMpSectorSegmentation::AliMpSectorSegmentation(
65                             const AliMpSector* sector, Bool_t own) 
66   : AliMpVSegmentation(),
67     fkSector(sector),
68     fIsOwner(own),
69     fPadBuffer(0),
70     fPadDimensionsMap(),
71     fMaxIndexInX(0),
72     fMaxIndexInY(0)
73 {
74 /// Standard constructor
75
76   AliDebugStream(1) << "this = " << this << endl;
77
78   fPadBuffer = new AliMpPad(AliMpPad::Invalid());
79   
80   FillPadDimensionsMap();
81 }
82
83 //______________________________________________________________________________
84 AliMpSectorSegmentation::AliMpSectorSegmentation() 
85   : AliMpVSegmentation(),
86     fkSector(0),
87     fIsOwner(false),
88     fPadBuffer(0),
89     fPadDimensionsMap(),      
90     fMaxIndexInX(0),
91     fMaxIndexInY(0)
92 {
93 /// Default constructor
94
95   AliDebugStream(1) << "this = " << this << endl;
96 }
97
98 //______________________________________________________________________________
99 AliMpSectorSegmentation::~AliMpSectorSegmentation() 
100 {
101 /// Destructor 
102
103   AliDebugStream(1) << "this = " << this << endl;
104
105   if ( fIsOwner ) delete fkSector;
106
107   delete fPadBuffer;
108   
109 }
110
111 //
112 // private methods
113 //
114
115 #ifdef WITH_ROOT
116 //______________________________________________________________________________
117 Long_t AliMpSectorSegmentation::GetIndex(const TVector2& vector2) const
118 {
119 /// Convert the two vector to long.
120
121   return Long_t(TMath::Floor((vector2.X()*fgkS1 + vector2.Y())*fgkS2));
122 }  
123
124 //______________________________________________________________________________
125 TVector2  AliMpSectorSegmentation::GetVector(Long_t index) const
126 {
127 /// Convert the long index to twovector.
128
129   return TVector2( TMath::Floor(index/fgkS1)/fgkS2,
130                    (index - TMath::Floor(index/fgkS1)*fgkS1)/fgkS2 );
131 }  
132 #endif
133
134 //______________________________________________________________________________
135 void AliMpSectorSegmentation::FillPadDimensionsMap()
136 {
137 /// Fill the maps between zone ids and pad dimensions.
138
139   for (Int_t i=0; i<fkSector->GetNofZones(); i++) {
140     AliMpZone* zone   = fkSector->GetZone(i+1);
141     Int_t  zoneID = zone->GetID();
142     
143     if (!AliMpConstants::IsEqual(zone->GetPadDimensions(), TVector2())) {
144
145       // regular zone
146 #ifdef WITH_STL
147       fPadDimensionsMap[zoneID*10] = zone->GetPadDimensions();
148 #endif
149 #ifdef WITH_ROOT
150      AliDebugStream(3)
151        << "Filling fPadDimensions[" << zoneID*10 << "] = ("
152        << zone->GetPadDimensions().X() << ", "
153        << zone->GetPadDimensions().Y() << ")" << endl;
154
155      fPadDimensionsMap.Add((Long_t)(zoneID*10), 
156                             GetIndex(zone->GetPadDimensions()));
157 #endif
158     }
159     else {
160       // special zone
161       Int_t subIndex = 0;
162       for (Int_t j=0; j<zone->GetNofSubZones(); j++) {
163         AliMpSubZone* subZone = zone->GetSubZone(j);
164         AliMpVMotif*  motif = subZone->GetMotif();
165         
166         for (Int_t k=0; k<motif->GetNofPadDimensions(); k++) {
167           Int_t index = zoneID*10 +  subIndex++;
168 #ifdef WITH_STL
169           fPadDimensionsMap[index] = motif->GetPadDimensions(k);
170 #endif
171 #ifdef WITH_ROOT
172           AliDebugStream(3)
173             << "Filling fPadDimensions[" << index << "] = ("
174             << motif->GetPadDimensions(k).X() << ", "
175             << motif->GetPadDimensions(k).Y() << ") motif "
176             << motif->GetID().Data() << "-" << k << endl;
177
178           fPadDimensionsMap.Add((Long_t)(index), 
179                             GetIndex(motif->GetPadDimensions(k)));
180 #endif
181         }
182       }   
183     }     
184   }      
185 }
186
187 //______________________________________________________________________________
188 AliMpMotifPosition* 
189 AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const
190 {
191 /// Find the motif position which contains the given pad indices
192 /// return 0 if not found
193
194   switch (fkSector->GetDirection()) {
195     case AliMp::kX : {
196     // Case where all the pads have the same size along X direction
197
198       for (Int_t irow=0; irow<fkSector->GetNofRows(); ++irow) {
199         AliMpRow* row = fkSector->GetRow(irow);
200         if (row->GetLowIndicesLimit().GetFirst()<=indices.GetFirst() &&
201             row->GetHighIndicesLimit().GetFirst()>=indices.GetFirst()) {
202             
203            for (Int_t iseg=0;iseg<row->GetNofRowSegments();++iseg){
204             AliMpVRowSegment* seg = row->GetRowSegment(iseg);
205             if (seg->GetLowIndicesLimit().GetFirst()<=indices.GetFirst() &&
206                 seg->GetHighIndicesLimit().GetFirst()>=indices.GetFirst()) {
207
208               AliMpMotifPosition* motifPos;
209               for (Int_t imot=0;imot<seg->GetNofMotifs();++imot) {
210                 motifPos 
211                   = fkSector->GetMotifMap()
212                     ->FindMotifPosition(seg->GetMotifPositionId(imot));
213                 if (motifPos && motifPos->HasPadByIndices(indices)) return motifPos;
214               }
215             }
216           }
217         }
218       }
219       return 0;
220     }
221     break;
222     ////////////////////////////////////////////////////////////////////////////////
223     case AliMp::kY : {
224       // Case where all the pads have the same size along Y direction   
225       // look for the row which contains the indices
226       AliMpRow* row=0;
227       Int_t irow;
228       for (irow=0; irow<fkSector->GetNofRows(); ++irow) {
229         row = fkSector->GetRow(irow);
230         AliMpVRowSegment* lastSeg = row->GetRowSegment(row->GetNofRowSegments()-1);
231         if (lastSeg->GetLowIndicesLimit().GetSecond()<=indices.GetSecond() &&
232             lastSeg->GetHighIndicesLimit().GetSecond()>=indices.GetSecond()) break;
233         // NOTE : We use the last row segment in order to ensure that
234         // we are not on a special motif
235       }
236       if (irow==fkSector->GetNofRows()) return 0;
237       // look for the row segment, in the found row, which contains the indices
238       AliMpVRowSegment* seg=0;
239       Int_t iseg;
240       for (iseg=0;iseg<row->GetNofRowSegments();++iseg){
241         seg = row->GetRowSegment(iseg);
242         if (seg->HasIndices(indices)) break;
243       }
244       if (iseg==row->GetNofRowSegments()) return 0;
245   
246       // look for the motif position which contains the indices
247       AliMpMotifPosition* motifPos=0;
248       Int_t imot=0;
249       for (imot=0;imot<seg->GetNofMotifs();++imot) {
250         motifPos 
251           = fkSector->GetMotifMap()
252             ->FindMotifPosition(seg->GetMotifPositionId(imot));
253         if (motifPos && motifPos->HasPadByIndices(indices)) break;
254       }      
255       if (imot==seg->GetNofMotifs()) return 0;
256    
257       return motifPos;      
258     }
259     default: return 0;
260   }
261 }
262
263 //______________________________________________________________________________
264 AliMpPad 
265 AliMpSectorSegmentation::PadByXDirection(const TVector2& startPosition, 
266                                          Double_t maxX) const
267 {
268 /// Find the first valid pad from starting position in the
269 /// direction of pad lines up to distance dx.
270
271   // Define step limits
272   Double_t  stepX = fkSector->GetMinPadDimensions().X();
273  
274   // Search in X direction
275   AliMpPad pad;
276   TVector2 position(startPosition);    
277   do {
278     pad = PadByPosition(position, false);
279     position += TVector2(stepX, 0.);
280   }   
281   while ( !pad.IsValid() && 
282           position.X() - fkSector->GetMaxPadDimensions().X() < maxX ); 
283   
284   // Invalidate pad if it is outside limits
285   if ( (pad.Position().X() - pad.Dimensions().X()) > maxX ) 
286     pad = AliMpPad::Invalid();
287
288   return pad;
289 }
290
291 //______________________________________________________________________________
292 AliMpPad 
293 AliMpSectorSegmentation::PadByYDirection(const TVector2& startPosition, 
294                                          Double_t maxY) const
295 {
296 /// Find the first valid pad from starting position in the
297 /// direction of pad columns up to distance dx.
298   
299   // Define step limits
300   Double_t stepY = fkSector->GetMinPadDimensions().Y();
301  
302   // Search in Y direction
303   AliMpPad pad;
304   TVector2 position(startPosition);    
305   do {
306     pad = PadByPosition(position, false);
307     position += TVector2(0., stepY);
308   }   
309   while ( !pad.IsValid() && 
310           position.Y() - fkSector->GetMaxPadDimensions().Y()< maxY ); 
311   
312   // Invalidate pad if it is outside limits
313   if ((pad.Position().Y() - pad.Dimensions().Y()) > maxY) 
314     pad = AliMpPad::Invalid();
315
316   return pad;
317 }
318
319 //
320 // public methods
321 //
322
323 //______________________________________________________________________________
324 AliMpVPadIterator* 
325 AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
326 {
327 /// Create the area iterator. 
328
329   switch (fkSector->GetDirection()) {
330   
331     case AliMp::kX: return new AliMpSectorAreaVPadIterator(this, area);
332              ;;
333     case AliMp::kY: return new AliMpSectorAreaHPadIterator(this, area);
334              ;;
335   }
336   
337   Fatal("CreateIterator", "Incomplete switch on Sector direction");
338   return 0;  
339 }   
340   
341 //______________________________________________________________________________
342 AliMpVPadIterator* 
343 AliMpSectorSegmentation::CreateIterator() const
344 {
345 /// Create the sector iterator
346
347   return new AliMpSectorPadIterator(fkSector);
348 }
349
350 //______________________________________________________________________________
351 AliMpVPadIterator* 
352 AliMpSectorSegmentation::CreateIterator(const AliMpPad& centerPad,
353                                         Bool_t includeCenter) const
354 {
355   /// Create the neighbours pad iterator.
356
357   return new AliMpNeighboursPadIterator(this, centerPad, includeCenter);
358 }   
359   
360 //______________________________________________________________________________
361 Int_t 
362 AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
363                                        Bool_t includeSelf,
364                                        Bool_t includeVoid) const
365 {
366   /// Uses default implementation
367   return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid);
368 }
369
370 //______________________________________________________________________________
371 AliMpPad 
372 AliMpSectorSegmentation::PadByLocation(const AliMpIntPair& location, 
373                                        Bool_t warning) const
374 {
375 /// Find the pad which corresponds to the given location
376   
377   if ((*fPadBuffer).GetLocation()==location) return (*fPadBuffer);
378   
379   AliMpMotifPosition* motifPos = 
380     fkSector->GetMotifMap()->FindMotifPosition(location.GetFirst());
381   if (!motifPos){
382     if (warning) Warning("PadByLocation","The pad motif position ID doesn't exists");
383     return AliMpPad::Invalid();
384   }
385   
386   AliMpVMotif* motif = motifPos->GetMotif();
387   AliMpIntPair localIndices = 
388     motif->GetMotifType()->FindLocalIndicesByGassiNum(location.GetSecond());
389   if (! localIndices.IsValid()) {
390     if (warning) Warning("PadByLocation","The pad number doesn't exists");
391     return AliMpPad::Invalid();
392   }
393   TVector2 delta = motif->PadPositionLocal(localIndices);
394   return (*fPadBuffer) = AliMpPad(location,
395               motifPos->GlobalIndices(localIndices),
396               motifPos->Position()+delta,
397               motif->GetPadDimensions(localIndices));
398
399 }
400 //______________________________________________________________________________
401 AliMpPad 
402 AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices,
403                                       Bool_t warning ) const
404 {
405 /// Find the pad which corresponds to the given indices  
406
407   if ((*fPadBuffer).GetIndices()==indices) return (*fPadBuffer);    
408    
409   AliMpMotifPosition* motifPos = FindMotifPosition(indices);
410   if (!motifPos) {    
411     if (warning) 
412       Warning("PadByIndices","Pad indices not contained in any motif!");
413     return AliMpPad::Invalid();
414   }
415   
416   // retrieve the local indices in the found motif
417   AliMpVMotif* motif = motifPos->GetMotif();
418   AliMpIntPair localIndices = indices - motifPos->GetLowIndicesLimit();
419   
420   AliMpConnection* connection=
421     motif->GetMotifType()->FindConnectionByLocalIndices(localIndices);
422     
423   if (!connection){
424     if (warning) Warning("PadByIndices","No connection with the given indices!");
425     return AliMpPad::Invalid();
426   }
427
428   TVector2 localPos = motif->PadPositionLocal(localIndices);
429
430   return (*fPadBuffer) 
431     = AliMpPad(AliMpIntPair(motifPos->GetID(),connection->GetManuChannel()),
432                indices,
433                motifPos->Position()+localPos,
434                motif->GetPadDimensions(localIndices)); 
435
436 }
437 //______________________________________________________________________________
438 AliMpPad 
439 AliMpSectorSegmentation::PadByPosition(const TVector2& position,
440                                        Bool_t warning) const
441 {
442 /// Find the pad which corresponds to the given position
443
444   if ((*fPadBuffer).Position().X()==position.X() && 
445       (*fPadBuffer).Position().Y()==position.Y()) return (*fPadBuffer);  
446
447   Int_t motifPosID = fkSector->FindMotifPositionId(position);
448   AliMpMotifPosition* motifPos 
449     = fkSector->GetMotifMap()
450         ->FindMotifPosition(motifPosID);
451     
452   if (!motifPos){
453     if (warning) Warning("PadByPosition","Position outside limits");
454     return AliMpPad::Invalid();
455   }
456
457   AliMpVMotif* motif =  motifPos->GetMotif();  
458   AliMpIntPair localIndices 
459     = motif->PadIndicesLocal(position-motifPos->Position());
460     
461   AliMpConnection* connect = 
462     motif->GetMotifType()->FindConnectionByLocalIndices(localIndices);
463
464    if (!connect){
465     if (warning) Warning("PadByPosition","Position outside motif limits");
466     return AliMpPad::Invalid();
467   }
468   
469   return (*fPadBuffer)
470     = AliMpPad(AliMpIntPair(motifPosID,connect->GetManuChannel()),
471                motifPos->GlobalIndices(localIndices),
472                motifPos->Position()+motif->PadPositionLocal(localIndices),
473                motif->GetPadDimensions(localIndices));
474
475 }
476
477 //______________________________________________________________________________
478 AliMpPad 
479 AliMpSectorSegmentation::PadByDirection(const TVector2& startPosition, 
480                                         Double_t distance) const
481 {
482 /// Find the first valid pad from starting position in the
483 /// direction of pad lines/columns up to the specified distance.
484 /// Pad lines are the lines of pads in the sector with constant pad y size,
485 /// pad columns are the columns of pads in the sector with constant pad x size. 
486
487   switch (fkSector->GetDirection()) {
488   
489     case AliMp::kX: return PadByYDirection(startPosition, distance);
490              ;;
491     case AliMp::kY: return PadByXDirection(startPosition, distance);
492              ;;
493   }
494   
495   Fatal("PadByDirection", "Incomplete switch on Sector direction");
496   return AliMpPad::Invalid();  
497 }
498
499 //_____________________________________________________________________________
500 Bool_t 
501 AliMpSectorSegmentation::HasPadByIndices(const AliMpIntPair& indices) const
502 {
503   ///  Whether or not we have a pad at indices=(ix,iy) 
504   
505   AliMpMotifPosition* motifPos = FindMotifPosition(indices);
506   
507   if (motifPos) return motifPos->HasPadByIndices(indices);
508   
509   return kFALSE;
510 }
511
512 //_____________________________________________________________________________
513 Bool_t 
514 AliMpSectorSegmentation::HasPadByLocation(const AliMpIntPair& location) const
515 {
516   /// Whether or not we have a pad at location=(manuId,manuChannel)
517   
518   AliMpMotifPosition* motifPos = 
519   fkSector->GetMotifMap()->FindMotifPosition(location.GetFirst());
520   
521   if ( motifPos ) return motifPos->HasPadByManuChannel(location.GetSecond());
522   
523   return kFALSE;
524 }
525
526 //______________________________________________________________________________
527 Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const
528 {
529 /// Does the pad specified by \a indices exist ?
530
531   return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
532 }
533
534 //______________________________________________________________________________
535 Int_t  AliMpSectorSegmentation::MaxPadIndexX() const
536 {
537 /// Return maximum pad index in x
538
539   return fkSector->GetMaxPadIndices().GetFirst();
540 }
541
542 //______________________________________________________________________________
543 Int_t  AliMpSectorSegmentation::MaxPadIndexY() const
544 {
545 /// Return maximum pad index in y
546
547   return fkSector->GetMaxPadIndices().GetSecond();
548 }
549
550 //______________________________________________________________________________
551 Int_t  AliMpSectorSegmentation::NofPads() const
552 {
553 /// Return number of pads defined in the sector
554
555   return fkSector->GetNofPads();
556 }
557
558 //_____________________________________________________________________________
559 void 
560 AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
561 {
562   /// Fill the array ecn with all manuIds
563
564   GetSector()->GetAllMotifPositionsIDs(ecn);
565 }
566
567 //_____________________________________________________________________________
568 Int_t 
569 AliMpSectorSegmentation::GetNofElectronicCards() const
570 {
571   /// Get the number of manus of this sector
572   
573   return fkSector->GetNofMotifPositions();  
574 }
575
576 //_____________________________________________________________________________
577 Bool_t 
578 AliMpSectorSegmentation::HasMotifPosition(Int_t manuId) const
579 {
580   /// Whether we get a given manu. Uses default implementation
581   return (AliMpVSegmentation::HasMotifPosition(manuId) != 0x0);
582 }
583
584 //_____________________________________________________________________________
585 AliMpMotifPosition* 
586 AliMpSectorSegmentation::MotifPosition(Int_t manuId) const
587 {
588   /// Return a given manu
589   return fkSector->GetMotifMap()->FindMotifPosition(manuId);
590 }
591
592 //______________________________________________________________________________
593 AliMp::PlaneType
594 AliMpSectorSegmentation::PlaneType() const
595 {
596   return GetSector()->GetPlaneType();
597 }
598
599 //______________________________________________________________________________
600 TVector2
601 AliMpSectorSegmentation::Dimensions() const
602 {
603 /// Return sector dimensions
604
605   return GetSector()->Dimensions();
606 }
607
608 //______________________________________________________________________________
609 TVector2 
610 AliMpSectorSegmentation::Position() const 
611
612 /// Return sector position
613
614   // return GetSector()->Position(); 
615   return TVector2(0.,0.);
616 }
617
618 //______________________________________________________________________________
619 void
620 AliMpSectorSegmentation::Print(Option_t* opt) const
621 {
622 /// Print the sector
623
624   fkSector->Print(opt);
625 }
626
627 //______________________________________________________________________________
628 Int_t AliMpSectorSegmentation::Zone(const AliMpPad& pad, Bool_t warning) const
629 {
630 /// Return the zone index of the zone containing the specified pad.
631 /// This zone index is different from the zone ID,
632 /// as it is unique for each pad dimensions.
633 /// It is composed in this way:
634 ///   zoneID*10 + specific index 
635 /// Specific index is present only for zones containing special motifs.
636
637   if (!pad.IsValid()) {
638     if (warning) Warning("Zone(AliMpPad)", "Invalid pad");
639     return 0;
640   }  
641
642 #ifdef WITH_STL
643   PadDimensionsMapCIterator it;
644   for (it = fPadDimensionsMap.begin(); it != fPadDimensionsMap.end(); ++it) {
645     if (AliMpConstants::IsEqual(it->second, pad.Dimensions()))
646       return it->first;
647   }
648 #endif
649
650 #ifdef WITH_ROOT
651   PadDimensionsMapCIterator it(&fPadDimensionsMap);
652   Long_t key, value;
653   while ( it.Next(key, value) ) {
654     TVector2 dimensions =  GetVector(value);
655     if (AliMpConstants::IsEqual(dimensions, pad.Dimensions()))
656       return (Int_t)key;
657   } 
658   
659   AliError(Form("fPadDimensionsMap size is %d",fPadDimensionsMap.GetSize()));
660   
661 #endif
662
663   // Should never happen
664   AliErrorStream() 
665     << "Zone(AliMpPad pad) not found, where pad is: " << pad << endl;
666   return 0;
667 }  
668
669 //______________________________________________________________________________
670 TVector2 
671 AliMpSectorSegmentation::PadDimensions(Int_t zone, Bool_t warning) const
672 {
673 /// Return the pad dimensions for the zone with the specified zone index.
674
675 #ifdef WITH_STL
676   PadDimensionsMapCIterator it = fPadDimensionsMap.find(zone);
677   if (it != fPadDimensionsMap.end()) return it->second;
678 #endif
679
680 #ifdef WITH_ROOT
681   Long_t value = fPadDimensionsMap.GetValue(zone);
682   if (value) return GetVector(value);
683 #endif
684
685   if (warning) Warning("PadDimensions(zone)", "not found");
686   return TVector2();
687 }  
688
689 //______________________________________________________________________________
690 TVector2  AliMpSectorSegmentation::GetMinPadDimensions() const
691 {
692 /// Returne the dimensions of the smallest pad.
693
694   return fkSector->GetMinPadDimensions();
695 }  
696
697 //______________________________________________________________________________
698 Bool_t AliMpSectorSegmentation::CircleTest(const AliMpIntPair& indices) const
699 {
700 /// Verify that all methods for retrieving pads are consistents between them.
701 /// Return true if the pad with specified indices was found and verified,
702 /// false otherwise.
703
704   if (!HasPad(indices)) return false;
705
706   // Verify the indice->location->position->indice way
707   AliMpIntPair location = PadByIndices(indices).GetLocation();
708   TVector2 position = PadByLocation(location).Position();
709   AliMpIntPair retIndices = PadByPosition(position).GetIndices();
710     
711   if (retIndices != indices) {
712     cout << "Pad " << indices << " lead to inconsistency" << endl;
713     cout << "in indice->location->position->indice way..." << endl;
714     cout << "starting from " << indices << "-->" << location << "-->" 
715          << '(' << position.X() << ',' << position.Y() << ')'
716          << " and retIndices: " << retIndices << endl;
717   }
718     
719     
720   // Verify the indice->position->location->indice way    
721   position = PadByIndices(indices).Position();
722   location = PadByPosition(position).GetLocation();
723   retIndices = PadByLocation(location).GetIndices();
724
725   if (retIndices != indices) {
726     cout << "Pad " << indices << " lead to inconsistency" << endl;
727     cout << "in indice->position->location->indice way..." <<endl;
728     cout << "starting from " << indices 
729          << " and retIndices: " << retIndices << endl;
730   }
731   
732   return true;
733 }
734
735 //______________________________________________________________________________
736 void AliMpSectorSegmentation::PrintZones() const
737 {
738 /// Print all zones and pads dimensions from the map.
739
740   cout << "Zones: " << endl;
741
742 #ifdef WITH_STL
743   PadDimensionsMapCIterator it;
744   for (it = fPadDimensionsMap.begin(); it != fPadDimensionsMap.end(); ++it) {
745     cout << "    zone: " <<   setw(4) << it->first;
746     cout << "    pad dimensions: ( " 
747          << it->second.X() << ", " << it->second.Y() << ")" << endl; 
748   }
749 #endif
750
751 #ifdef WITH_ROOT
752   PadDimensionsMapCIterator it(&fPadDimensionsMap);
753   Long_t key, value;
754   while ( it.Next(key, value) ) {
755     //cout << "Iterating over: " << key << ", " << value << endl;
756     TVector2 dimensions =  GetVector(value);
757
758     cout << "    zone: " <<   setw(4) << key;
759     cout << "    pad dimensions: ( " 
760          << dimensions.X() << ", " << dimensions.Y() << ")" << endl; 
761   }
762 #endif
763 }
764