Public Member Functions | List of all members
TRecurseGeoManager Class Reference

#include <TRecurseGeoManager.hxx>

Public Member Functions

 TRecurseGeoManager ()
 
virtual ~TRecurseGeoManager ()
 
bool Apply (int depth=0)
 
virtual bool Action (int depth)
 

Detailed Description

Definition at line 8 of file TRecurseGeoManager.hxx.

Constructor & Destructor Documentation

TRecurseGeoManager::TRecurseGeoManager ( )
inline

Definition at line 10 of file TRecurseGeoManager.hxx.

10 {}
virtual TRecurseGeoManager::~TRecurseGeoManager ( )
inlinevirtual

Definition at line 11 of file TRecurseGeoManager.hxx.

11 {}

Member Function Documentation

virtual bool TRecurseGeoManager::Action ( int  depth)
inlinevirtual

An action to override. Return false if the recursion should be stopped. The action should act on the current node, and NOT change the geometry. The input argument (depth) is the current depth in the geometry (zero is the node where the recursion started).

Definition at line 38 of file TRecurseGeoManager.hxx.

38  {
39  TGeoNode* node = gGeoManager->GetCurrentNode();
40  TGeoExtension* extension;
41  extension = node->GetUserExtension();
42  if (extension) {
43  std::cout << "Have node user extension " << node->GetName()
44  << " depth " << depth
45  << std::endl;
46  }
47  extension = node->GetFWExtension();
48  if (extension) {
49  std::cout << "Have node FW extension " << node->GetName()
50  << " depth " << depth
51  << std::endl;
52  }
53  TGeoVolume* volume = node->GetVolume();
54  extension = volume->GetUserExtension();
55  if (extension) {
56  std::cout << "Have volume user extension " << volume->GetName()
57  << " depth " << depth
58  << std::endl;
59  }
60  extension = volume->GetFWExtension();
61  if (extension) {
62  std::cout << "Have volume FW extension " << volume->GetName()
63  << " depth " << depth
64  << std::endl;
65  }
66  return true;
67  }
static const std::string volume[nvol]
QTextStream & endl(QTextStream &s)
bool TRecurseGeoManager::Apply ( int  depth = 0)
inline

Apply the action recursively to every node starting with the current node (depth first).

Definition at line 15 of file TRecurseGeoManager.hxx.

15  {
16  TGeoNode * node = gGeoManager->GetCurrentNode();
17  if (!Action(depth)) {
18  gGeoManager->CdUp();
19  return false;
20  }
21 
22  for (int i=0; i< node->GetNdaughters(); ++i) {
23  gGeoManager->CdDown(i);
24  if (!Apply(depth+1)) {
25  gGeoManager->CdUp();
26  return false;
27  }
28  }
29 
30  gGeoManager->CdUp();
31  return true;
32  }
virtual bool Action(int depth)
bool Apply(int depth=0)

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