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