Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeomTestStreamLogger Class Reference

#include <G4GeomTestStreamLogger.hh>

+ Inheritance diagram for G4GeomTestStreamLogger:

Classes

class  PrintPos
 
class  VolumeNameAndCopy
 

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)
 
- Public Member Functions inherited from G4GeomTestLogger
 G4GeomTestLogger ()
 
virtual ~G4GeomTestLogger ()
 
virtual void SolidProblem (const G4VSolid *solid, const G4String &message, const G4ThreeVector &point)=0
 
virtual void NoProblem (const G4String &message)=0
 
virtual void OverlappingDaughters (const G4GeomTestOverlapList *)=0
 
virtual void OvershootingDaughter (const G4GeomTestOvershootList *)=0
 

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 &)
 

Detailed Description

Definition at line 48 of file G4GeomTestStreamLogger.hh.

Constructor & Destructor Documentation

◆ G4GeomTestStreamLogger()

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

Definition at line 49 of file G4GeomTestStreamLogger.cc.

51 : out(o), maxPointsPerError(theMaxPointsPerError)
52{;}

◆ ~G4GeomTestStreamLogger()

G4GeomTestStreamLogger::~G4GeomTestStreamLogger ( )
virtual

Definition at line 54 of file G4GeomTestStreamLogger.cc.

55{;}

Member Function Documentation

◆ IsAre()

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

Definition at line 285 of file G4GeomTestStreamLogger.cc.

286{
287 const char *is = "is";
288 const char *are = "are";
289
290 return n > 1 ? are : is;
291}

Referenced by OverlappingDaughters(), and OvershootingDaughter().

◆ NoProblem()

void G4GeomTestStreamLogger::NoProblem ( const G4String message)
virtual

Implements G4GeomTestLogger.

Definition at line 113 of file G4GeomTestStreamLogger.cc.

114{
115 out << message << std::endl;
116}

◆ OverlappingDaughters()

void G4GeomTestStreamLogger::OverlappingDaughters ( const G4GeomTestOverlapList list)
virtual

Implements G4GeomTestLogger.

Definition at line 123 of file G4GeomTestStreamLogger.cc.

124{
125 G4int n = list->NumError();
126 if (n <= 0) return;
127
128 out << "GeomTest Error: Overlapping daughter volumes\n"
129 << " The volumes " << VolumeNameAndCopy(list->GetDaughter1())
130 << " and " << VolumeNameAndCopy(list->GetDaughter2()) << ",\n"
131 << " both daughters of volume " << VolumeNameAndCopy(list->GetMother())
132 << ",\n"
133 << " appear to overlap at the following " << (n>1 ? "points" : "point")
134 << " in global coordinates:";
135
136 G4int nInterval, nStop;
137
138 if (n <= maxPointsPerError) {
139 out << "\n";
140 nInterval = 1;
141 nStop = n;
142 }
143 else {
144 out << " (list truncated)\n";
145 nInterval = n/maxPointsPerError;
146 nStop = maxPointsPerError*nInterval;
147 }
148
149 G4int i;
150 G4ThreeVector s1, s2;
151
153 for(i=0;i<nStop;i+=nInterval) {
154 list->GetGlobalPoints( i, s1, s2 );
155 PrintSegmentListElement( s1, s2 );
156 }
157
158 out << " Which in the mother coordinate system " << IsAre(n) << ":\n";
159
161 for(i=0;i<nStop;i+=nInterval) {
162 list->GetMotherPoints( i, s1, s2 );
163 PrintSegmentListElement( s1, s2 );
164 }
165
166 out << " Which in the coordinate system of "
167 << VolumeNameAndCopy(list->GetDaughter1()) << " " << IsAre(n) << ":\n";
168
170 for(i=0;i<nStop;i+=nInterval) {
171 list->GetDaught1Points( i, s1, s2 );
172 PrintSegmentListElement( s1, s2 );
173 }
174
175 out << " Which in the coordinate system of "
176 << VolumeNameAndCopy(list->GetDaughter2()) << " " << IsAre(n) << ":\n";
177
179 for(i=0;i<nStop;i+=nInterval) {
180 list->GetDaught2Points( i, s1, s2 );
181 PrintSegmentListElement( s1, s2 );
182 }
183
184 out << std::endl;
185}
int G4int
Definition: G4Types.hh:66
const G4VPhysicalVolume * GetMother() const
void GetGlobalPoints(G4int i, G4ThreeVector &s1, G4ThreeVector &s2) const
void GetMotherPoints(G4int i, G4ThreeVector &s1, G4ThreeVector &s2) const
void GetDaught2Points(G4int, G4ThreeVector &, G4ThreeVector &) const
void GetDaught1Points(G4int, G4ThreeVector &, G4ThreeVector &) const
const G4VPhysicalVolume * GetDaughter1() const
const G4VPhysicalVolume * GetDaughter2() const
void PrintSegmentListElement(const G4ThreeVector &s1, const G4ThreeVector &s2)
const char * IsAre(G4int n)

