Geant4-11
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
G4tgrSolidBoolean Class Reference

#include <G4tgrSolidBoolean.hh>

Inheritance diagram for G4tgrSolidBoolean:
G4tgrSolid

Public Member Functions

 G4tgrSolidBoolean (const std::vector< G4String > &wl)
 
const G4StringGetName () const
 
G4ThreeVector GetRelativePlace () const
 
const G4StringGetRelativeRotMatName () const
 
const G4tgrSolidGetSolid (G4int ii) const
 
const std::vector< std::vector< G4double > * > GetSolidParams () const
 
const G4StringGetType () const
 
 ~G4tgrSolidBoolean ()
 

Protected Attributes

G4String theName
 
G4String theType
 

Private Member Functions

void FillSolidParams (const std::vector< G4String > &wl)
 

Private Attributes

G4ThreeVector theRelativePlace
 
G4String theRelativeRotMatName
 
std::vector< std::vector< G4double > * > theSolidParams
 
std::vector< const G4tgrSolid * > theSolids
 

Friends

std::ostream & operator<< (std::ostream &, const G4tgrSolidBoolean &)
 

Detailed Description

Definition at line 44 of file G4tgrSolidBoolean.hh.

Constructor & Destructor Documentation

◆ G4tgrSolidBoolean()

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

Definition at line 39 of file G4tgrSolidBoolean.cc.

40{
41 // :SOLID/:VOLU VOLU UNION/SUBS/INTERS VOLU1 VOLU2 ROTM POSX POSY POSZ
42
43 if(wl.size() != 9)
44 {
45 G4tgrUtils::DumpVS(wl, "G4tgrSolidBoolean::G4tgrSolidBoolean()");
46 G4Exception("G4tgrSolidBoolean::G4tgrSolidBoolean()", "InvalidInput",
47 FatalException, "Line read with less or more than 9 words.");
48 }
49
50 //---------- Set name
52
54 const G4tgrSolid* sol1 = volmgr->FindSolid(G4tgrUtils::GetString(wl[3]));
55 if(sol1 == nullptr)
56 {
57 sol1 = volmgr->FindVolume(G4tgrUtils::GetString(wl[3]), 1)->GetSolid();
58 }
59 const G4tgrSolid* sol2 = volmgr->FindSolid(G4tgrUtils::GetString(wl[4]));
60 if(sol2 == nullptr)
61 {
62 sol2 = volmgr->FindVolume(G4tgrUtils::GetString(wl[4]), 1)->GetSolid();
63 }
64 theSolids.push_back(sol1);
65 theSolids.push_back(sol2);
66
67 //---------- Set relative placement and rotation matrix
72 //---------- Set solid type
73 G4String wl2 = wl[2];
74 for(std::size_t ii = 0; ii < wl2.length(); ++ii)
75 {
76 wl2[ii] = toupper(wl2[ii]);
77 }
78 theType = "Boolean_" + wl2;
79
80#ifdef G4VERBOSE
82 {
83 G4cout << " Created " << *this << G4endl;
84 }
85#endif
86
88}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
CLHEP::Hep3Vector G4ThreeVector
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
std::vector< const G4tgrSolid * > theSolids
G4ThreeVector theRelativePlace
G4String theRelativeRotMatName
G4String theType
Definition: G4tgrSolid.hh:68
G4String theName
Definition: G4tgrSolid.hh:66
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:173
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
Definition: G4tgrUtils.cc:153
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:198
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
Definition: G4tgrVolume.hh:86

References G4tgrUtils::DumpVS(), FatalException, G4tgrVolumeMgr::FindSolid(), G4tgrVolumeMgr::FindVolume(), G4cout, G4endl, G4Exception(), G4tgrUtils::GetDouble(), G4tgrVolumeMgr::GetInstance(), G4tgrVolume::GetSolid(), G4tgrUtils::GetString(), G4tgrMessenger::GetVerboseLevel(), G4tgrVolumeMgr::RegisterMe(), G4tgrSolid::theName, theRelativePlace, theRelativeRotMatName, theSolids, and G4tgrSolid::theType.

◆ ~G4tgrSolidBoolean()

G4tgrSolidBoolean::~G4tgrSolidBoolean ( )

Definition at line 91 of file G4tgrSolidBoolean.cc.

92{
93}

Member Function Documentation

◆ FillSolidParams()

void G4tgrSolid::FillSolidParams ( const std::vector< G4String > &  wl)
privateinherited

Definition at line 92 of file G4tgrSolid.cc.

