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

#include <G4tgrVolume.hh>

+ Inheritance diagram for G4tgrVolume:

Public Member Functions

 G4tgrVolume ()
 
 G4tgrVolume (const std::vector< G4String > &wl)
 
 G4tgrVolume (const G4tgrVolume &vol)
 
virtual ~G4tgrVolume ()
 
virtual G4tgrPlaceAddPlace (const std::vector< G4String > &wl)
 
G4tgrPlaceDivRepAddPlaceReplica (const std::vector< G4String > &wl)
 
G4tgrPlaceParameterisationAddPlaceParam (const std::vector< G4String > &wl)
 
void AddVisibility (const std::vector< G4String > &wl)
 
void AddRGBColour (const std::vector< G4String > &wl)
 
void AddCheckOverlaps (const std::vector< G4String > &wl)
 
const G4StringGetName () const
 
void SetName (const G4String &name)
 
const G4StringGetType () const
 
G4tgrSolidGetSolid () const
 
const G4StringGetMaterialName () const
 
const std::vector< G4tgrPlace * > GetPlacements () const
 
G4bool GetVisibility () const
 
G4doubleGetColour () const
 
G4doubleGetRGBColour () const
 
G4bool GetCheckOverlaps () const
 
virtual G4tgrVolumeGetVolume (G4int ii) const
 

Protected Attributes

G4String theName
 
G4String theType
 
G4String theMaterialName
 
G4tgrSolidtheSolid
 
std::vector< G4tgrPlace * > thePlacements
 
G4bool theVisibility
 
G4doubletheRGBColour
 
G4bool theCheckOverlaps
 

Friends

std::ostream & operator<< (std::ostream &os, const G4tgrVolume &obj)
 

Detailed Description

Definition at line 60 of file G4tgrVolume.hh.

Constructor & Destructor Documentation

◆ G4tgrVolume() [1/3]

G4tgrVolume::G4tgrVolume ( )

Definition at line 49 of file G4tgrVolume.cc.

50 : theName(""), theType(""),
53{
54}
G4String theMaterialName
Definition: G4tgrVolume.hh:112
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
G4String theType
Definition: G4tgrVolume.hh:110
G4String theName
Definition: G4tgrVolume.hh:108
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:114
G4bool theVisibility
Definition: G4tgrVolume.hh:119
G4double * theRGBColour
Definition: G4tgrVolume.hh:120

◆ G4tgrVolume() [2/3]

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

Definition at line 65 of file G4tgrVolume.cc.

66{
67 theType = "VOLSimple";
68
69 //---------- set name
71
72 theVisibility = 1;
73 theRGBColour = new G4double[4];
74 for(size_t ii=0; ii<4; ii++) { theRGBColour[ii] = -1.; }
76
77 if( wl.size() != 4 )
78 {
79 //:VOLU tag to build a volume creating solid and material
80 //---------- set material name
81 theMaterialName = G4tgrUtils::GetString( wl[wl.size()-1] );
82
83 //---------- create only vector<double> of theSolidParams
85
86#ifdef G4VERBOSE
88 {
89 G4cout << "Created from new solid: "
90 << *this << G4endl;
91 }
92#endif
93 }
94 else
95 {
96 //:VOLU tag to build a volume assigning material to solid
97 //---------- set material name
100
101#ifdef G4VERBOSE
103 {
104 G4cout << "Created from existing solid: "
105 << *this << G4endl;
106 }
107#endif
108 }
109}
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4int GetVerboseLevel()
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:178
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
static G4tgrVolumeMgr * GetInstance()

◆ G4tgrVolume() [3/3]

G4tgrVolume::G4tgrVolume ( const G4tgrVolume vol)

Definition at line 113 of file G4tgrVolume.cc.

114{
115 theName = vol.GetName();
116 theType = vol.GetType();
118 theSolid = vol.GetSolid();
123}
G4bool GetVisibility() const
Definition: G4tgrVolume.hh:96
G4bool GetCheckOverlaps() const
Definition: G4tgrVolume.hh:100
const G4String & GetName() const
Definition: G4tgrVolume.hh:89
G4double * GetRGBColour() const
Definition: G4tgrVolume.hh:98
G4tgrSolid * GetSolid() const
Definition: G4tgrVolume.hh:92
const G4String & GetType() const
Definition: G4tgrVolume.hh:91
const G4String & GetMaterialName() const
Definition: G4tgrVolume.hh:93
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
const std::vector< G4tgrPlace * > GetPlacements() const
Definition: G4tgrVolume.hh:95

◆ ~G4tgrVolume()

