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