Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Friends
G4tgrVolume Class Reference

#include <G4tgrVolume.hh>

Inheritance diagram for G4tgrVolume:
G4tgrVolumeAssembly G4tgrVolumeDivision

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::G4tgrVolume ( )

Definition at line 49 of file G4tgrVolume.cc.

50  : theName(""), theType(""),
51  theMaterialName(""), theSolid(0), theVisibility(false),
53 {
54 }
G4String theMaterialName
Definition: G4tgrVolume.hh:112
G4bool theVisibility
Definition: G4tgrVolume.hh:119
G4String theType
Definition: G4tgrVolume.hh:110
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:114
G4String theName
Definition: G4tgrVolume.hh:108
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
G4tgrVolume::G4tgrVolume ( const std::vector< G4String > &  wl)

Definition at line 65 of file G4tgrVolume.cc.

References G4tgrVolumeMgr::CreateSolid(), G4tgrVolumeMgr::FindSolid(), G4cout, G4endl, G4tgrVolumeMgr::GetInstance(), G4tgrUtils::GetString(), G4tgrMessenger::GetVerboseLevel(), theCheckOverlaps, theMaterialName, theName, theRGBColour, theSolid, theType, and theVisibility.

66 {
67  theType = "VOLSimple";
68 
69  //---------- set name
70  theName = G4tgrUtils::GetString( wl[1] );
71 
72  theVisibility = 1;
73  theRGBColour = new G4double[4];
74  for(size_t ii=0; ii<4; ii++) { theRGBColour[ii] = -1.; }
75  theCheckOverlaps = 0;
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
99  theSolid = G4tgrVolumeMgr::GetInstance()->FindSolid( wl[2], true );
100 
101 #ifdef G4VERBOSE
103  {
104  G4cout << "Created from existing solid: "
105  << *this << G4endl;
106  }
107 #endif
108  }
109 }
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
G4String theMaterialName
Definition: G4tgrVolume.hh:112
G4bool theVisibility
Definition: G4tgrVolume.hh:119
G4String theType
Definition: G4tgrVolume.hh:110
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
static G4tgrVolumeMgr * GetInstance()
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:114
G4String theName
Definition: G4tgrVolume.hh:108
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
#define G4endl
Definition: G4ios.hh:61
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
double G4double
Definition: G4Types.hh:76
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
G4tgrVolume::G4tgrVolume ( const G4tgrVolume vol)

Definition at line 113 of file G4tgrVolume.cc.

References GetCheckOverlaps(), GetMaterialName(), GetName(), GetPlacements(), GetRGBColour(), GetSolid(), GetType(), GetVisibility(), theCheckOverlaps, theMaterialName, theName, thePlacements, theRGBColour, theSolid, theType, and theVisibility.

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

Definition at line 58 of file G4tgrVolume.cc.

References theRGBColour.

59 {
60  delete [] theRGBColour;
61 }
G4double * theRGBColour
Definition: G4tgrVolume.hh:120

Member Function Documentation

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

------— Set check overlaps

Definition at line 271 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), theCheckOverlaps, and WLSIZE_GE.

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 }
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
static G4bool GetBool(const G4String &str)
Definition: G4tgrUtils.cc:448
G4tgrPlace * G4tgrVolume::AddPlace ( const std::vector< G4String > &  wl)
virtual

Reimplemented in G4tgrVolumeAssembly.

Definition at line 138 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), FatalErrorInArgument, G4cout, G4endl, G4Exception(), G4tgrPlace::GetCopyNo(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrPlace::GetType(), G4tgrMessenger::GetVerboseLevel(), readPY::pl, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), theName, thePlacements, and WLSIZE_EQ.

Referenced by G4tgrLineProcessor::ProcessLine().

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 }
const G4String & GetType() const
Definition: G4tgrPlace.hh:61
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
tuple pl
Definition: readPY.py:5
G4GLOB_DLL std::ostream G4cout
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:62
static G4int GetVerboseLevel()
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
static G4tgrVolumeMgr * GetInstance()
G4String theName
Definition: G4tgrVolume.hh:108
const G4String & GetParentName() const
Definition: G4tgrPlace.hh:58
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
unsigned int GetCopyNo() const
Definition: G4tgrPlace.hh:60
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
#define G4endl
Definition: G4ios.hh:61
G4tgrPlaceParameterisation * G4tgrVolume::AddPlaceParam ( const std::vector< G4String > &  wl)

Definition at line 218 of file G4tgrVolume.cc.

References G4cout, G4endl, G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), readPY::pl, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), theName, and thePlacements.

Referenced by G4tgrLineProcessor::ProcessLine().

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 }
tuple pl
Definition: readPY.py:5
G4GLOB_DLL std::ostream G4cout
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:62
static G4int GetVerboseLevel()
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
static G4tgrVolumeMgr * GetInstance()
G4String theName
Definition: G4tgrVolume.hh:108
const G4String & GetParentName() const
Definition: G4tgrPlace.hh:58
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
#define G4endl
Definition: G4ios.hh:61
G4tgrPlaceDivRep * G4tgrVolume::AddPlaceReplica ( const std::vector< G4String > &  wl)

Definition at line 180 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4cout, G4endl, G4Exception(), G4tgrUtils::GetDouble(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), JustWarning, readPY::pl, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetType(), G4tgrPlace::SetVolume(), theName, thePlacements, WLSIZE_GE, and WLSIZE_LE.

