GGS(GenericGEANT4Simulation)Software  2.99.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Macros
GeoManager.cpp
1 #include "utils/GGSSmartLog.h"
2 
3 #include "display/geometry/GeoManager.h"
4 
5 LeonardGeoManager::LeonardGeoManager() {}
6 
7 TGeoNode *LeonardGeoManager::GetWorldNode() {
8  static const std::string routineName("LeonardGeoManager::GetWorldNode");
9 
10  if (!_wnode) {
11  _wnode = (TGeoNode *)gGeoManager->GetListOfNodes()->At(0); // TODO: Try to get top node programmatically
12  while (_wnode != gGeoManager->GetTopNode()) {
13  gGeoManager->CdUp();
14  _wnode = gGeoManager->GetCurrentNode();
15  }
16  GGSCOUT(DEBUG) << "Top _wnode is " << _wnode->GetName() << GGSENDL;
17  }
18 
19  return _wnode;
20 }
21 
22 TEveGeoTopNode *LeonardGeoManager::GetEveGeoTopNode() {
23 
24  if (!_node) {
25  _node = new TEveGeoTopNode(gGeoManager, GetWorldNode());
26  }
27 
28  return _node;
29 }
30 
31 std::string LeonardGeoManager::GetNodePath(TGeoNode *node, char sep) {
32  static const std::string routineName("LeonardGeoManager::GetNodePath");
33 
34  std::string path = node->GetName();
35 
36  node->cd();
37 
38  while (node != gGeoManager->GetTopNode()) {
39  gGeoManager->CdUp();
40  node = gGeoManager->GetCurrentNode();
41  std::string tempname = node->GetName();
42  path.insert(0, 1, sep);
43  path.insert(0, tempname);
44  }
45 
46  return path;
47 }
#define GGSENDL
Definition: GGSSmartLog.h:131