]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpSectorSegmentation.cxx
Coding convention violations (RC17): suppression
[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
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 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
3d1463c8 29//-----------------------------------------------------------------------------
5f91c9e8 30
5f91c9e8 31#include "AliMpSectorSegmentation.h"
32#include "AliMpSector.h"
33#include "AliMpZone.h"
2998a151 34#include "AliMpSubZone.h"
5f91c9e8 35#include "AliMpRow.h"
36#include "AliMpVRowSegment.h"
37#include "AliMpMotifMap.h"
38#include "AliMpVMotif.h"
39#include "AliMpMotifPosition.h"
40#include "AliMpConnection.h"
5f91c9e8 41#include "AliMpSectorAreaHPadIterator.h"
42#include "AliMpSectorAreaVPadIterator.h"
dbea2959 43#include "AliMpSectorPadIterator.h"
2998a151 44#include "AliMpArea.h"
5f91c9e8 45#include "AliMpConstants.h"
168e9c4d 46#include "AliMpEncodePair.h"
5f91c9e8 47
63bcb3c3 48#include "AliLog.h"
49
50#include <Riostream.h>
51#include <TMath.h>
5f91c9e8 52
13985652 53/// \cond CLASSIMP
54ClassImp(AliMpSectorSegmentation)
55/// \endcond
56
5f91c9e8 57//______________________________________________________________________________
d79286ca 58AliMpSectorSegmentation::AliMpSectorSegmentation(
59 const AliMpSector* sector, Bool_t own)
5f91c9e8 60 : AliMpVSegmentation(),
580c28fd 61 fkSector(sector),
d79286ca 62 fIsOwner(own),
13e7956b 63 fPadBuffer(0),
580c28fd 64 fMaxIndexInX(0),
65 fMaxIndexInY(0)
5f91c9e8 66{
dee1d5f1 67/// Standard constructor
68
d79286ca 69 AliDebugStream(1) << "this = " << this << endl;
70
5f91c9e8 71 fPadBuffer = new AliMpPad(AliMpPad::Invalid());
72
6e97fbb8 73 //FillPadDimensionsMap();
5f91c9e8 74}
75
76//______________________________________________________________________________
77AliMpSectorSegmentation::AliMpSectorSegmentation()
78 : AliMpVSegmentation(),
79 fkSector(0),
d79286ca 80 fIsOwner(false),
5f91c9e8 81 fPadBuffer(0),
580c28fd 82 fMaxIndexInX(0),
83 fMaxIndexInY(0)
5f91c9e8 84{
dee1d5f1 85/// Default constructor
d79286ca 86
87 AliDebugStream(1) << "this = " << this << endl;
5f91c9e8 88}
89
90//______________________________________________________________________________
dee1d5f1 91AliMpSectorSegmentation::~AliMpSectorSegmentation()
92{
93/// Destructor
94
d79286ca 95 AliDebugStream(1) << "this = " << this << endl;
96
97 if ( fIsOwner ) delete fkSector;
98
5f91c9e8 99 delete fPadBuffer;
d79286ca 100
5f91c9e8 101}
102
103//
104// private methods
105//
106
5f91c9e8 107//______________________________________________________________________________
108AliMpMotifPosition*
168e9c4d 109AliMpSectorSegmentation::FindMotifPosition(Int_t ix, Int_t iy) const
5f91c9e8 110{
dee1d5f1 111/// Find the motif position which contains the given pad indices
112/// return 0 if not found
5f91c9e8 113
168e9c4d 114 switch ( fkSector->GetDirection() ) {
cddd101e 115 case AliMp::kX : {
5f91c9e8 116 // Case where all the pads have the same size along X direction
117
168e9c4d 118 for ( Int_t irow=0; irow<fkSector->GetNofRows(); ++irow ) {
5f91c9e8 119 AliMpRow* row = fkSector->GetRow(irow);
168e9c4d 120 if ( row->GetLowLimitIx() <= ix &&
121 row->GetHighLimitIx()>= ix ) {
5f91c9e8 122
168e9c4d 123 for ( Int_t iseg=0;iseg<row->GetNofRowSegments();++iseg ) {
5f91c9e8 124 AliMpVRowSegment* seg = row->GetRowSegment(iseg);
168e9c4d 125 if ( seg->GetLowLimitIx() <= ix &&
126 seg->GetHighLimitIx() >= ix ) {
5f91c9e8 127
128 AliMpMotifPosition* motifPos;
168e9c4d 129 for ( Int_t imot=0;imot<seg->GetNofMotifs();++imot ) {
5f91c9e8 130 motifPos
131 = fkSector->GetMotifMap()
132 ->FindMotifPosition(seg->GetMotifPositionId(imot));
168e9c4d 133 if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix,iy))) return motifPos;
5f91c9e8 134 }
135 }
136 }
137 }
138 }
139 return 0;
140 }
dee1d5f1 141 break;
5f91c9e8 142 ////////////////////////////////////////////////////////////////////////////////
cddd101e 143 case AliMp::kY : {
5f91c9e8 144 // Case where all the pads have the same size along Y direction
145 // look for the row which contains the indices
146 AliMpRow* row=0;
147 Int_t irow;
168e9c4d 148 for ( irow=0; irow<fkSector->GetNofRows(); ++irow ) {
5f91c9e8 149 row = fkSector->GetRow(irow);
150 AliMpVRowSegment* lastSeg = row->GetRowSegment(row->GetNofRowSegments()-1);
168e9c4d 151 if ( lastSeg->GetLowLimitIy() <= iy &&
152 lastSeg->GetHighLimitIy() >= iy ) break;
5f91c9e8 153 // NOTE : We use the last row segment in order to ensure that
154 // we are not on a special motif
155 }
168e9c4d 156 if ( irow==fkSector->GetNofRows() ) return 0;
5f91c9e8 157 // look for the row segment, in the found row, which contains the indices
158 AliMpVRowSegment* seg=0;
159 Int_t iseg;
168e9c4d 160 for ( iseg=0;iseg<row->GetNofRowSegments();++iseg ) {
5f91c9e8 161 seg = row->GetRowSegment(iseg);
168e9c4d 162 if (seg->HasIndices(AliMp::Pair(ix, iy))) break;
5f91c9e8 163 }
168e9c4d 164 if ( iseg==row->GetNofRowSegments() ) return 0;
5f91c9e8 165
166 // look for the motif position which contains the indices
167 AliMpMotifPosition* motifPos=0;
168 Int_t imot=0;
168e9c4d 169 for ( imot=0;imot<seg->GetNofMotifs();++imot ) {
5f91c9e8 170 motifPos
171 = fkSector->GetMotifMap()
172 ->FindMotifPosition(seg->GetMotifPositionId(imot));
168e9c4d 173 if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix, iy))) break;
5f91c9e8 174 }
175 if (imot==seg->GetNofMotifs()) return 0;
176
177 return motifPos;
178 }
179 default: return 0;
180 }
181}
182
183//______________________________________________________________________________
184AliMpPad
6e97fbb8 185AliMpSectorSegmentation::PadByXDirection(Double_t startx, Double_t starty,
5f91c9e8 186 Double_t maxX) const
187{
dee1d5f1 188/// Find the first valid pad from starting position in the
189/// direction of pad lines up to distance dx.
5f91c9e8 190
191 // Define step limits
6e97fbb8 192 Double_t stepX = fkSector->GetMinPadDimensionX();
5f91c9e8 193
194 // Search in X direction
195 AliMpPad pad;
6e97fbb8 196 Double_t posx = startx;
5f91c9e8 197 do {
6e97fbb8 198 pad = PadByPosition(posx, starty, false);
199 posx += stepX;
5f91c9e8 200 }
6e97fbb8 201 while ( ! pad.IsValid() &&
202 posx - fkSector->GetMaxPadDimensionX() < maxX );
5f91c9e8 203
204 // Invalidate pad if it is outside limits
6e97fbb8 205 if ( ( pad.GetPositionX() - pad.GetDimensionX()) > maxX )
5f91c9e8 206 pad = AliMpPad::Invalid();
207
208 return pad;
209}
210
211//______________________________________________________________________________
212AliMpPad
6e97fbb8 213AliMpSectorSegmentation::PadByYDirection(Double_t startx, Double_t starty,
5f91c9e8 214 Double_t maxY) const
215{
dee1d5f1 216/// Find the first valid pad from starting position in the
217/// direction of pad columns up to distance dx.
5f91c9e8 218
219 // Define step limits
6e97fbb8 220 Double_t stepY = fkSector->GetMinPadDimensionY();
5f91c9e8 221
222 // Search in Y direction
223 AliMpPad pad;
6e97fbb8 224 Double_t posy = starty;
5f91c9e8 225 do {
6e97fbb8 226 pad = PadByPosition(startx, posy, false);
227 posy += stepY;
5f91c9e8 228 }
6e97fbb8 229 while ( ! pad.IsValid() &&
230 posy - fkSector->GetMaxPadDimensionY()< maxY );
5f91c9e8 231
232 // Invalidate pad if it is outside limits
6e97fbb8 233 if (( pad.GetPositionY() - pad.GetDimensionY()) > maxY )
5f91c9e8 234 pad = AliMpPad::Invalid();
235
236 return pad;
237}
238
5f91c9e8 239//
240// public methods
241//
242
243//______________________________________________________________________________
244AliMpVPadIterator*
245AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
246{
dee1d5f1 247/// Create the area iterator.
5f91c9e8 248
249 switch (fkSector->GetDirection()) {
250
cddd101e 251 case AliMp::kX: return new AliMpSectorAreaVPadIterator(this, area);
5f91c9e8 252 ;;
cddd101e 253 case AliMp::kY: return new AliMpSectorAreaHPadIterator(this, area);
5f91c9e8 254 ;;
255 }
256
257 Fatal("CreateIterator", "Incomplete switch on Sector direction");
258 return 0;
259}
260
984a565f 261//______________________________________________________________________________
3635f34f 262AliMpVPadIterator*
263AliMpSectorSegmentation::CreateIterator() const
984a565f 264{
3635f34f 265/// Create the sector iterator
266
267 return new AliMpSectorPadIterator(fkSector);
984a565f 268}
269
63bcb3c3 270//______________________________________________________________________________
3635f34f 271Int_t
272AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
273 Bool_t includeSelf,
274 Bool_t includeVoid) const
63bcb3c3 275{
3635f34f 276 /// Uses default implementation
277 return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid);
63bcb3c3 278}
279
5f91c9e8 280//______________________________________________________________________________
281AliMpPad
168e9c4d 282AliMpSectorSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel,
5f91c9e8 283 Bool_t warning) const
284{
dee1d5f1 285/// Find the pad which corresponds to the given location
6e97fbb8 286
168e9c4d 287 if ( fPadBuffer->GetManuId() == manuId &&
288 fPadBuffer->GetManuChannel() == manuChannel ) return (*fPadBuffer);
5f91c9e8 289
290 AliMpMotifPosition* motifPos =
168e9c4d 291 fkSector->GetMotifMap()->FindMotifPosition(manuId);
5f91c9e8 292 if (!motifPos){
293 if (warning) Warning("PadByLocation","The pad motif position ID doesn't exists");
294 return AliMpPad::Invalid();
295 }
296
297 AliMpVMotif* motif = motifPos->GetMotif();
168e9c4d 298 MpPair_t localIndices =
299 motif->GetMotifType()->FindLocalIndicesByGassiNum(manuChannel);
300 if ( localIndices < 0 ) {
5f91c9e8 301 if (warning) Warning("PadByLocation","The pad number doesn't exists");
302 return AliMpPad::Invalid();
303 }
6e97fbb8 304
305 Double_t posx, posy;
306 motif->PadPositionLocal(localIndices, posx, posy);
307 posx += motifPos->GetPositionX();
308 posy += motifPos->GetPositionY();
309
310 Double_t dx, dy;
311 motif->GetPadDimensionsByIndices(localIndices, dx, dy);
168e9c4d 312
313 return (*fPadBuffer) = AliMpPad(manuId, manuChannel,
5f91c9e8 314 motifPos->GlobalIndices(localIndices),
6e97fbb8 315 posx, posy, dx, dy);
5f91c9e8 316}
317//______________________________________________________________________________
318AliMpPad
168e9c4d 319AliMpSectorSegmentation::PadByIndices(Int_t ix, Int_t iy, Bool_t warning ) const
5f91c9e8 320{
dee1d5f1 321/// Find the pad which corresponds to the given indices
5f91c9e8 322
168e9c4d 323 if ( fPadBuffer->GetIx() == ix &&
324 fPadBuffer->GetIy() == iy ) return (*fPadBuffer);
325
326 MpPair_t indices = AliMp::Pair(ix, iy);
327 AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy);
5f91c9e8 328 if (!motifPos) {
073fe42a 329 if (warning)
580c28fd 330 Warning("PadByIndices","Pad indices not contained in any motif!");
5f91c9e8 331 return AliMpPad::Invalid();
332 }
333
334 // retrieve the local indices in the found motif
335 AliMpVMotif* motif = motifPos->GetMotif();
168e9c4d 336 MpPair_t localIndices = indices - motifPos->GetLowIndicesLimit();
5f91c9e8 337
338 AliMpConnection* connection=
339 motif->GetMotifType()->FindConnectionByLocalIndices(localIndices);
340
341 if (!connection){
342 if (warning) Warning("PadByIndices","No connection with the given indices!");
343 return AliMpPad::Invalid();
344 }
345
6e97fbb8 346 Double_t posx, posy;
347 motif->PadPositionLocal(localIndices, posx, posy);
348 posx += motifPos->GetPositionX();
349 posy += motifPos->GetPositionY();
350
351 Double_t dx, dy;
352 motif->GetPadDimensionsByIndices(localIndices, dx, dy);
5f91c9e8 353
354 return (*fPadBuffer)
168e9c4d 355 = AliMpPad(motifPos->GetID(),connection->GetManuChannel(),
6e97fbb8 356 ix, iy, posx, posy, dx, dy);
5f91c9e8 357}
6e97fbb8 358
5f91c9e8 359//______________________________________________________________________________
360AliMpPad
6e97fbb8 361AliMpSectorSegmentation::PadByPosition(Double_t x, Double_t y,
5f91c9e8 362 Bool_t warning) const
363{
dee1d5f1 364/// Find the pad which corresponds to the given position
5f91c9e8 365
6e97fbb8 366 if (fPadBuffer->GetPositionX()==x &&
367 fPadBuffer->GetPositionY()==y) return (*fPadBuffer);
5f91c9e8 368
6e97fbb8 369 Int_t motifPosID = fkSector->FindMotifPositionId(x,y);
5f91c9e8 370 AliMpMotifPosition* motifPos
371 = fkSector->GetMotifMap()
372 ->FindMotifPosition(motifPosID);
373
374 if (!motifPos){
375 if (warning) Warning("PadByPosition","Position outside limits");
376 return AliMpPad::Invalid();
377 }
378
379 AliMpVMotif* motif = motifPos->GetMotif();
168e9c4d 380 MpPair_t localIndices
6e97fbb8 381 = motif->PadIndicesLocal(x-motifPos->GetPositionX(),
382 y-motifPos->GetPositionY());
168e9c4d 383
384 if ( localIndices < 0 ) {
654f27d4 385 if (warning) Warning("PadByPosition","Position outside motif limits");
386 return AliMpPad::Invalid();
387 }
388
5f91c9e8 389 AliMpConnection* connect =
390 motif->GetMotifType()->FindConnectionByLocalIndices(localIndices);
391
654f27d4 392 if ( ! connect ) {
5f91c9e8 393 if (warning) Warning("PadByPosition","Position outside motif limits");
394 return AliMpPad::Invalid();
395 }
6e97fbb8 396
397 Double_t posx, posy;
398 motif->PadPositionLocal(localIndices, posx, posy);
399 posx += motifPos->GetPositionX();
400 posy += motifPos->GetPositionY();
401
402 Double_t dx, dy;
403 motif->GetPadDimensionsByIndices(localIndices, dx, dy);
5f91c9e8 404
405 return (*fPadBuffer)
168e9c4d 406 = AliMpPad(motifPosID, connect->GetManuChannel(),
5f91c9e8 407 motifPos->GlobalIndices(localIndices),
6e97fbb8 408 posx, posy, dx, dy);
5f91c9e8 409}
410
411//______________________________________________________________________________
412AliMpPad
6e97fbb8 413AliMpSectorSegmentation::PadByDirection(Double_t startx, Double_t starty,
5f91c9e8 414 Double_t distance) const
415{
dee1d5f1 416/// Find the first valid pad from starting position in the
417/// direction of pad lines/columns up to the specified distance.
418/// Pad lines are the lines of pads in the sector with constant pad y size,
419/// pad columns are the columns of pads in the sector with constant pad x size.
5f91c9e8 420
421 switch (fkSector->GetDirection()) {
422
6e97fbb8 423 case AliMp::kX: return PadByYDirection(startx, starty, distance);
5f91c9e8 424 ;;
6e97fbb8 425 case AliMp::kY: return PadByXDirection(startx, starty, distance);
5f91c9e8 426 ;;
427 }
428
429 Fatal("PadByDirection", "Incomplete switch on Sector direction");
430 return AliMpPad::Invalid();
431}
432
3635f34f 433//_____________________________________________________________________________
434Bool_t
168e9c4d 435AliMpSectorSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const
3635f34f 436{
437 /// Whether or not we have a pad at indices=(ix,iy)
438
168e9c4d 439 MpPair_t indices = AliMp::Pair(ix, iy);
440
441 AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy);
3635f34f 442
443 if (motifPos) return motifPos->HasPadByIndices(indices);
444
445 return kFALSE;
446}
447
448//_____________________________________________________________________________
449Bool_t
168e9c4d 450AliMpSectorSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const
3635f34f 451{
452 /// Whether or not we have a pad at location=(manuId,manuChannel)
453
168e9c4d 454 AliMpMotifPosition* motifPos
455 = fkSector->GetMotifMap()->FindMotifPosition(manuId);
3635f34f 456
168e9c4d 457 if ( motifPos ) return motifPos->HasPadByManuChannel(manuChannel);
3635f34f 458
459 return kFALSE;
460}
461
580c28fd 462//______________________________________________________________________________
bd984e15 463Int_t AliMpSectorSegmentation::MaxPadIndexX() const
580c28fd 464{
dee1d5f1 465/// Return maximum pad index in x
580c28fd 466
168e9c4d 467 return AliMp::PairFirst(fkSector->GetMaxPadIndices());
580c28fd 468}
469
470//______________________________________________________________________________
bd984e15 471Int_t AliMpSectorSegmentation::MaxPadIndexY() const
580c28fd 472{
dee1d5f1 473/// Return maximum pad index in y
580c28fd 474
168e9c4d 475 return AliMp::PairSecond(fkSector->GetMaxPadIndices());
bd984e15 476}
477
478//______________________________________________________________________________
479Int_t AliMpSectorSegmentation::NofPads() const
480{
481/// Return number of pads defined in the sector
482
483 return fkSector->GetNofPads();
580c28fd 484}
485
3635f34f 486//_____________________________________________________________________________
487void
488AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
5f91c9e8 489{
3635f34f 490 /// Fill the array ecn with all manuIds
5f91c9e8 491
3635f34f 492 GetSector()->GetAllMotifPositionsIDs(ecn);
493}
494
495//_____________________________________________________________________________
496Int_t
497AliMpSectorSegmentation::GetNofElectronicCards() const
498{
499 /// Get the number of manus of this sector
500
501 return fkSector->GetNofMotifPositions();
502}
503
504//_____________________________________________________________________________
505Bool_t
506AliMpSectorSegmentation::HasMotifPosition(Int_t manuId) const
507{
508 /// Whether we get a given manu. Uses default implementation
509 return (AliMpVSegmentation::HasMotifPosition(manuId) != 0x0);
510}
511
512//_____________________________________________________________________________
513AliMpMotifPosition*
514AliMpSectorSegmentation::MotifPosition(Int_t manuId) const
515{
516 /// Return a given manu
517 return fkSector->GetMotifMap()->FindMotifPosition(manuId);
5f91c9e8 518}
519
520//______________________________________________________________________________
3635f34f 521AliMp::PlaneType
522AliMpSectorSegmentation::PlaneType() const
523{
524 return GetSector()->GetPlaneType();
525}
526
6e97fbb8 527//_____________________________________________________________________________
528Double_t
529AliMpSectorSegmentation::GetDimensionX() const
5f91c9e8 530{
6e97fbb8 531/// Return sector x dimensions
532 return GetSector()->GetDimensionX();
533}
5f91c9e8 534
6e97fbb8 535//_____________________________________________________________________________
536Double_t
537AliMpSectorSegmentation::GetDimensionY() const
538{
539/// Return sector y dimensions
540 return GetSector()->GetDimensionY();
5f91c9e8 541}
542
6e97fbb8 543//_____________________________________________________________________________
544Double_t
545AliMpSectorSegmentation::GetPositionX() const
546{
547/// Return x position
548 return 0.;
549}
3635f34f 550
6e97fbb8 551//_____________________________________________________________________________
552Double_t
553AliMpSectorSegmentation::GetPositionY() const
554{
555/// Return y position
556 return 0.;
3635f34f 557}
558
559//______________________________________________________________________________
560void
561AliMpSectorSegmentation::Print(Option_t* opt) const
5f91c9e8 562{
3635f34f 563/// Print the sector
5f91c9e8 564
3635f34f 565 fkSector->Print(opt);
566}
5f91c9e8 567
568//______________________________________________________________________________
6e97fbb8 569Double_t AliMpSectorSegmentation::GetMinPadDimensionX() const
5f91c9e8 570{
6e97fbb8 571/// Return the x dimension of the smallest pad.
5f91c9e8 572
6e97fbb8 573 return fkSector->GetMinPadDimensionX();
5f91c9e8 574}
575
5f91c9e8 576
3635f34f 577//______________________________________________________________________________
6e97fbb8 578Double_t AliMpSectorSegmentation::GetMinPadDimensionY() const
3635f34f 579{
6e97fbb8 580/// Return the y dimension of the smallest pad.
3635f34f 581
6e97fbb8 582 return fkSector->GetMinPadDimensionY();
3635f34f 583}
584
6e97fbb8 585
5f91c9e8 586//______________________________________________________________________________
168e9c4d 587Bool_t AliMpSectorSegmentation::CircleTest(Int_t ix, Int_t iy) const
5f91c9e8 588{
dee1d5f1 589/// Verify that all methods for retrieving pads are consistents between them.
590/// Return true if the pad with specified indices was found and verified,
591/// false otherwise.
5f91c9e8 592
168e9c4d 593 if ( ! HasPadByIndices(ix, iy) ) return false;
5f91c9e8 594
595 // Verify the indice->location->position->indice way
168e9c4d 596 AliMpPad pad1 = PadByIndices(ix, iy);
597 AliMpPad pad2 = PadByLocation(pad1.GetManuId(), pad1.GetManuChannel());
6e97fbb8 598 AliMpPad pad3 = PadByPosition(pad2.GetPositionX(),pad2.GetPositionY());
168e9c4d 599
600 MpPair_t retIndices = pad3.GetIndices();
5f91c9e8 601
168e9c4d 602 if ( retIndices != AliMp::Pair(ix, iy) ) {
603 cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl;
5f91c9e8 604 cout << "in indice->location->position->indice way..." << endl;
168e9c4d 605 cout << "starting from indices " << pad1 << endl
606 << "--> location " << pad2 << endl
607 << "--> position "
6e97fbb8 608 << '(' << pad3.GetPositionX() << ',' << pad3.GetPositionY() << ')'
168e9c4d 609 << endl << endl;
5f91c9e8 610 }
611
168e9c4d 612 // Verify the indice->position->location->indice way
6e97fbb8 613 AliMpPad pad2bis = PadByPosition(pad1.GetPositionX(),pad1.GetPositionY());
168e9c4d 614 AliMpPad pad3bis = PadByLocation(pad2bis.GetManuId(), pad2bis.GetManuChannel());
615
616 retIndices = pad3bis.GetIndices();
617
618 if ( retIndices != AliMp::Pair(ix, iy) ) {
619 cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl;
620 cout << "in indice->position->location->indice way..." << endl;
621 cout << "starting from indices " << pad1 << endl
622 << "--> position "
6e97fbb8 623 << '(' << pad2bis.GetPositionX() << ',' << pad2bis.GetPositionY() << ')' << endl
168e9c4d 624 << "--> location " << pad3bis
625 << endl << endl;
5f91c9e8 626 }
627
628 return true;
629}