G4GeomTestStreamLogger Class Reference

#include <G4GeomTestStreamLogger.hh>

Inheritance diagram for G4GeomTestStreamLogger:

G4GeomTestLogger

Public Member Functions

 G4GeomTestStreamLogger (std::ostream &o, G4int theMaxPointsPerError=20)
virtual ~G4GeomTestStreamLogger ()
virtual void SolidProblem (const G4VSolid *solid, const G4String &message, const G4ThreeVector &point)
virtual void OverlappingDaughters (const G4GeomTestOverlapList *list)
virtual void OvershootingDaughter (const G4GeomTestOvershootList *list)
virtual void NoProblem (const G4String &message)

Protected Member Functions

void PrintSegmentListHeader ()
void PrintSegmentListElement (const G4ThreeVector &s1, const G4ThreeVector &s2)
const char * IsAre (G4int n)

Protected Attributes

std::ostream & out
G4int maxPointsPerError

Friends

std::ostream & operator<< (std::ostream &, const G4GeomTestStreamLogger::PrintPos &)
std::ostream & operator<< (std::ostream &, const G4GeomTestStreamLogger::VolumeNameAndCopy &)

Data Structures

class  PrintPos
class  VolumeNameAndCopy

Detailed Description

Definition at line 48 of file G4GeomTestStreamLogger.hh.


Constructor & Destructor Documentation

G4GeomTestStreamLogger::G4GeomTestStreamLogger ( std::ostream &  o,
G4int  theMaxPointsPerError = 20 
)

Definition at line 49 of file G4GeomTestStreamLogger.cc.

00051   : out(o), maxPointsPerError(theMaxPointsPerError)
00052 {;}

G4GeomTestStreamLogger::~G4GeomTestStreamLogger (  )  [virtual]

Definition at line 54 of file G4GeomTestStreamLogger.cc.

00055 {;}


Member Function Documentation

const char * G4GeomTestStreamLogger::IsAre ( G4int  n  )  [protected]

Definition at line 285 of file G4GeomTestStreamLogger.cc.

Referenced by OverlappingDaughters(), and OvershootingDaughter().

00286 {
00287   const char *is = "is";
00288   const char *are = "are";
00289   
00290   return n > 1 ? are : is;
00291 }

void G4GeomTestStreamLogger::NoProblem ( const G4String message  )  [virtual]

Implements G4GeomTestLogger.

Definition at line 113 of file G4GeomTestStreamLogger.cc.

References out.

00114 {
00115   out << message << std::endl;
00116 }

void G4GeomTestStreamLogger::OverlappingDaughters ( const G4GeomTestOverlapList list  )  [virtual]

Implements G4GeomTestLogger.

Definition at line 123 of file G4GeomTestStreamLogger.cc.

References G4GeomTestOverlapList::GetDaught1Points(), G4GeomTestOverlapList::GetDaught2Points(), G4GeomTestOverlapList::GetDaughter1(), G4GeomTestOverlapList::GetDaughter2(), G4GeomTestErrorList::GetGlobalPoints(), G4GeomTestErrorList::GetMother(), G4GeomTestErrorList::GetMotherPoints(), IsAre(), maxPointsPerError, CLHEP::detail::n, G4GeomTestErrorList::NumError(), out, PrintSegmentListElement(), and PrintSegmentListHeader().

00124 {
00125   G4int n = list->NumError();
00126   if (n <= 0) return;
00127 
00128   out << "GeomTest Error: Overlapping daughter volumes\n"
00129    << "    The volumes " << VolumeNameAndCopy(list->GetDaughter1())
00130    << " and " << VolumeNameAndCopy(list->GetDaughter2()) << ",\n"
00131    << "    both daughters of volume " << VolumeNameAndCopy(list->GetMother())
00132    << ",\n"
00133    << "    appear to overlap at the following " << (n>1 ? "points" : "point")
00134    << " in global coordinates:";
00135 
00136   G4int nInterval, nStop;
00137 
00138   if (n <= maxPointsPerError) {
00139     out << "\n";
00140     nInterval = 1;
00141     nStop = n;
00142   }
00143   else {
00144     out << " (list truncated)\n";
00145     nInterval = n/maxPointsPerError;
00146     nStop = maxPointsPerError*nInterval;
00147   }
00148 
00149   G4int i;
00150   G4ThreeVector s1, s2;
00151   
00152   PrintSegmentListHeader();
00153   for(i=0;i<nStop;i+=nInterval) {
00154     list->GetGlobalPoints( i, s1, s2 );
00155     PrintSegmentListElement( s1, s2 );
00156   }
00157 
00158   out << "    Which in the mother coordinate system " << IsAre(n) << ":\n";
00159 
00160   PrintSegmentListHeader();
00161   for(i=0;i<nStop;i+=nInterval) {
00162     list->GetMotherPoints( i, s1, s2 );
00163     PrintSegmentListElement( s1, s2 );
00164   }
00165 
00166   out << "    Which in the coordinate system of " 
00167       << VolumeNameAndCopy(list->GetDaughter1()) << " " << IsAre(n) << ":\n";
00168 
00169   PrintSegmentListHeader();
00170   for(i=0;i<nStop;i+=nInterval) {
00171     list->GetDaught1Points( i, s1, s2 );
00172     PrintSegmentListElement( s1, s2 );
00173   }
00174 
00175   out << "    Which in the coordinate system of " 
00176       << VolumeNameAndCopy(list->GetDaughter2()) << " " << IsAre(n) << ":\n";
00177   
00178   PrintSegmentListHeader();
00179   for(i=0;i<nStop;i+=nInterval) {
00180     list->GetDaught2Points( i, s1, s2 );
00181     PrintSegmentListElement( s1, s2 );
00182   }
00183   
00184   out << std::endl;
00185 }