Referenced by G4tgrLineProcessor::ProcessLine().

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",
191  JustWarning,
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 }
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
void SetType(const G4String &typ)
Definition: G4tgrPlace.hh:63
tuple pl
Definition: readPY.py:5
G4GLOB_DLL std::ostream G4cout
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:62
static G4int GetVerboseLevel()
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
static G4tgrVolumeMgr * GetInstance()
G4String theName
Definition: G4tgrVolume.hh:108
const G4String & GetParentName() const
Definition: G4tgrPlace.hh:58
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
#define G4endl
Definition: G4ios.hh:61
void G4tgrVolume::AddRGBColour ( const std::vector< G4String > &  wl)

------— Set transparency

Definition at line 253 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetDouble(), theRGBColour, and WLSIZE_GE.

254 {
255  //---------- Check for exact number of words read
256  G4tgrUtils::CheckWLsize( wl, 5, WLSIZE_GE, " G4tgrVolume::AddRGBColour");
257 
258  //---------- Set RGB colour
259  theRGBColour[0] = G4tgrUtils::GetDouble( wl[2] );
260  theRGBColour[1] = G4tgrUtils::GetDouble( wl[3] );
261  theRGBColour[2] = G4tgrUtils::GetDouble( wl[4] );
262  ///--------- Set transparency
263  if( wl.size() == 6 )
264  {
265  theRGBColour[3] = G4tgrUtils::GetDouble( wl[5] );
266  }
267 }
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
void G4tgrVolume::AddVisibility ( const std::vector< G4String > &  wl)

Definition at line 242 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), theVisibility, and WLSIZE_EQ.

243 {
244  //---------- Check for exact number of words read
245  G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_EQ, " G4tgrVolume::AddVisibility");
246 
247  //---------- Set visibility
249 }
G4bool theVisibility
Definition: G4tgrVolume.hh:119
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
static G4bool GetBool(const G4String &str)
Definition: G4tgrUtils.cc:448
G4bool G4tgrVolume::GetCheckOverlaps ( ) const
inline

Definition at line 100 of file G4tgrVolume.hh.

References theCheckOverlaps.

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

100 {return theCheckOverlaps;}
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
G4double* G4tgrVolume::GetColour ( ) const
inline

Definition at line 97 of file G4tgrVolume.hh.

References theRGBColour.

Referenced by G4tgbVolume::GetColour().

97 {return theRGBColour;}
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
const G4String& G4tgrVolume::GetMaterialName ( ) const
inline

Definition at line 93 of file G4tgrVolume.hh.

References theMaterialName.

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

93 {return theMaterialName;}
G4String theMaterialName
Definition: G4tgrVolume.hh:112
const G4String& G4tgrVolume::GetName ( void  ) const
inline
const std::vector<G4tgrPlace*> G4tgrVolume::GetPlacements ( ) const
inline

Definition at line 95 of file G4tgrVolume.hh.

References thePlacements.

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

95 {return thePlacements;}
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
G4double* G4tgrVolume::GetRGBColour ( ) const
inline

Definition at line 98 of file G4tgrVolume.hh.

References theRGBColour.

Referenced by G4tgrVolume().

98 {return theRGBColour;}
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
G4tgrSolid* G4tgrVolume::GetSolid ( ) const
inline

Definition at line 92 of file G4tgrVolume.hh.

References theSolid.

Referenced by G4tgbVolume::ConstructG4Volumes(), G4tgrSolidBoolean::G4tgrSolidBoolean(), and G4tgrVolume().

92 {return theSolid;}
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:114
const G4String& G4tgrVolume::GetType ( ) const
inline
G4bool G4tgrVolume::GetVisibility ( ) const
inline

Definition at line 96 of file G4tgrVolume.hh.

References theVisibility.

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

96 {return theVisibility;}
G4bool theVisibility
Definition: G4tgrVolume.hh:119
G4tgrVolume * G4tgrVolume::GetVolume ( G4int  ii) const
virtual

Definition at line 127 of file G4tgrVolume.cc.

References G4UIcommand::ConvertToString(), FatalException, and G4Exception().

128 {
129  G4String ErrMessage = "Should only be called for composite solids... "
131  G4Exception("G4tgrVolume::GetVolume()", "InvalidCall",
132  FatalException, ErrMessage);
133  return 0;
134 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void G4tgrVolume::SetName ( const G4String name)
inline

Definition at line 90 of file G4tgrVolume.hh.

References theName.

90 {theName = name;}
const XML_Char * name
G4String theName
Definition: G4tgrVolume.hh:108

Friends And Related Function Documentation

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 }
G4String theMaterialName
Definition: G4tgrVolume.hh:112
G4bool theVisibility
Definition: G4tgrVolume.hh:119
G4String theType
Definition: G4tgrVolume.hh:110
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:116
G4String theName
Definition: G4tgrVolume.hh:108
#define G4endl
Definition: G4ios.hh:61
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:121
G4double * theRGBColour
Definition: G4tgrVolume.hh:120

Field Documentation

G4bool G4tgrVolume::theCheckOverlaps
protected

Definition at line 121 of file G4tgrVolume.hh.

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

G4String G4tgrVolume::theMaterialName
protected
G4String G4tgrVolume::theName
protected
std::vector<G4tgrPlace*> G4tgrVolume::thePlacements
protected
G4double* G4tgrVolume::theRGBColour
protected
G4tgrSolid* G4tgrVolume::theSolid
protected
G4String G4tgrVolume::theType
protected
G4bool G4tgrVolume::theVisibility
protected

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