G4tgrVolume::~G4tgrVolume ( )
virtual

Definition at line 58 of file G4tgrVolume.cc.

59{
60 delete [] theRGBColour;
61}

Member Function Documentation

◆ AddCheckOverlaps()

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

------— Set check overlaps

Definition at line 271 of file G4tgrVolume.cc.

272{
273 //---------- Check for exact number of words read
274 G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_GE, " G4tgrVolume::AddCheckOverlaps");
275
276 ///--------- Set check overlaps
278
279}
@ WLSIZE_GE
Definition: G4tgrUtils.hh:52
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:472
static G4bool GetBool(const G4String &str)
Definition: G4tgrUtils.cc:445

◆ AddPlace()

G4tgrPlace * G4tgrVolume::AddPlace ( const std::vector< G4String > &  wl)
virtual

Reimplemented in G4tgrVolumeAssembly.

Definition at line 138 of file G4tgrVolume.cc.

139{
140 //---------- Check for exact number of words read
141 G4tgrUtils::CheckWLsize( wl, 8, WLSIZE_EQ, " G4tgrVolume::AddPlace");
142 //---------- set G4tgrPlace
143 G4tgrPlaceSimple* pl = new G4tgrPlaceSimple( wl );
144 //---------- check that there is no previous placement in
145 // the same parent with the same copyNo
146 std::vector<G4tgrPlace*>::iterator ite;
147 for( ite = thePlacements.begin(); ite != thePlacements.end(); ite++)
148 {
149 if( ((*ite)->GetCopyNo() == pl->GetCopyNo())
150 && ((*ite)->GetParentName() == pl->GetParentName()) )
151 {
152 G4String ErrMessage = "Repeated placement. Volume "
153 + theName + " in " + pl->GetParentName();
154 G4Exception("G4tgrVolume::AddPlace()", "InvalidArgument",
155 FatalErrorInArgument, ErrMessage);
156 }
157 }
158
159 pl->SetVolume( this );
160 thePlacements.push_back( pl );
161
162#ifdef G4VERBOSE
164 {
165 G4cout << " G4tgrVolume: New placement: " << thePlacements.size()
166 << " added for Volume " << theName
167 << " inside " << pl->GetParentName()
168 << " type " << pl->GetType() << G4endl;
169 }
170#endif
171 //---------- register parent - child
173
174 return pl;
175}
@ FatalErrorInArgument
@ WLSIZE_EQ
Definition: G4tgrUtils.hh:52
const G4String & GetParentName() const
Definition: G4tgrPlace.hh:58
const G4String & GetType() const
Definition: G4tgrPlace.hh:61
unsigned int GetCopyNo() const
Definition: G4tgrPlace.hh:60
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:62
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddPlaceParam()

G4tgrPlaceParameterisation * G4tgrVolume::AddPlaceParam ( const std::vector< G4String > &  wl)

Definition at line 218 of file G4tgrVolume.cc.

219{
220 //---------- set G4tgrPlaceParameterisation
222
223 pl->SetVolume( this );
224 thePlacements.push_back( pl );
225
226#ifdef G4VERBOSE
228 {
229 G4cout << " G4tgrVolume: New placement Param: " << thePlacements.size()
230 << " added for Volume " << theName
231 << " inside " << pl->GetParentName() << G4endl;
232 }
233#endif
234 //---------- register parent - child
236
237 return pl;
238}

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddPlaceReplica()

G4tgrPlaceDivRep * G4tgrVolume::AddPlaceReplica ( const std::vector< G4String > &  wl)

Definition at line 180 of file G4tgrVolume.cc.

181{
182 //---------- Check for exact number of words read
183 G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE, " G4tgrVolume::AddPlaceReplica");
184 G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_LE, " G4tgrVolume::AddPlaceReplica");
185
186 if( (wl.size() == 7) && (G4tgrUtils::GetDouble(wl[6]) != 0.)
187 && (wl[3] != "PHI") )
188 {
189 G4Exception("G4tgrVolume::AddPlaceReplica",
190 "Offset set for replica not along PHI, it will not be used",
192 G4String("Volume "+wl[1]+" in volume "+wl[2]).c_str());
193 }
194
195 //---------- set G4tgrPlace
196 G4tgrPlaceDivRep* pl = new G4tgrPlaceDivRep( wl );
197 pl->SetType("PlaceReplica");
198 pl->SetVolume( this );
199 thePlacements.push_back( pl );
200
201#ifdef G4VERBOSE
203 {
204 G4cout << " G4tgrVolume: New placement replica: " << thePlacements.size()
205 << " added for Volume " << theName
206 << " inside " << pl->GetParentName() << G4endl;
207 }
208#endif
209 //---------- register parent - child
211
212 return pl;
213}
@ JustWarning
@ WLSIZE_LE
Definition: G4tgrUtils.hh:52
void SetType(const G4String &typ)
Definition: G4tgrPlace.hh:63
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:203

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddRGBColour()

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

