Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4tgbVolumeMgr Class Reference

#include <G4tgbVolumeMgr.hh>

Public Member Functions

 G4tgbVolumeMgr ()
 
 ~G4tgbVolumeMgr ()
 
void AddTextFile (const G4String &fname)
 
G4VPhysicalVolumeReadAndConstructDetector ()
 
void CopyVolumes ()
 
G4tgbVolumeFindVolume (const G4String &volname)
 
void RegisterMe (const G4tgbVolume *vol)
 
void RegisterMe (const G4VSolid *solid)
 
void RegisterMe (const G4LogicalVolume *lv)
 
void RegisterMe (const G4VPhysicalVolume *pv)
 
void RegisterChildParentLVs (const G4LogicalVolume *logvol, const G4LogicalVolume *parentLV)
 
G4VSolidFindG4Solid (const G4String &name)
 
G4LogicalVolumeFindG4LogVol (const G4String &theName, const G4bool bExists=0)
 
G4VPhysicalVolumeFindG4PhysVol (const G4String &theName, const G4bool bExists=0)
 
G4VPhysicalVolumeGetTopPhysVol ()
 
G4LogicalVolumeGetTopLogVol ()
 
void BuildPhysVolTree ()
 
void DumpSummary ()
 
void DumpG4LogVolTree ()
 
void DumpG4LogVolLeaf (const G4LogicalVolume *lv, unsigned int leafDepth)
 
void DumpG4PhysVolTree ()
 
void DumpG4PhysVolLeaf (const G4VPhysicalVolume *pv, unsigned int leafDepth)
 
void DumpG4SolidList ()
 
const std::multimap< G4String,
G4VSolid * > & 
GetSolids () const
 
void SetDetectorBuilder (G4tgbDetectorBuilder *db)
 
G4tgbDetectorBuilderGetDetectorBuilder () const
 

Static Public Member Functions

static G4tgbVolumeMgrGetInstance ()
 

Detailed Description

Definition at line 66 of file G4tgbVolumeMgr.hh.

Constructor & Destructor Documentation

G4tgbVolumeMgr::G4tgbVolumeMgr ( )

Definition at line 56 of file G4tgbVolumeMgr.cc.

57 {
59  // NOTE: problems building matrices with not enough figures,
60  // like :ROTM RR30 0.866025 0.5 0. -0.5 0.866025 0. 0. 0 -1
61  theDetectorBuilder = new G4tgbDetectorBuilder();
62 }
static constexpr double mm
Definition: G4SIunits.hh:115
void SetScalePrecision(G4double scaleValue)
static G4ReflectionFactory * Instance()

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgbVolumeMgr::~G4tgbVolumeMgr ( )

Definition at line 66 of file G4tgbVolumeMgr.cc.

67 {
68  delete theDetectorBuilder;
69  delete theInstance;
70 }

Member Function Documentation

void G4tgbVolumeMgr::AddTextFile ( const G4String fname)

Definition at line 85 of file G4tgbVolumeMgr.cc.

86 {
88 }
static G4tgrFileReader * GetInstance()
void AddTextFile(const G4String &fname)

Here is the call graph for this function:

void G4tgbVolumeMgr::BuildPhysVolTree ( )

Definition at line 343 of file G4tgbVolumeMgr.cc.

344 {
345 /*
346  G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
347  std::vector<G4VPhysicalVolume*>::iterator cite;
348  for( cite = pvs->begin(); cite != pvs->end(); cite++ )
349  {
350  thePVTree[ *cite ] = (*cite)->GetMother();
351  thePVInvTree[ (*cite)->GetMother() ] = *cite;
352  }
353 */
354 }
void G4tgbVolumeMgr::CopyVolumes ( )

Definition at line 149 of file G4tgbVolumeMgr.cc.

150 {
151  //--------- Loop G4tgbVolume's and create a G4tgbVolume for each DetUnit
152  G4mapsvol::iterator cite;
154  for(cite = vollist.begin(); cite != vollist.end(); cite++)
155  {
156  G4tgrVolume* tgrvol = const_cast<G4tgrVolume*>( (*cite).second );
157  G4tgbVolume* svol = new G4tgbVolume( tgrvol );
158  RegisterMe( svol );
159  }
160 }
static G4tgrVolumeMgr * GetInstance()
std::map< G4String, G4tgrVolume * > G4mapsvol
void RegisterMe(const G4tgbVolume *vol)
const G4mapsvol & GetVolumeMap()

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpG4LogVolLeaf ( const G4LogicalVolume lv,
unsigned int  leafDepth 
)

Definition at line 411 of file G4tgbVolumeMgr.cc.