◆ OvershootingDaughter()

void G4GeomTestStreamLogger::OvershootingDaughter ( const G4GeomTestOvershootList list)
virtual

Implements G4GeomTestLogger.

Definition at line 191 of file G4GeomTestStreamLogger.cc.

193{
194 G4int n = list->NumError();
195 if (n <= 0) return;
196
197 out << "GeomTest Error: Overshooting daughter volume\n"
198 << " The volume " << VolumeNameAndCopy(list->GetDaughter())
199 << " appears to extend outside the mother volume "
200 << VolumeNameAndCopy(list->GetMother()) << "\n"
201 << " at the following " << (n>1 ? "points" : "point")
202 << " in global coordinates:";
203
204
205 G4int nInterval, nStop;
206
207 if (n <= maxPointsPerError) {
208 out << "\n";
209 nInterval = 1;
210 nStop = n;
211 }
212 else {
213 out << " (list truncated)\n";
214 nInterval = n/maxPointsPerError;
215 nStop = maxPointsPerError*nInterval;
216 }
217
218 G4int i;
219 G4ThreeVector s1, s2;
220
222 for(i=0;i<nStop;i+=nInterval) {
223 list->GetGlobalPoints( i, s1, s2 );
224 PrintSegmentListElement( s1, s2 );
225 }
226
227 out << " Which in the mother coordinate system " << IsAre(n) << ":\n";
228
230 for(i=0;i<nStop;i+=nInterval) {
231 list->GetMotherPoints( i, s1, s2 );
232 PrintSegmentListElement( s1, s2 );
233 }
234
235 out << " Which in the coordinate system of "
236 << VolumeNameAndCopy(list->GetDaughter()) << " " << IsAre(n) << ":\n";
237
239 for(i=0;i<nStop;i+=nInterval) {
240 list->GetDaughtPoints( i, s1, s2 );
241 PrintSegmentListElement( s1, s2 );
242 }
243
244 out << std::endl;
245}
const G4VPhysicalVolume * GetDaughter() const
void GetDaughtPoints(G4int i, G4ThreeVector &s1, G4ThreeVector &s2) const

◆ PrintSegmentListElement()

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

Definition at line 270 of file G4GeomTestStreamLogger.cc.

272{
273 out << " " << std::setprecision(6) << std::setw(14)
274 << (s1-s2).mag()/cm
275 << " " << PrintPos(s1,false) << " " << PrintPos(s2,false) << "\n";
276}

Referenced by OverlappingDaughters(), and OvershootingDaughter().

◆ PrintSegmentListHeader()

void G4GeomTestStreamLogger::PrintSegmentListHeader ( )
protected

Definition at line 254 of file G4GeomTestStreamLogger.cc.

255{
256 static const char *header =
257 " length (cm) ---------- start position (cm) ----------- ----------- end position (cm) ------------\n";
258 // .............| .............|.............|.............| .............|.............|.............|
259 // 1234 1234 123
260
261 out << header;
262}

Referenced by OverlappingDaughters(), and OvershootingDaughter().

◆ SolidProblem()

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

Implements G4GeomTestLogger.

Definition at line 99 of file G4GeomTestStreamLogger.cc.

102{
103 out << "GeomTest Error: SolidProblem\n"
104 << " " << message << "\n"
105 << " Solid name = " << solid->GetName() << "\n"
106 << " Local position = " << PrintPos(point) << std::endl;
107}
G4String GetName() const

Friends And Related Function Documentation

◆ operator<< [1/2]

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

Definition at line 70 of file G4GeomTestStreamLogger.cc.

72{
73 p.Print(o);
74 return o;
75}

◆ operator<< [2/2]

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

Definition at line 88 of file G4GeomTestStreamLogger.cc.

90{
91 p.Print(o);
92 return o;
93}

Member Data Documentation

◆ maxPointsPerError

G4int G4GeomTestStreamLogger::maxPointsPerError
protected

Definition at line 108 of file G4GeomTestStreamLogger.hh.

Referenced by OverlappingDaughters(), and OvershootingDaughter().

◆ out

std::ostream& G4GeomTestStreamLogger::out
protected

The documentation for this class was generated from the following files: