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

#include <G4tgrVolumeMgr.hh>

Public Member Functions

G4tgrSolidCreateSolid (const std::vector< G4String > &wl, G4bool bVOLUtag)
 
void RegisterParentChild (const G4String &parentName, const G4tgrPlace *pl)
 
G4tgrSolidFindSolid (const G4String &name, G4bool exists=false)
 
G4tgrVolumeFindVolume (const G4String &volname, G4bool exists=false)
 
std::vector< G4tgrVolume * > FindVolumes (const G4String &volname, G4bool exists)
 
const G4tgrVolumeGetTopVolume ()
 
std::pair< G4mmapspl::iterator,
G4mmapspl::iterator > 
GetChildren (const G4String &name)
 
void DumpSummary ()
 
void DumpVolumeTree ()
 
void DumpVolumeLeaf (const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
 
void RegisterMe (G4tgrSolid *vol)
 
void UnRegisterMe (G4tgrSolid *vol)
 
void RegisterMe (G4tgrVolume *vol)
 
void UnRegisterMe (G4tgrVolume *vol)
 
void RegisterMe (G4tgrPlace *pl)
 
void RegisterMe (G4tgrIsotope *iso)
 
void RegisterMe (G4tgrElement *ele)
 
void RegisterMe (G4tgrMaterial *mat)
 
void RegisterMe (G4tgrRotationMatrix *rm)
 
const G4mapssolGetSolidMap ()
 
const G4mapsvolGetVolumeMap ()
 
const G4mmapsplGetVolumeTree ()
 
std::vector< G4tgrVolume * > GetVolumeList ()
 
std::vector< G4tgrPlace * > GetDetPlaceList ()
 
std::vector< G4tgrIsotope * > GetIsotopeList ()
 
std::vector< G4tgrElement * > GetElementList ()
 
std::vector< G4tgrMaterial * > GetMaterialList ()
 
std::vector
< G4tgrRotationMatrix * > 
GetRotMList ()
 

Static Public Member Functions

static G4tgrVolumeMgrGetInstance ()
 

Detailed Description

Definition at line 59 of file G4tgrVolumeMgr.hh.

Member Function Documentation

G4tgrSolid * G4tgrVolumeMgr::CreateSolid ( const std::vector< G4String > &  wl,
G4bool  bVOLUtag 
)

Definition at line 75 of file G4tgrVolumeMgr.cc.

76 {
77  G4tgrSolid* sol = FindSolid( wl[1] );
78  if( sol )
79  {
80  G4String ErrMessage = "Solid already exists... " + wl[1];
81  G4Exception("G4tgrVolumeMgr::CreateSolid()", "InvalidSetup",
82  FatalException, ErrMessage);
83  }
84 
85  std::vector<G4String> wlc = wl;
86  if( bVOLUtag ) { wlc.pop_back(); }
87 
88  G4String wl2 = wlc[2];
89  for( size_t ii = 0; ii < wl2.length(); ii++ )
90  {
91  wl2[ii] = toupper( wl2[ii] );
92  }
93  if( (wl2 == "UNION") || (wl2 == "SUBTRACTION") || (wl2 == "INTERSECTION") )
94  {
95  //---------- Boolean solid
96  //---------- Create G4tgrSolidBoolean and fill the solid params
97  sol = new G4tgrSolidBoolean( wlc );
98  }
99  else
100  {
101  //---------- Create G4tgrSolidSimple and fill the solid params
102  sol = new G4tgrSolid( wlc );
103  }
104 
105  return sol;
106 }
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
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:

void G4tgrVolumeMgr::DumpSummary ( )

Definition at line 392 of file G4tgrVolumeMgr.cc.

393 {
394  //---------- Dump number of objects of each class
395  G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " << G4endl;
396  G4cout << " @@@ Geometry built inside world volume: "
397  << GetTopVolume()->GetName() << G4endl;
398  G4cout << " Number of G4tgrVolume's: "
399  << theG4tgrVolumeMap.size() << G4endl;
400  G4mapsvol::const_iterator cite;
401  unsigned int nPlace = 0;
402  for( cite = theG4tgrVolumeMap.begin();
403  cite != theG4tgrVolumeMap.end(); cite++ )
404  {
405  nPlace += ((*cite).second)->GetPlacements().size();
406  }
407  G4cout << " Number of G4tgrPlace's: " << nPlace << G4endl;
408 
410  G4cout << " Number of G4tgrIsotope's: "
411  << matef->GetIsotopeList().size() << G4endl;
412  G4cout << " Number of G4tgrElement's: "
413  << matef->GetElementList().size() << G4endl;
414  G4cout << " Number of G4tgrMaterial's: "
415  << matef->GetMaterialList().size() << G4endl;
416 
418  G4cout << " Number of G4tgrRotationMatrix's: "
419  << rotmf->GetRotMatList().size() << G4endl;
420 
421 
422  //---------- Dump detail list of objects of each class
423  DumpVolumeTree();
424 
425  matef->DumpIsotopeList();
426  matef->DumpElementList();
427  matef->DumpMaterialList();
428  rotmf->DumpRotmList();
429 }
const G4mstgrisot & GetIsotopeList() const
const G4mstgrmate & GetMaterialList() const
static G4tgrRotationMatrixFactory * GetInstance()
G4GLOB_DLL std::ostream G4cout
std::vector< G4tgrRotationMatrix * > GetRotMatList() const
#define G4endl
Definition: G4ios.hh:61
const G4tgrVolume * GetTopVolume()
const G4mstgrelem & GetElementList() const
static G4tgrMaterialFactory * GetInstance()
const G4String & GetName() const
Definition: G4tgrVolume.hh:89

Here is the call graph for this function:

void G4tgrVolumeMgr::DumpVolumeLeaf ( const G4tgrVolume vol,
unsigned int  copyNo,
unsigned int  leafDepth 
)

Definition at line 362 of file G4tgrVolumeMgr.cc.

365 {
366  for( size_t ii=0; ii < leafDepth; ii++ )
367  {
368  G4cout << " ";
369  }
370  G4cout << " VOL:(" << leafDepth << ")" << vol->GetName()
371  << " copy No " << copyNo << G4endl;
372 
373  //---------- construct the children of this VOL
374  std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children
375  = GetChildren( vol->GetName() );
376  G4mmapspl::const_iterator cite;
377 
378  leafDepth++;
379  for( cite = children.first; cite != children.second; cite++ )
380  {
381  //---- find G4tgrVolume pointed by G4tgrPlace
382  const G4tgrPlace* pla = (*cite).second;
383  const G4tgrVolume* volchild = pla->GetVolume();
384  //--- find copyNo
385  unsigned int cn = pla->GetCopyNo();
386  DumpVolumeLeaf( volchild, cn, leafDepth );
387  }
388 }
G4tgrVolume * GetVolume() const
Definition: G4tgrPlace.hh:59
G4GLOB_DLL std::ostream G4cout
void DumpVolumeLeaf(const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
unsigned int GetCopyNo() const
Definition: G4tgrPlace.hh:60
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4tgrVolume.hh:89
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > GetChildren(const G4String &name)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgrVolumeMgr::DumpVolumeTree ( )

Definition at line 351 of file G4tgrVolumeMgr.cc.

352 {
353  G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " << G4endl;
354 
355  const G4tgrVolume* vol = GetTopVolume();
356 
357  DumpVolumeLeaf( vol, 0, 0);
358 }
G4GLOB_DLL std::ostream G4cout
void DumpVolumeLeaf(const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
#define G4endl
Definition: G4ios.hh:61
const G4tgrVolume * GetTopVolume()

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgrSolid * G4tgrVolumeMgr::FindSolid ( const G4String name,
G4bool  exists = false 
)

Definition at line 187 of file G4tgrVolumeMgr.cc.

188 {
189  G4tgrSolid* vol = 0;
190 
191  G4mapssol::iterator svite = theG4tgrSolidMap.find( volname );
192  if( svite == theG4tgrSolidMap.end() )
193  {
194  if( exists )
195  {
196  for( svite = theG4tgrSolidMap.begin();
197  svite != theG4tgrSolidMap.end(); svite++ )
198  {
199  G4cerr << " VOL:" << (*svite).first << G4endl;
200  }
201  G4String ErrMessage = "Solid not found... " + volname;
202  G4Exception("G4tgrVolumeMgr::FindSolid()", "InvalidSetup",
203  FatalException, ErrMessage);
204  }
205  }
206  else
207  {
208  vol = const_cast<G4tgrSolid*>((*svite).second);
209  }
210 
211  return vol;
212 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgrVolume * G4tgrVolumeMgr::FindVolume ( const G4String volname,
G4bool  exists = false 
)

Definition at line 217 of file G4tgrVolumeMgr.cc.

218 {
219  G4tgrVolume* vol = 0;
220 
221  G4mapsvol::iterator svite = theG4tgrVolumeMap.find( volname );
222  if( svite == theG4tgrVolumeMap.end() )
223  {
224  if( exists )
225  {
226  for( svite = theG4tgrVolumeMap.begin();
227  svite != theG4tgrVolumeMap.end(); svite++ )
228  {
229  G4cerr << " VOL:" << (*svite).first << G4endl;
230  }
231  G4String ErrMessage = "Volume not found... " + volname;
232  G4Exception("G4tgrVolumeMgr::FindVolume()", "InvalidSetup",
233  FatalException, ErrMessage);
234  }
235  else
236  {
237  G4String WarMessage = "Volume does not exists... " + volname;
238  G4Exception("G4tgrVolumeMgr::FindVolume()", "SearchFailed",
239  JustWarning, WarMessage);
240  }
241  }
242  else
243  {
244  vol = const_cast<G4tgrVolume*>((*svite).second);
245  }
246 
247  return vol;
248 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< G4tgrVolume * > G4tgrVolumeMgr::FindVolumes ( const G4String volname,
G4bool  exists 
)

Definition at line 252 of file G4tgrVolumeMgr.cc.

253 {
254  std::vector<G4tgrVolume*> vols;
255 
256  G4mapsvol::iterator svite;
257  for( svite = theG4tgrVolumeMap.begin();
258  svite != theG4tgrVolumeMap.end(); svite++ )
259  {
260  if( G4tgrUtils::AreWordsEquivalent( volname, (*svite).second->GetName()) )
261  {
262  vols.push_back(const_cast<G4tgrVolume*>((*svite).second) );
263  }
264  }
265 
266  if( vols.size() == 0 )
267  {
268  if( exists )
269  {
270  for( svite = theG4tgrVolumeMap.begin();
271  svite != theG4tgrVolumeMap.end(); svite++ )
272  {
273  G4cerr << " VOL:" << (*svite).first << G4endl;
274  }
275  G4String ErrMessage = "Volume not found... " + volname;
276  G4Exception("G4tgrVolumeMgr::FindVolumes()", "InvalidSetup",
277  FatalException, ErrMessage);
278  }
279  else
280  {
281  G4String WarMessage = "Volume does not exists... " + volname;
282  G4Exception("G4tgrVolumeMgr::FindVolumes()", "SearchFailed",
283  JustWarning, WarMessage);
284  }
285  }
286 
287  return vols;
288 }
static G4bool AreWordsEquivalent(const G4String &word1, const G4String &word2)
Definition: G4tgrUtils.cc:672
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< G4mmapspl::iterator, G4mmapspl::iterator > G4tgrVolumeMgr::GetChildren ( const G4String name)

Definition at line 342 of file G4tgrVolumeMgr.cc.

343 {
344  std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite;
345  dite = theG4tgrVolumeTree.equal_range( name );
346  return dite;
347 }

Here is the caller graph for this function:

std::vector<G4tgrPlace*> G4tgrVolumeMgr::GetDetPlaceList ( )
inline

Definition at line 118 of file G4tgrVolumeMgr.hh.

118 {return theG4tgrPlaceList;}
std::vector<G4tgrElement*> G4tgrVolumeMgr::GetElementList ( )
inline

Definition at line 120 of file G4tgrVolumeMgr.hh.

120 {return theHgElemList;}
G4tgrVolumeMgr * G4tgrVolumeMgr::GetInstance ( )
static

Definition at line 63 of file G4tgrVolumeMgr.cc.

64 {
65  if( !theInstance )
66  {
67  theInstance = new G4tgrVolumeMgr;
68  }
69  return theInstance;
70 }

Here is the caller graph for this function:

std::vector<G4tgrIsotope*> G4tgrVolumeMgr::GetIsotopeList ( )
inline

Definition at line 119 of file G4tgrVolumeMgr.hh.

119 {return theHgIsotList;}
std::vector<G4tgrMaterial*> G4tgrVolumeMgr::GetMaterialList ( )
inline

Definition at line 121 of file G4tgrVolumeMgr.hh.

121 {return theHgMateList;}
std::vector<G4tgrRotationMatrix*> G4tgrVolumeMgr::GetRotMList ( )
inline

Definition at line 122 of file G4tgrVolumeMgr.hh.

122 {return theHgRotMList;}
const G4mapssol& G4tgrVolumeMgr::GetSolidMap ( )
inline

Definition at line 114 of file G4tgrVolumeMgr.hh.

114 {return theG4tgrSolidMap;}
const G4tgrVolume * G4tgrVolumeMgr::GetTopVolume ( )

Definition at line 292 of file G4tgrVolumeMgr.cc.

293 {
294  //--- Start from any G4tgrVolume and go upwards until you get to the top.
295  // Check that indeed all volumes drive to the same top volume
296 
297  const G4tgrVolume* topVol = 0;
298  G4mapsvol::const_iterator itetv;
299  for( itetv = theG4tgrVolumeMap.begin();
300  itetv != theG4tgrVolumeMap.end(); itetv++ )
301  {
302  const G4tgrVolume* vol = (*itetv).second;
303 #ifdef G4VERBOSE
305  {
306  G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: "
307  << vol->GetName() << " no place = "
308  << vol->GetPlacements().size() << G4endl;
309  }
310 #endif
311 
312  while( vol->GetPlacements().size() != 0 )
313  {
314  vol = FindVolume((*(vol->GetPlacements()).begin())->GetParentName(), 1);
315 #ifdef G4VERBOSE
317  {
318  G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: "
319  << vol->GetName()<< " N place = "
320  << vol->GetPlacements().size() << G4endl;
321  }
322 #endif
323  }
324  if ( (topVol != 0) && (topVol != vol)
325  && (topVol->GetType() != "VOLDivision")
326  && (vol->GetType() != "VOLDivision") )
327  {
328  G4Exception("G4tgrVolumeMgr::GetTopVolume()",
329  "Two world volumes found, second will be taken", JustWarning,
330  (G4String("Both volumes are at the top of a hierarchy: ")
331  + topVol->GetName() + " & " + vol->GetName() ).c_str());
332  }
333  topVol = vol;
334  }
335 
336  return topVol;
337 }
const std::vector< G4tgrPlace * > GetPlacements() const
Definition: G4tgrVolume.hh:95
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetType() const
Definition: G4tgrVolume.hh:91
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4tgrVolume.hh:89

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector<G4tgrVolume*> G4tgrVolumeMgr::GetVolumeList ( )
inline

Definition at line 117 of file G4tgrVolumeMgr.hh.

117 {return theG4tgrVolumeList;}
const G4mapsvol& G4tgrVolumeMgr::GetVolumeMap ( )
inline

Definition at line 115 of file G4tgrVolumeMgr.hh.

115 {return theG4tgrVolumeMap;}

Here is the caller graph for this function:

const G4mmapspl& G4tgrVolumeMgr::GetVolumeTree ( )
inline

Definition at line 116 of file G4tgrVolumeMgr.hh.

116 {return theG4tgrVolumeTree;}
void G4tgrVolumeMgr::RegisterMe ( G4tgrSolid vol)

Definition at line 109 of file G4tgrVolumeMgr.cc.

110 {
111  if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() )
112  {
113  G4String ErrMessage = "Cannot be two solids with the same name... "
114  + sol->GetName();
115  G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup",
116  FatalException, ErrMessage);
117  }
118  theG4tgrSolidMap.insert(G4mapssol::value_type(sol->GetName(), sol) );
119 }
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:

void G4tgrVolumeMgr::RegisterMe ( G4tgrVolume vol)

Definition at line 140 of file G4tgrVolumeMgr.cc.

141 {
142  theG4tgrVolumeList.push_back( vol );
143  if( theG4tgrVolumeMap.find( vol->GetName() ) != theG4tgrVolumeMap.end() )
144  {
145  G4String ErrMessage = "Cannot be two volumes with the same name... "
146  + vol->GetName();
147  G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup",
148  FatalException, ErrMessage);
149  }
150  theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->GetName(), vol) );
151 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
Definition: G4tgrVolume.hh:89

Here is the call graph for this function:

void G4tgrVolumeMgr::RegisterMe ( G4tgrPlace pl)
inline

Definition at line 106 of file G4tgrVolumeMgr.hh.

106 { theG4tgrPlaceList.push_back( pl ); }
void G4tgrVolumeMgr::RegisterMe ( G4tgrIsotope iso)
inline

Definition at line 107 of file G4tgrVolumeMgr.hh.

107 { theHgIsotList.push_back( iso ); }
void G4tgrVolumeMgr::RegisterMe ( G4tgrElement ele)
inline

Definition at line 108 of file G4tgrVolumeMgr.hh.

108 { theHgElemList.push_back( ele ); }
void G4tgrVolumeMgr::RegisterMe ( G4tgrMaterial mat)
inline

Definition at line 109 of file G4tgrVolumeMgr.hh.

109 { theHgMateList.push_back( mat ); }
void G4tgrVolumeMgr::RegisterMe ( G4tgrRotationMatrix rm)
inline

Definition at line 110 of file G4tgrVolumeMgr.hh.

110 { theHgRotMList.push_back(rm); }
void G4tgrVolumeMgr::RegisterParentChild ( const G4String parentName,
const G4tgrPlace pl 
)

Definition at line 179 of file G4tgrVolumeMgr.cc.

181 {
182  theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl) );
183 }

Here is the caller graph for this function:

void G4tgrVolumeMgr::UnRegisterMe ( G4tgrSolid vol)

Definition at line 123 of file G4tgrVolumeMgr.cc.

124 {
125  if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() )
126  {
127  G4String ErrMessage = "Cannot unregister a solid that is not registered... "
128  + sol->GetName();
129  G4Exception("G4tgrSolidMgr::unRegisterMe()", "InvalidSetup",
130  FatalException, ErrMessage);
131  }
132  else
133  {
134  theG4tgrSolidMap.erase( theG4tgrSolidMap.find( sol->GetName() ) );
135  }
136 }
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:

void G4tgrVolumeMgr::UnRegisterMe ( G4tgrVolume vol)

Definition at line 155 of file G4tgrVolumeMgr.cc.

156 {
157  std::vector<G4tgrVolume*>::iterator ite;
158  for(ite = theG4tgrVolumeList.begin(); ite != theG4tgrVolumeList.end(); ite++)
159  {
160  if((*ite) == vol ) { break; }
161  }
162  if( ite == theG4tgrVolumeList.end() )
163  {
164  G4String ErrMessage = "Cannot unregister a volume not registered... "
165  + vol->GetName();
166  G4Exception("G4tgrVolumeMgr::unRegisterMe()", "InvalidSetup",
167  FatalException, ErrMessage);
168  }
169  else
170  {
171  theG4tgrVolumeList.erase( ite );
172  }
173  theG4tgrVolumeMap.erase( theG4tgrVolumeMap.find( vol->GetName() ) );
174 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
Definition: G4tgrVolume.hh:89

Here is the call graph for this function:


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