413 {
414  for( size_t ii=0; ii < leafDepth; ii++ )
415  {
416  G4cout << " ";
417  }
418  G4cout << " LV:(" << leafDepth << ")" << lv->GetName() << G4endl;
419 
420  //---------- construct the children of this volume
421  // G4LogicalVolume* lvnc = const_cast<G4LogicalVolume*>(lv);
422  // std::pair<G4mlvlv::iterator, G4mlvlv::iterator> children
423  // = theLVTree.equal_range( lvnc );
424  //
425  // G4mlvlv::iterator cite;
426 
427  leafDepth++;
428  // for( cite = children.first; cite != children.second; cite++ )
429  // {
430  // DumpG4LVLeaf( (*cite)->second, leafDepth );
431  // }
432 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpG4LogVolTree ( )

Definition at line 400 of file G4tgbVolumeMgr.cc.

401 {
402  G4cout << " @@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
403 
405 
406  DumpG4LogVolLeaf(lv, 0);
407 }
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume * GetTopLogVol()
#define G4endl
Definition: G4ios.hh:61
void DumpG4LogVolLeaf(const G4LogicalVolume *lv, unsigned int leafDepth)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpG4PhysVolLeaf ( const G4VPhysicalVolume pv,
unsigned int  leafDepth 
)

Definition at line 448 of file G4tgbVolumeMgr.cc.

450 {
451  for( size_t ii=0; ii < leafDepth; ii++ )
452  {
453  G4cout << " ";
454  }
455  G4cout << " PV:(" << leafDepth << ")" << pv->GetName() << G4endl;
456 
457  //---------- construct the children of this PV
458  // G4VPhysicalVolume* pvnc = const_cast<G4VPhysicalVolume*>(pv);
459  // std::pair<G4mpvpv::iterator, G4mpvpv::iterator> children
460  // = thePVTree.equal_range( pvnc );
461  //
462  // G4mpvpv::iterator cite;
463 
464  leafDepth++;
465  // for( cite = children.first; cite != children.second; cite++ )
466  // {
467  // DumpG4PVLeaf( (*cite)->second, leafDepth );
468  // }
469 }
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpG4PhysVolTree ( )

Definition at line 437 of file G4tgbVolumeMgr.cc.

438 {
439  G4cout << " @@@@@@@@@@@@@ DUMPING G4PhysicalVolume's Tree " << G4endl;
440 
442 
443  DumpG4PhysVolLeaf(pv, 0);
444 }
void DumpG4PhysVolLeaf(const G4VPhysicalVolume *pv, unsigned int leafDepth)
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * GetTopPhysVol()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpG4SolidList ( )

Definition at line 388 of file G4tgbVolumeMgr.cc.

389 {
390  G4mmssol::const_iterator cite;
391  for( cite = theSolids.begin(); cite != theSolids.end(); cite++)
392  {
393  G4cout << "G4SOLID: " << (*cite).second->GetName()
394  << " of type " << (*cite).second->GetEntityType() << G4endl;
395  }
396 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4tgbVolumeMgr::DumpSummary ( )

Definition at line 358 of file G4tgbVolumeMgr.cc.

359 {
360  //---------- Dump number of objects of each class
361  G4cout << " @@@@@@@@@@@@@ Dumping Geant4 geometry objects Summary " << G4endl;
362  G4cout << " @@@ Geometry built inside world volume: "
363  << GetTopPhysVol()->GetName() << G4endl;
364  G4cout << " Number of G4VSolid's: " << theSolids.size() << G4endl;
365  G4cout << " Number of G4LogicalVolume's: " << theLVs.size() << G4endl;
366  G4cout << " Number of G4VPhysicalVolume's: " << thePVs.size() << G4endl;
367 
369  G4cout << " Number of G4Isotope's: "
370  << mateMgr->GetG4IsotopeList().size() << G4endl;
371  G4cout << " Number of G4Element's: "
372  << mateMgr->GetG4ElementList().size() << G4endl;
373  G4cout << " Number of G4Material's: "
374  << mateMgr->GetG4MaterialList().size() << G4endl;
375 
377  G4cout << " Number of G4RotationMatrix's: "
378  << rotmMgr->GetG4RotMatList().size() << G4endl;
379 
380  //---------- Dump list of objects of each class
381  DumpG4SolidList();
384 }
const G4msg4mate GetG4MaterialList() const
static G4tgbRotationMatrixMgr * GetInstance()
const G4msg4rotm & GetG4RotMatList() const
const G4msg4elem GetG4ElementList() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const G4msg4isot GetG4IsotopeList() const
G4VPhysicalVolume * GetTopPhysVol()
void DumpG4PhysVolTree()
#define G4endl
Definition: G4ios.hh:61
static G4tgbMaterialMgr * GetInstance()

Here is the call graph for this function:

G4LogicalVolume * G4tgbVolumeMgr::FindG4LogVol ( const G4String theName,
const G4bool  bExists = 0 
)

Definition at line 239 of file G4tgbVolumeMgr.cc.

240 {
241  G4mmslv::const_iterator mscite = theLVs.find( name );
242  if( mscite == theLVs.end() )
243  {
244  if( exists )
245  {
246  G4String ErrMessage = "Logical volume name " + name + " not found !";
247  G4Exception("G4tgbVolumeMgr::FindG4LogVol()", "InvalidSetup",
248  FatalException, ErrMessage);
249  }
250  return 0;
251  }
252  else
253  {
254  return (*mscite).second;
255  }
256 }
const XML_Char * name
Definition: expat.h:151
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

G4VPhysicalVolume * G4tgbVolumeMgr::FindG4PhysVol ( const G4String theName,
const G4bool  bExists = 0 
)

Definition at line 260 of file G4tgbVolumeMgr.cc.

261 {
262  G4mmspv::const_iterator mscite = thePVs.find( name );
263  if( mscite == thePVs.end() )
264  {
265  if( exists )
266  {
267  G4String ErrMessage = "Physical volume name " + name + " not found !";
268  G4Exception("G4tgbVolumeMgr::FindG4PhysVol()", "InvalidSetup",
269  FatalException, ErrMessage);
270  }
271  return 0;
272  }
273  else
274  {
275  return (*mscite).second;
276  }
277 }
const XML_Char * name
Definition: expat.h:151
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

G4VSolid * G4tgbVolumeMgr::FindG4Solid ( const G4String name)

Definition at line 178 of file G4tgbVolumeMgr.cc.

179 {
180 #ifdef G4VERBOSE
182  {
183  G4cout << " G4tgbVolumeMgr::FindG4Solid() - " << name << G4endl;
184  }
185 #endif
186 
187  G4VSolid* oldSolid = 0;
188  std::pair<G4mmssol::iterator, G4mmssol::iterator> mmssdi;
189  mmssdi = theSolids.equal_range( name );
190 
191  if( mmssdi.first != mmssdi.second ) { // check there is a solid found
192  G4mmssol::const_iterator mmsscite = mmssdi.first;
193 
194 #ifdef G4VERBOSE
196  {
197  G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid finding "
198  << name << G4endl;
199  }
200 #endif
201  /*
202  G4VSolid overwrites the operator== comparing the addresses
203  => this cannot be used !!
204  Then just compare solids by name =>> POSP tag cannot be used
205  for the moment ...
206  if( solid == *( (*mmsscite).second ) )
207  {
208  oldSolid = (*mmsscite).second;
209  break;
210  }
211  until we write operator== for each solid type, we take a solid
212  with the same name (therefore we will not allow two solids with
213  equal name and different parameters (POSP) )
214  */
215  oldSolid = (*mmsscite).second;
216 #ifdef G4VERBOSE
218  {
219  G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid already found "
220  << name << G4endl;
221  }
222 #endif
223  }
224 
225 #ifdef G4VERBOSE
227  {
228  G4cout << " G4tgbVolumeMgr::FindG4Solid() - Old solid: "
229  << oldSolid << G4endl;
230  }
231 #endif
232 
233  return oldSolid;
234 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgbVolume * G4tgbVolumeMgr::FindVolume ( const G4String volname)

Definition at line 164 of file G4tgbVolumeMgr.cc.

165 {
166  G4mssvol::const_iterator cite = theVolumeList.find( volname );
167  if( cite == theVolumeList.end() )
168  {
169  G4String ErrMessage = "G4tgbVolume not found: " + volname + " !";
170  G4Exception("G4tgbVolumeMgr::FindVolume()", "InvalidSetup",
171  FatalException, ErrMessage);
172  }
173  return (*cite).second;
174 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgbDetectorBuilder* G4tgbVolumeMgr::GetDetectorBuilder ( ) const
inline

Definition at line 135 of file G4tgbVolumeMgr.hh.

136  { return theDetectorBuilder; }
G4tgbVolumeMgr * G4tgbVolumeMgr::GetInstance ( )
static

Definition at line 74 of file G4tgbVolumeMgr.cc.

75 {
76  if( !theInstance )
77  {
78  theInstance = new G4tgbVolumeMgr();
79  }
80  return theInstance;
81 }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::multimap< G4String, G4VSolid* >& G4tgbVolumeMgr::GetSolids ( ) const
inline

Definition at line 131 of file G4tgbVolumeMgr.hh.

132  { return theSolids; }
G4LogicalVolume * G4tgbVolumeMgr::GetTopLogVol ( )

Definition at line 299 of file G4tgbVolumeMgr.cc.

300 {
301  //----------- Start from any G4LogicalVolume, because if you go upwards
302  // you will always end at the top
303 #ifdef G4VERBOSE
305  {
306  G4cout << " G4tgbVolumeMgr::GetTopLogVol theLVInvTresize "
307  << theLVInvTree.size() << G4endl;
308  }
309 #endif
310  if( theLVInvTree.size() == 0 )
311  {
312  G4Exception("G4tgbVolumeMgr::GetTopLogVol()", "InvalidSetup",
313  FatalException, "theLVInvTree has no elements.");
314  }
315  G4LogicalVolume* lv = (*(theLVInvTree.begin())).second;
316 
317  //------- if first element is the top LV, its parent is 0
318  if( lv == 0 )
319  {
320  lv = (*(theLVInvTree.begin())).first;
321  }
322  else
323  {
324  while( (*(theLVInvTree.find( lv ))).second != 0)
325  {
326  //---------- get parent of first position
327  lv = (*(theLVInvTree.find( lv ))).second;
328 #ifdef G4VERBOSE
330  {
331  G4cout << " G4tgbVolumeMgr::GetTopPhysVol: lv "
332  << lv->GetName() << G4endl;
333  }
334 #endif
335  }
336  }
337 
338  return lv;
339 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4VPhysicalVolume * G4tgbVolumeMgr::GetTopPhysVol ( )

Definition at line 281 of file G4tgbVolumeMgr.cc.

282 {
283  G4LogicalVolume* lv = GetTopLogVol();
284  G4VPhysicalVolume* pv = ( *(thePVs.find( lv->GetName() )) ).second;
285 
286 #ifdef G4VERBOSE
288  {
289  G4cout << " G4tgbVolumeMgr::GetTopPhysVol() - pv: "
290  << pv->GetName() << G4endl;
291  }
292 #endif
293 
294  return pv;
295 }
static constexpr double second
Definition: G4SIunits.hh:157
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static G4int GetVerboseLevel()
G4LogicalVolume * GetTopLogVol()
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4VPhysicalVolume * G4tgbVolumeMgr::ReadAndConstructDetector ( )

Definition at line 92 of file G4tgbVolumeMgr.cc.

93 {
94  const G4tgrVolume* tgrVoltop = theDetectorBuilder->ReadDetector();
95  return theDetectorBuilder->ConstructDetector(tgrVoltop);
96 }
virtual const G4tgrVolume * ReadDetector()
virtual G4VPhysicalVolume * ConstructDetector(const G4tgrVolume *tgrVoltop)

Here is the call graph for this function:

void G4tgbVolumeMgr::RegisterChildParentLVs ( const G4LogicalVolume logvol,
const G4LogicalVolume parentLV 
)

Definition at line 139 of file G4tgbVolumeMgr.cc.

141 {
142  theLVInvTree[const_cast<G4LogicalVolume*>(logvol)] =
143  const_cast<G4LogicalVolume*>(parentLV);
144  theLVTree[const_cast<G4LogicalVolume*>(parentLV)] =
145  const_cast<G4LogicalVolume*>(logvol);
146 }

Here is the caller graph for this function:

void G4tgbVolumeMgr::RegisterMe ( const G4tgbVolume vol)

Definition at line 100 of file G4tgbVolumeMgr.cc.

101 {
102  theVolumeList.insert( G4mssvol::value_type( vol->GetName(),
103  const_cast<G4tgbVolume*>(vol) ) );
104 }
const G4String & GetName() const
Definition: G4tgbVolume.hh:108

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbVolumeMgr::RegisterMe ( const G4VSolid solid)

Definition at line 108 of file G4tgbVolumeMgr.cc.

109 {
110  theSolids.insert( G4mmssol::value_type( solid->GetName(),
111  const_cast<G4VSolid*>(solid) ) );
112 }
G4String GetName() const

Here is the call graph for this function:

void G4tgbVolumeMgr::RegisterMe ( const G4LogicalVolume lv)

Definition at line 116 of file G4tgbVolumeMgr.cc.

117 {
118  theLVs.insert( G4mmslv::value_type( lv->GetName(),
119  const_cast<G4LogicalVolume*>(lv) ) );
120 
121 #ifdef G4VERBOSE
123  {
124  G4cout << " G4tgbVolumeMgr::RegisterMe() - Logical volume registered: "
125  << lv->GetName() << G4endl;
126  }
127 #endif
128 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:

void G4tgbVolumeMgr::RegisterMe ( const G4VPhysicalVolume pv)

Definition at line 131 of file G4tgbVolumeMgr.cc.

132 {
133  thePVs.insert( G4mmspv::value_type( pv->GetName(),
134  const_cast<G4VPhysicalVolume*>(pv) ) );
135 }
const G4String & GetName() const

Here is the call graph for this function:

void G4tgbVolumeMgr::SetDetectorBuilder ( G4tgbDetectorBuilder db)
inline

Definition at line 133 of file G4tgbVolumeMgr.hh.

134  { theDetectorBuilder = db; }

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