GGS(GenericGEANT4Simulation)Software  2.6.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GeoManager.cpp
1 #include "utils/GGSSmartLog.h"
2 
3 #include "geometry/GeoManager.h"
4 
5 LeonardGeoManager::LeonardGeoManager() : TGeoManager(), _wnode(nullptr), _node(nullptr) {
6 
7  gGeoManager = this;
8 
9 }
10 
11 LeonardGeoManager::LeonardGeoManager(TGeoManager* geoman) : TGeoManager(*geoman), _wnode(nullptr), _node(nullptr) {}
12 
13 LeonardGeoManager::~LeonardGeoManager(){}
14 
15 TGeoNode* LeonardGeoManager::GetWorldNode(){
16  static const std::string routineName("LeonardGeoManager::GetWorldNode");
17 
18  if( ! _wnode ){
19  _wnode = (TGeoNode*) GetListOfNodes()->At(0); //TODO: Try to get top node programmatically
20  while( _wnode != GetTopNode() ){
21  CdUp();
22  _wnode = GetCurrentNode();
23  }
24  COUT(DEBUG) << "Top _wnode is " << _wnode->GetName() << ENDL;
25  }
26 
27  return _wnode;
28 }
29 
30 TEveGeoTopNode* LeonardGeoManager::GetEveGeoTopNode(){
31 
32  if( ! _node ){
33  _node = new TEveGeoTopNode(this, GetWorldNode());
34  }
35 
36  return _node;
37 }
38 
39 
40 std::string LeonardGeoManager::GetNodePath(TGeoNode* node, char sep){
41  static const std::string routineName("LeonardGeoManager::GetNodePath");
42 
43  std::string path = node->GetName();
44 
45  node->cd();
46 
47  while( node != GetTopNode() ){
48  CdUp();
49  node = GetCurrentNode();
50  std::string tempname = node->GetName();
51  path.insert(0, 1, sep);
52  path.insert(0, tempname);
53  }
54 
55  return path;
56 
57 }
#define ENDL
Definition: GGSSmartLog.h:93
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
Definition: GGSSmartLog.h:66