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