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