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

#include <G4tgrSolidMultiUnion.hh>

+ Inheritance diagram for G4tgrSolidMultiUnion:

Public Member Functions

 G4tgrSolidMultiUnion (const std::vector< G4String > &wl)
 
 ~G4tgrSolidMultiUnion ()
 
const G4tgrSolidGetSolid (G4int ii) const
 
const G4Transform3D GetTransformation (G4int ii) const
 
G4int GetNSolid () const
 
- Public Member Functions inherited from G4tgrSolid
 G4tgrSolid ()
 
 G4tgrSolid (const std::vector< G4String > &wl)
 
virtual ~G4tgrSolid ()
 
const G4StringGetName () const
 
const G4StringGetType () const
 
const std::vector< std::vector< G4double > * > GetSolidParams () const
 
virtual const G4StringGetRelativeRotMatName () const
 
virtual G4ThreeVector GetRelativePlace () const
 

Friends

std::ostream & operator<< (std::ostream &os, const G4tgrSolidMultiUnion &sol)
 

Additional Inherited Members

- Protected Attributes inherited from G4tgrSolid
G4String theName
 
G4String theType
 
std::vector< std::vector< G4double > * > theSolidParams
 

Detailed Description

Definition at line 46 of file G4tgrSolidMultiUnion.hh.

Constructor & Destructor Documentation

◆ G4tgrSolidMultiUnion()

G4tgrSolidMultiUnion::G4tgrSolidMultiUnion ( const std::vector< G4String > & wl)

Definition at line 39 of file G4tgrSolidMultiUnion.cc.

40{
41 // :SOLID/:VOLU SOL MULTIUNION NSOL SOL1 ROTM1 POSX1 POSY1 POSZ1
42 // SOL2 ROTM2 POSX2 POSY2 POSZ2 ...
43
44 //---------- Set name
46 nSolid = G4tgrUtils::GetInt(wl[3]);
48 const G4tgrSolid* sol1;
49
50 if(G4int(wl.size()) != 4 + 5*nSolid)
51 {
52 G4String Err1 = "Solid type MULTIUNION with ";
53 G4String Err2 = std::to_string(nSolid);
54 G4String Err3 = " Solids, should have ";
55 G4String Err4 = std::to_string(4 + 5*nSolid);
56 G4String Err5 = " parameters.";
57 G4String Err6 = " It has "+G4UIcommand::ConvertToString(int(wl.size()));
58
59 G4String ErrMessage = Err1 + Err2 + Err3 + Err4 + Err5 + Err6;
60
61 G4tgrUtils::DumpVS(wl, "G4tgrSolidMultiUnion::G4tgrSolidMultiUnion()");
62 G4Exception("G4tgrSolidMultiUnion::G4tgrSolidMultiUnion()", "InvalidInput",
63 FatalException, ErrMessage);
64 }
65
66 for (G4int i = 4; i< nSolid*5; i+=5)
67 {
68 sol1 = volmgr->FindSolid(G4tgrUtils::GetString(wl[i]));
69 if(sol1 == nullptr)
70 {
71 sol1 = volmgr->FindVolume(G4tgrUtils::GetString(wl[i]), 1)->GetSolid();
72 }
73 theSolids.push_back(sol1);
74
75 //---------- Populate transformation matrix
76 theRotMatName = G4tgrUtils::GetString(wl[i + 1]);
77 theRotMat =
79 thePosition =
81 G4tgrUtils::GetDouble(wl[i+3]),
82 G4tgrUtils::GetDouble(wl[i+4]));
83 tr1 = G4Transform3D(*theRotMat, thePosition);
84 theTransformations.push_back(tr1);
85 }
86
87 // ---------- Set solid type
88 G4String wl2 = wl[2];
89 for(G4int ii = 0; ii < (G4int)wl2.length(); ++ii)
90 {
91 wl2[ii] = (char)std::toupper(wl2[ii]);
92 }
93 theType = wl2;
94
95#ifdef G4VERBOSE
97 {
98 G4cout << " Created " << *this << G4endl;
99 }
100#endif
101
103}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Transform3D G4Transform3D
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4String ConvertToString(G4bool boolVal)
static G4tgbRotationMatrixMgr * GetInstance()
G4RotationMatrix * FindOrBuildG4RotMatrix(const G4String &name)
static G4int GetVerboseLevel()
G4String theType
Definition G4tgrSolid.hh:68
G4String theName
Definition G4tgrSolid.hh:66
static G4String GetString(const G4String &str)
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
static G4int GetInt(const G4String &str)
static G4double GetDouble(const G4String &str, G4double unitval=1.)
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
void RegisterMe(G4tgrSolid *vol)
static G4tgrVolumeMgr * GetInstance()
G4tgrSolid * GetSolid() const

◆ ~G4tgrSolidMultiUnion()

G4tgrSolidMultiUnion::~G4tgrSolidMultiUnion ( )

Definition at line 106 of file G4tgrSolidMultiUnion.cc.

107{
108}

Member Function Documentation

◆ GetNSolid()

G4int G4tgrSolidMultiUnion::GetNSolid ( ) const
inline

Definition at line 58 of file G4tgrSolidMultiUnion.hh.

58{ return nSolid; };

Referenced by G4tgbVolume::FindOrConstructG4Solid().

◆ GetSolid()

const G4tgrSolid * G4tgrSolidMultiUnion::GetSolid ( G4int ii) const
inline

Definition at line 77 of file G4tgrSolidMultiUnion.hh.

78{
79 if(ii > nSolid)
80 {
81 std::ostringstream message;
82 message << "Only " << nSolid + 1 << " G4tgrSolids are available! " <<
83 " Asking for... " << ii + 1;
84 G4Exception("G4tgrSolidMultiUnion::GetSolid()", "InvalidInput", FatalException,
85 message);
86 }
87 return theSolids[ii];
88}

Referenced by G4tgbVolume::FindOrConstructG4Solid().

◆ GetTransformation()

const G4Transform3D G4tgrSolidMultiUnion::GetTransformation ( G4int ii) const
inline

Definition at line 90 of file G4tgrSolidMultiUnion.hh.

91{
92 if(ii > nSolid)
93 {
94 std::ostringstream message;
95 message << "Only " << nSolid + 1 << " G4tgrSolids are available! " <<
96 " Asking for... " << ii + 1;
97 G4Exception("G4tgrSolidMultiUnion::GetSolid()", "InvalidInput", FatalException,
98 message);
99 }
100 return theTransformations[ii];
101}

Referenced by G4tgbVolume::FindOrConstructG4Solid().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4tgrSolidMultiUnion & sol )
friend

Definition at line 111 of file G4tgrSolidMultiUnion.cc.

112{
113 os << "G4tgrSolidMultiUnion= " << sol.theName << " of type " << sol.theType
114 << " PARAMS: ";
115 if(sol.theSolidParams.size() != 0)
116 {
117 std::vector<G4double> solpar = *(sol.theSolidParams[0]);
118 for(std::size_t ii = 0; ii < solpar.size(); ++ii)
119 {
120 os << solpar[ii] << " ";
121 }
122 }
123 os << G4endl;
124
125 return os;
126}

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