GGS(GenericGEANT4Simulation)Software  2.7.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) { gGeoManager = this; }
6 
7 LeonardGeoManager::LeonardGeoManager(TGeoManager *geoman) : TGeoManager(*geoman), _wnode(nullptr), _node(nullptr) {}
8 
9 LeonardGeoManager::~LeonardGeoManager() {}
10 
11 TGeoNode *LeonardGeoManager::GetWorldNode() {
12  static const std::string routineName("LeonardGeoManager::GetWorldNode");
13 
14  if (!_wnode) {
15  _wnode = (TGeoNode *)GetListOfNodes()->At(0); // TODO: Try to get top node programmatically
16  while (_wnode != GetTopNode()) {
17  CdUp();
18  _wnode = GetCurrentNode();
19  }
20  COUT(DEBUG) << "Top _wnode is " << _wnode->GetName() << ENDL;
21  }
22 
23  return _wnode;
24 }
25 
26 TEveGeoTopNode *LeonardGeoManager::GetEveGeoTopNode() {
27 
28  if (!_node) {
29  _node = new TEveGeoTopNode(this, GetWorldNode());
30  }
31 
32  return _node;
33 }
34 
35 std::string LeonardGeoManager::GetNodePath(TGeoNode *node, char sep) {
36  static const std::string routineName("LeonardGeoManager::GetNodePath");
37 
38  std::string path = node->GetName();
39 
40  node->cd();
41 
42  while (node != GetTopNode()) {
43  CdUp();
44  node = GetCurrentNode();
45  std::string tempname = node->GetName();
46  path.insert(0, 1, sep);
47  path.insert(0, tempname);
48  }
49 
50  return path;
51 }
#define ENDL
Definition: GGSSmartLog.h:105
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
Definition: GGSSmartLog.h:76