93{
94 //---- Setting which are angle parameters (for dimensions...)
95 std::map<G4String, std::set<G4int>> angleParams;
96 std::set<G4int> apar;
97 apar.clear();
98 apar.insert(3);
99 apar.insert(4);
100 angleParams["TUBS"] = apar;
101 apar.clear();
102 apar.insert(5);
103 apar.insert(6);
104 angleParams["CONS"] = apar;
105 apar.clear();
106 apar.insert(3);
107 apar.insert(4);
108 apar.insert(5);
109 angleParams["PARA"] = apar;
110 apar.clear();
111 apar.insert(1);
112 apar.insert(2);
113 apar.insert(6);
114 apar.insert(10);
115 angleParams["TRAP"] = apar;
116 apar.clear();
117 apar.insert(2);
118 apar.insert(3);
119 apar.insert(4);
120 apar.insert(5);
121 angleParams["SPHERE"] = apar;
122 apar.clear();
123 apar.insert(3);
124 apar.insert(4);
125 angleParams["TORUS"] = apar;
126 apar.clear();
127 apar.insert(0);
128 apar.insert(1);
129 angleParams["POLYCONE"] = apar;
130 apar.clear();
131 apar.insert(0);
132 apar.insert(1);
133 angleParams["POLYHEDRA"] = apar;
134 apar.clear();
135 apar.insert(2);
136 apar.insert(3);
137 angleParams["HYPE"] = apar;
138 apar.clear();
139 apar.insert(0);
140 angleParams["TWISTED_BOX"] = apar;
141 apar.clear();
142 apar.insert(0);
143 apar.insert(2);
144 apar.insert(3);
145 apar.insert(10);
146 angleParams["TWISTED_TRAP"] = apar;
147 apar.clear();
148 apar.insert(5);
149 angleParams["TWISTED_TRD"] = apar;
150 apar.clear();
151 apar.insert(0);
152 apar.insert(4);
153 angleParams["TWISTED_TUBS"] = apar;
154
155 std::vector<G4double>* vd = new std::vector<G4double>;
156 theSolidParams.push_back(vd);
157 std::size_t noParRead = wl.size() - 3;
158
159 G4String solidType = wl[2];
160 //--- Default unit (mm) if length, deg if angle
161 for(std::size_t ii = 0; ii < noParRead; ++ii)
162 {
163 G4bool isAngle = 0;
164 std::map<G4String, std::set<G4int>>::const_iterator ite =
165 angleParams.find(solidType);
166 if(ite != angleParams.cend())
167 {
168 std::set<G4int> apar2 = (*ite).second;
169 if(apar2.find(ii) != apar2.cend())
170 {
171 isAngle = 1;
172 vd->push_back(G4tgrUtils::GetDouble(wl[3 + ii], deg));
173#ifdef G4VERBOSE
175 {
176 G4cout << " G4tgrSolid::FillSolidParams() - Angle param found "
177 << solidType << " " << ii << G4endl;
178 }
179#endif
180 }
181 }
182 if(!isAngle)
183 {
184 vd->push_back(G4tgrUtils::GetDouble(wl[3 + ii]));
185 }
186 }
187}
static constexpr double deg
Definition: G4SIunits.hh:132
bool G4bool
Definition: G4Types.hh:86
std::vector< std::vector< G4double > * > theSolidParams
Definition: G4tgrSolid.hh:70

References deg, G4cout, G4endl, G4tgrUtils::GetDouble(), G4tgrMessenger::GetVerboseLevel(), and G4tgrSolid::theSolidParams.

Referenced by G4tgrSolid::G4tgrSolid().

◆ GetName()

const G4String & G4tgrSolid::GetName ( ) const
inlineinherited

◆ GetRelativePlace()

G4ThreeVector G4tgrSolidBoolean::GetRelativePlace ( ) const
virtual

Reimplemented from G4tgrSolid.

Definition at line 102 of file G4tgrSolidBoolean.cc.

103{
104 return theRelativePlace;
105}

References theRelativePlace.

Referenced by G4tgbVolume::FindOrConstructG4Solid().

◆ GetRelativeRotMatName()

const G4String & G4tgrSolidBoolean::GetRelativeRotMatName ( ) const
virtual

Reimplemented from G4tgrSolid.

Definition at line 96 of file G4tgrSolidBoolean.cc.

97{
99}

References theRelativeRotMatName.

◆ GetSolid()

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

Definition at line 74 of file G4tgrSolidBoolean.hh.

75{
76 if((ii != 0) && (ii != 1))
77 {
78 std::ostringstream message;
79 message << "Only two G4tgrSolids (0,1) possible ! Asking for... " << ii;
80 G4Exception("G4tgrSolidBoolean::GetSolid()", "InvalidInput", FatalException,
81 message);
82 }
83 return theSolids[ii];
84}

References FatalException, G4Exception(), and theSolids.

Referenced by G4tgbVolume::FindOrConstructG4Solid().

◆ GetSolidParams()

const std::vector< std::vector< G4double > * > G4tgrSolid::GetSolidParams ( ) const
inherited

Definition at line 74 of file G4tgrSolid.cc.

75{
76 return theSolidParams;
77}

References G4tgrSolid::theSolidParams.

Referenced by G4tgbVolume::FindOrConstructG4Solid().

◆ GetType()

const G4String & G4tgrSolid::GetType ( ) const
inlineinherited

Definition at line 55 of file G4tgrSolid.hh.

55{ return theType; }

References G4tgrSolid::theType.

Referenced by G4tgbVolume::FindOrConstructG4Solid().

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 108 of file G4tgrSolidBoolean.cc.

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

Field Documentation

◆ theName

G4String G4tgrSolid::theName
protectedinherited

◆ theRelativePlace

G4ThreeVector G4tgrSolidBoolean::theRelativePlace
private

Definition at line 67 of file G4tgrSolidBoolean.hh.

Referenced by G4tgrSolidBoolean(), and GetRelativePlace().

◆ theRelativeRotMatName

G4String G4tgrSolidBoolean::theRelativeRotMatName
private

Definition at line 66 of file G4tgrSolidBoolean.hh.

Referenced by G4tgrSolidBoolean(), and GetRelativeRotMatName().

◆ theSolidParams

std::vector<std::vector<G4double>*> G4tgrSolidBoolean::theSolidParams
private

Definition at line 63 of file G4tgrSolidBoolean.hh.

◆ theSolids

std::vector<const G4tgrSolid*> G4tgrSolidBoolean::theSolids
private

Definition at line 70 of file G4tgrSolidBoolean.hh.

Referenced by G4tgrSolidBoolean(), and GetSolid().

◆ theType

G4String G4tgrSolid::theType
protectedinherited

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