]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSectorSegmentation.cxx
- All mapping enums within namespace (AliMp).
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSectorSegmentation.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 // $MpId: AliMpSectorSegmentation.cxx,v 1.15 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19 //
20 // Class AliMpSectorSegmentation
21 // -----------------------------
22 // Class describing the segmentation of the sector.        
23 // Provides methods related to pads:
24 // conversion between pad indices, pad location, pad position;
25 // finding pad neighbour.
26 //
27 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
28
29 #include "AliMpSectorSegmentation.h"
30 #include "AliMpSector.h"
31 #include "AliMpZone.h"
32 #include "AliMpSubZone.h"
33 #include "AliMpRow.h"
34 #include "AliMpVRowSegment.h"
35 #include "AliMpMotifMap.h"
36 #include "AliMpVMotif.h"
37 #include "AliMpMotifPosition.h"
38 #include "AliMpConnection.h"
39 #include "AliMpNeighboursPadIterator.h"
40 #include "AliMpSectorAreaHPadIterator.h"
41 #include "AliMpSectorAreaVPadIterator.h"
42 #include "AliMpIntPair.h"
43 #include "AliMpArea.h"
44 #include "AliMpConstants.h"
45
46 #include "AliLog.h"
47
48 #include <Riostream.h>
49 #include <TMath.h>
50
51 /// \cond CLASSIMP
52 ClassImp(AliMpSectorSegmentation)
53 /// \endcond
54
55 #ifdef WITH_ROOT
56 const Double_t AliMpSectorSegmentation::fgkS1 = 100000.;
57 const Double_t AliMpSectorSegmentation::fgkS2 = 1000.;
58 #endif
59
60 //______________________________________________________________________________
61 AliMpSectorSegmentation::AliMpSectorSegmentation(
62                             const AliMpSector* sector, Bool_t own) 
63   : AliMpVSegmentation(),
64     fkSector(sector),
65     fIsOwner(own),
66     fPadBuffer(0),
67     fPadDimensionsMap(),
68     fMaxIndexInX(0),
69     fMaxIndexInY(0)
70 {
71 /// Standard constructor
72
73   AliDebugStream(1) << "this = " << this << endl;
74
75   fPadBuffer = new AliMpPad(AliMpPad::Invalid());
76   
77   FillPadDimensionsMap();
78 }
79
80 //______________________________________________________________________________
81 AliMpSectorSegmentation::AliMpSectorSegmentation() 
82   : AliMpVSegmentation(),
83     fkSector(0),
84     fIsOwner(false),
85     fPadBuffer(0),
86     fPadDimensionsMap(),      
87     fMaxIndexInX(0),
88     fMaxIndexInY(0)
89 {
90 /// Default constructor
91
92   AliDebugStream(1) << "this = " << this << endl;
93 }
94
95 //______________________________________________________________________________
96 AliMpSectorSegmentation::~AliMpSectorSegmentation() 
97 {
98 /// Destructor 
99
100   AliDebugStream(1) << "this = " << this << endl;
101
102   if ( fIsOwner ) delete fkSector;
103
104   delete fPadBuffer;
105   
106 }
107
108 //
109 // private methods
110 //
111
112 //_____________________________________________________________________________
113 void 
114 AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
115 {
116   GetSector()->GetAllMotifPositionsIDs(ecn);
117 }
118
119 #ifdef WITH_ROOT
120 //______________________________________________________________________________
121 Long_t AliMpSectorSegmentation::GetIndex(const TVector2& vector2) const
122 {
123 /// Convert the two vector to long.
124
125   return Long_t(TMath::Floor((vector2.X()*fgkS1 + vector2.Y())*fgkS2));
126 }  
127
128 //______________________________________________________________________________
129 TVector2  AliMpSectorSegmentation::GetVector(Long_t index) const
130 {
131 /// Convert the long index to twovector.
132
133   return TVector2( TMath::Floor(index/fgkS1)/fgkS2,
134                    (index - TMath::Floor(index/fgkS1)*fgkS1)/fgkS2 );
135 }  
136 #endif
137
138 //______________________________________________________________________________
139 void AliMpSectorSegmentation::FillPadDimensionsMap()
140 {
141 /// Fill the maps between zone ids and pad dimensions.
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())) {
148
149       // regular zone
150 #ifdef WITH_STL
151       fPadDimensionsMap[zoneID*10] = zone->GetPadDimensions();
152 #endif
153 #ifdef WITH_ROOT
154      AliDebugStream(3)
155        << "Filling fPadDimensions[" << zoneID*10 << "] = ("
156        << zone->GetPadDimensions().X() << ", "
157        << zone->GetPadDimensions().Y() << ")" << endl;
158
159      fPadDimensionsMap.Add((Long_t)(zoneID*10), 
160                             GetIndex(zone->GetPadDimensions()));
161 #endif
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++;
172 #ifdef WITH_STL
173           fPadDimensionsMap[index] = motif->GetPadDimensions(k);
174 #endif
175 #ifdef WITH_ROOT
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
182           fPadDimensionsMap.Add((Long_t)(index), 
183                             GetIndex(motif->GetPadDimensions(k)));
184 #endif
185         }
186       }   
187     }     
188   }      
189 }
190
191 //______________________________________________________________________________
192 AliMpMotifPosition* 
193 AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const
194 {
195 /// Find the motif position which contains the given pad indices
196 /// return 0 if not found
197
198   switch (fkSector->GetDirection()) {
199     case AliMp::kX : {
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     }
225     break;
226     ////////////////////////////////////////////////////////////////////////////////
227     case AliMp::kY : {
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 //______________________________________________________________________________
268 AliMpPad 
269 AliMpSectorSegmentation::PadByXDirection(const TVector2& startPosition, 
270                                          Double_t maxX) const
271 {
272 /// Find the first valid pad from starting position in the
273 /// direction of pad lines up to distance dx.
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 //______________________________________________________________________________
295 AliMpPad 
296 AliMpSectorSegmentation::PadByYDirection(const TVector2& startPosition, 
297                                          Double_t maxY) const
298 {
299 /// Find the first valid pad from starting position in the
300 /// direction of pad columns up to distance dx.
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
321 //
322 // public methods
323 //
324
325 //______________________________________________________________________________
326 AliMpVPadIterator* 
327 AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
328 {
329 /// Create the area iterator. 
330
331   switch (fkSector->GetDirection()) {
332   
333     case AliMp::kX: return new AliMpSectorAreaVPadIterator(this, area);
334              ;;
335     case AliMp::kY: return new AliMpSectorAreaHPadIterator(this, area);
336              ;;
337   }
338   
339   Fatal("CreateIterator", "Incomplete switch on Sector direction");
340   return 0;  
341 }   
342   
343 //______________________________________________________________________________
344 AliMpVPadIterator* 
345 AliMpSectorSegmentation::CreateIterator(const AliMpPad& centerPad,
346                                         Bool_t includeCenter) const
347 {
348 /// Create the neighbours pad iterator.
349
350   return new AliMpNeighboursPadIterator(this, centerPad, includeCenter);
351 }   
352   
353 //______________________________________________________________________________
354 TVector2
355 AliMpSectorSegmentation::Dimensions() const
356 {
357   return GetSector()->Dimensions();
358 }
359
360 //______________________________________________________________________________
361 AliMp::PlaneType
362 AliMpSectorSegmentation::PlaneType() const
363 {
364   return GetSector()->GetPlaneType();
365 }
366
367 //______________________________________________________________________________
368 AliMpPad 
369 AliMpSectorSegmentation::PadByLocation(const AliMpIntPair& location, 
370                                        Bool_t warning) const
371 {
372 /// Find the pad which corresponds to the given location
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 //______________________________________________________________________________
398 AliMpPad 
399 AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices,
400                                       Bool_t warning ) const
401 {
402 /// Find the pad which corresponds to the given indices  
403
404   if ((*fPadBuffer).GetIndices()==indices) return (*fPadBuffer);    
405    
406   AliMpMotifPosition* motifPos = FindMotifPosition(indices);
407   if (!motifPos) {    
408     if (warning) 
409       Warning("PadByIndices","Pad indices not contained in any motif!");
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 //______________________________________________________________________________
435 AliMpPad 
436 AliMpSectorSegmentation::PadByPosition(const TVector2& position,
437                                        Bool_t warning) const
438 {
439 /// Find the pad which corresponds to the given position
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 //______________________________________________________________________________
475 AliMpPad 
476 AliMpSectorSegmentation::PadByDirection(const TVector2& startPosition, 
477                                         Double_t distance) const
478 {
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. 
483
484   switch (fkSector->GetDirection()) {
485   
486     case AliMp::kX: return PadByYDirection(startPosition, distance);
487              ;;
488     case AliMp::kY: return PadByXDirection(startPosition, distance);
489              ;;
490   }
491   
492   Fatal("PadByDirection", "Incomplete switch on Sector direction");
493   return AliMpPad::Invalid();  
494 }
495
496 //______________________________________________________________________________
497 Int_t  AliMpSectorSegmentation::MaxPadIndexX() const
498 {
499 /// Return maximum pad index in x
500
501   return fkSector->GetMaxPadIndices().GetFirst();
502 }
503
504 //______________________________________________________________________________
505 Int_t  AliMpSectorSegmentation::MaxPadIndexY() const
506 {
507 /// Return maximum pad index in y
508
509   return fkSector->GetMaxPadIndices().GetSecond();
510 }
511
512 //______________________________________________________________________________
513 Int_t  AliMpSectorSegmentation::NofPads() const
514 {
515 /// Return number of pads defined in the sector
516
517   return fkSector->GetNofPads();
518 }
519
520 //______________________________________________________________________________
521 Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const
522 {
523 /// Does the pad specified by \a indices exist ?
524
525   return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
526 }
527
528 //______________________________________________________________________________
529 Bool_t AliMpSectorSegmentation::HasMotifPosition(Int_t motifPositionID) const
530 {
531 /// Does the motif position specified by motifPositionID exist ?
532
533   return (fkSector->GetMotifMap()->FindMotifPosition(motifPositionID) != 0);
534 }
535
536 //______________________________________________________________________________
537 TVector2  AliMpSectorSegmentation::GetMinPadDimensions() const
538 {
539 /// Returne the dimensions of the smallest pad.
540
541   return fkSector->GetMinPadDimensions();
542 }  
543
544 //______________________________________________________________________________
545 Int_t AliMpSectorSegmentation::Zone(const AliMpPad& pad, Bool_t warning) const
546 {
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.
553
554   if (!pad.IsValid()) {
555     if (warning) Warning("Zone(AliMpPad)", "Invalid pad");
556     return 0;
557   }  
558
559 #ifdef WITH_STL
560   PadDimensionsMapCIterator it;
561   for (it = fPadDimensionsMap.begin(); it != fPadDimensionsMap.end(); ++it) {
562     if (AliMpConstants::IsEqual(it->second, pad.Dimensions()))
563       return it->first;
564   }
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;
574   } 
575   
576   AliError(Form("fPadDimensionsMap size is %d",fPadDimensionsMap.GetSize()));
577   
578 #endif
579
580   // Should never happen
581   AliErrorStream() 
582     << "Zone(AliMpPad pad) not found, where pad is: " << pad << endl;
583   return 0;
584 }  
585
586 //______________________________________________________________________________
587 TVector2 
588 AliMpSectorSegmentation::PadDimensions(Int_t zone, Bool_t warning) const
589 {
590 /// Return the pad dimensions for the zone with the specified zone index.
591
592 #ifdef WITH_STL
593   PadDimensionsMapCIterator it = fPadDimensionsMap.find(zone);
594   if (it != fPadDimensionsMap.end()) return it->second;
595 #endif
596
597 #ifdef WITH_ROOT
598   Long_t value = fPadDimensionsMap.GetValue(zone);
599   if (value) return GetVector(value);
600 #endif
601
602   if (warning) Warning("PadDimensions(zone)", "not found");
603   return TVector2();
604 }  
605
606 //______________________________________________________________________________
607 Bool_t AliMpSectorSegmentation::CircleTest(const AliMpIntPair& indices) const
608 {
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.
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 }
643
644 //______________________________________________________________________________
645 void
646 AliMpSectorSegmentation::Print(Option_t* opt) const
647 {
648   fkSector->Print(opt);
649 }
650
651 //______________________________________________________________________________
652 void AliMpSectorSegmentation::PrintZones() const
653 {
654 /// Print all zones and pads dimensions from the map.
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