------— Set transparency

Definition at line 253 of file G4tgrVolume.cc.

254{
255 //---------- Check for exact number of words read
256 G4tgrUtils::CheckWLsize( wl, 5, WLSIZE_GE, " G4tgrVolume::AddRGBColour");
257
258 //---------- Set RGB colour
262 ///--------- Set transparency
263 if( wl.size() == 6 )
264 {
266 }
267}

◆ AddVisibility()

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

Definition at line 242 of file G4tgrVolume.cc.

243{
244 //---------- Check for exact number of words read
245 G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_EQ, " G4tgrVolume::AddVisibility");
246
247 //---------- Set visibility
249}

◆ GetCheckOverlaps()

G4bool G4tgrVolume::GetCheckOverlaps ( ) const
inline

Definition at line 100 of file G4tgrVolume.hh.

100{return theCheckOverlaps;}

Referenced by G4tgbVolume::ConstructG4PhysVol(), and G4tgrVolume().

◆ GetColour()

G4double * G4tgrVolume::GetColour ( ) const
inline

Definition at line 97 of file G4tgrVolume.hh.

97{return theRGBColour;}

Referenced by G4tgbVolume::GetColour().

◆ GetMaterialName()

const G4String & G4tgrVolume::GetMaterialName ( ) const
inline

◆ GetName()

◆ GetPlacements()

const std::vector< G4tgrPlace * > G4tgrVolume::GetPlacements ( ) const
inline

Definition at line 95 of file G4tgrVolume.hh.

95{return thePlacements;}

Referenced by G4tgrVolume(), and G4tgrVolumeMgr::GetTopVolume().

◆ GetRGBColour()

G4double * G4tgrVolume::GetRGBColour ( ) const
inline

Definition at line 98 of file G4tgrVolume.hh.

98{return theRGBColour;}

Referenced by G4tgrVolume().

◆ GetSolid()

G4tgrSolid * G4tgrVolume::GetSolid ( ) const
inline

◆ GetType()

◆ GetVisibility()

G4bool G4tgrVolume::GetVisibility ( ) const
inline

Definition at line 96 of file G4tgrVolume.hh.

96{return theVisibility;}

Referenced by G4tgrVolume(), and G4tgbVolume::GetVisibility().

◆ GetVolume()

G4tgrVolume * G4tgrVolume::GetVolume ( G4int  ii) const
virtual

Definition at line 127 of file G4tgrVolume.cc.

128{
129 G4String ErrMessage = "Should only be called for composite solids... "
131 G4Exception("G4tgrVolume::GetVolume()", "InvalidCall",
132 FatalException, ErrMessage);
133 return 0;
134}
@ FatalException
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:349

◆ SetName()

void G4tgrVolume::SetName ( const G4String name)
inline

Definition at line 90 of file G4tgrVolume.hh.

90{theName = name;}

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const G4tgrVolume obj 
)
friend

Definition at line 283 of file G4tgrVolume.cc.

284{
285 os << "G4tgrVolume= " << obj.theName << " Type= " << obj.theType
286 << " Material= " << obj.theMaterialName
287 << " Visibility " << obj.theVisibility
288 << " Colour " << (obj.theRGBColour)[0] << " "
289 << (obj.theRGBColour)[1] << " "
290 << (obj.theRGBColour)[2] << " "
291 << (obj.theRGBColour)[3] << " "
292 << " CheckOverlaps " << obj.theCheckOverlaps
293 << " N placements " << obj.thePlacements.size() << G4endl;
294
295 return os;
296}

Member Data Documentation

◆ theCheckOverlaps

G4bool G4tgrVolume::theCheckOverlaps
protected

Definition at line 121 of file G4tgrVolume.hh.

Referenced by AddCheckOverlaps(), G4tgrVolume(), and GetCheckOverlaps().

◆ theMaterialName

G4String G4tgrVolume::theMaterialName
protected

◆ theName

◆ thePlacements

std::vector<G4tgrPlace*> G4tgrVolume::thePlacements
protected

◆ theRGBColour

◆ theSolid

G4tgrSolid* G4tgrVolume::theSolid
protected

◆ theType

G4String G4tgrVolume::theType
protected

◆ theVisibility


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