void G4GeomTestStreamLogger::OvershootingDaughter ( const G4GeomTestOvershootList list  )  [virtual]

Implements G4GeomTestLogger.

Definition at line 192 of file G4GeomTestStreamLogger.cc.

References G4GeomTestOvershootList::GetDaughter(), G4GeomTestOvershootList::GetDaughtPoints(), G4GeomTestErrorList::GetGlobalPoints(), G4GeomTestErrorList::GetMother(), G4GeomTestErrorList::GetMotherPoints(), IsAre(), maxPointsPerError, CLHEP::detail::n, G4GeomTestErrorList::NumError(), out, PrintSegmentListElement(), and PrintSegmentListHeader().

00193 {
00194   G4int n = list->NumError();
00195   if (n <= 0) return;
00196 
00197   out << "GeomTest Error: Overshooting daughter volume\n"
00198       << "    The volume " << VolumeNameAndCopy(list->GetDaughter())
00199       << " appears to extend outside the mother volume " 
00200       << VolumeNameAndCopy(list->GetMother()) << "\n"
00201       << "    at the following " << (n>1 ? "points" : "point")
00202       << " in global coordinates:";
00203 
00204 
00205   G4int nInterval, nStop;
00206 
00207   if (n <= maxPointsPerError) {
00208     out << "\n";
00209     nInterval = 1;
00210     nStop = n;
00211   }
00212   else {
00213     out << " (list truncated)\n";
00214     nInterval = n/maxPointsPerError;
00215     nStop = maxPointsPerError*nInterval;
00216   }
00217 
00218   G4int i;
00219   G4ThreeVector s1, s2;
00220   
00221   PrintSegmentListHeader();
00222   for(i=0;i<nStop;i+=nInterval) {
00223     list->GetGlobalPoints( i, s1, s2 );
00224     PrintSegmentListElement( s1, s2 );
00225   }
00226 
00227   out << "    Which in the mother coordinate system " << IsAre(n) << ":\n";
00228 
00229   PrintSegmentListHeader();
00230   for(i=0;i<nStop;i+=nInterval) {
00231     list->GetMotherPoints( i, s1, s2 );
00232     PrintSegmentListElement( s1, s2 );
00233   }
00234 
00235   out << "    Which in the coordinate system of " 
00236       << VolumeNameAndCopy(list->GetDaughter()) << " " << IsAre(n) << ":\n";
00237 
00238   PrintSegmentListHeader();
00239   for(i=0;i<nStop;i+=nInterval) {
00240     list->GetDaughtPoints( i, s1, s2 );
00241     PrintSegmentListElement( s1, s2 );
00242   }
00243   
00244   out << std::endl;
00245 }

void G4GeomTestStreamLogger::PrintSegmentListElement ( const G4ThreeVector s1,
const G4ThreeVector s2 
) [protected]

Definition at line 270 of file G4GeomTestStreamLogger.cc.

References out.

Referenced by OverlappingDaughters(), and OvershootingDaughter().

00272 {
00273   out << "    " << std::setprecision(6) << std::setw(14)
00274       << (s1-s2).mag()/cm
00275       << "    " << PrintPos(s1,false) << "   " << PrintPos(s2,false) << "\n";
00276 }

void G4GeomTestStreamLogger::PrintSegmentListHeader (  )  [protected]

Definition at line 254 of file G4GeomTestStreamLogger.cc.

References out.

Referenced by OverlappingDaughters(), and OvershootingDaughter().

00255 {
00256   static const char *header =
00257      "       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------\n";
00258   //      .............|    .............|.............|.............|   .............|.............|.............|
00259   //  1234              1234                                          123
00260 
00261   out << header;
00262 }

void G4GeomTestStreamLogger::SolidProblem ( const G4VSolid solid,
const G4String message,
const G4ThreeVector point 
) [virtual]

Implements G4GeomTestLogger.

Definition at line 99 of file G4GeomTestStreamLogger.cc.

References G4VSolid::GetName(), and out.

00102 {
00103   out << "GeomTest Error: SolidProblem\n"
00104       << "    " << message << "\n"
00105       << "    Solid name = " << solid->GetName() << "\n"
00106       << "    Local position = " << PrintPos(point) << std::endl;
00107 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const G4GeomTestStreamLogger::VolumeNameAndCopy p 
) [friend]

Definition at line 88 of file G4GeomTestStreamLogger.cc.

00090 {
00091   p.Print(o);
00092   return o;
00093 }

std::ostream& operator<< ( std::ostream &  o,
const G4GeomTestStreamLogger::PrintPos p 
) [friend]

Definition at line 70 of file G4GeomTestStreamLogger.cc.

00072 {
00073   p.Print(o);
00074   return o;
00075 }


Field Documentation

G4int G4GeomTestStreamLogger::maxPointsPerError [protected]

Definition at line 108 of file G4GeomTestStreamLogger.hh.

Referenced by OverlappingDaughters(), and OvershootingDaughter().

std::ostream& G4GeomTestStreamLogger::out [protected]

Definition at line 107 of file G4GeomTestStreamLogger.hh.

Referenced by NoProblem(), OverlappingDaughters(), OvershootingDaughter(), PrintSegmentListElement(), PrintSegmentListHeader(), and SolidProblem().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:05 2013 for Geant4 by  doxygen 1.4.7