Belle II Software  release-08-01-10
Belle2::EveGeometry Namespace Reference

Handles manipulation of detector geometry for the display. More...

Enumerations

enum  EType {
  c_Full ,
  c_Simplified
}
 Type of geometry shown. More...
 

Functions

void addGeometry (EType visMode)
 Add TGeo geometry to Eve (only needs to be done once.)
 
void setVisualisationMode (EType visMode)
 switch to given visualisation mode.
 
void enableVolume (const char *name, bool only_daughters=false, bool enable=true)
 enable/disable rendering of the volume 'name', or only its daughters if only_daughters is set.
 
void disableVolume (const char *name, bool only_daughters=false)
 disable rendering of the volume 'name', or only its daughters if only_daughters is set.
 
void setVolumeColor (const char *name, Color_t col)
 set fill color of the volume 'name' to 'col'.
 
void setTransparency (int percent)
 Recursively set transparency of geometry (0: opaque, 100: fully transparent).
 
double getMaxR ()
 find a point that is inside the top node.
 
void saveExtract ()
 Save a geometry extract from the current state of the TGeo geometry. More...
 
void setCustomExtractPath (const std::string &extractPath)
 Set custom path to the geometry extract (to change originally hard-coded value)
 
void setHideVolumes (const std::vector< std::string > &volumes)
 List of volumes to be hidden (can be re-enabled in Eve panel / Geometry scene. More...
 
void setDeleteVolumes (const std::vector< std::string > &volumes)
 List of volumes to be removed. More...
 
void removeChildrenByRegExp (TEveElement *parent, const std::string &pattern)
 Recursive removal of volumes based on regular expression pattern. More...
 

Detailed Description

Handles manipulation of detector geometry for the display.

Enumeration Type Documentation

◆ EType

enum EType

Type of geometry shown.

Enumerator
c_Full 

Full geometry converted from Geant4 (use this for non-standard Belle II setups!).

c_Simplified 

a simplified Belle II geometry.

Definition at line 25 of file EveGeometry.h.

25  {
26  c_Full,
28  };
@ c_Full
Full geometry converted from Geant4 (use this for non-standard Belle II setups!).
Definition: EveGeometry.h:26
@ c_Simplified
a simplified Belle II geometry.
Definition: EveGeometry.h:27

Function Documentation

◆ removeChildrenByRegExp()

void removeChildrenByRegExp ( TEveElement *  parent,
const std::string &  pattern 
)

Recursive removal of volumes based on regular expression pattern.

Leading '#' switches to removal of daughter only.

Definition at line 106 of file EveGeometry.cc.

107 {
108  TPRegexp reAll(".*");
109  bool onlyChildren = false;
110  std::string regexp = pattern;
111 
112  // For patterns with leading '#', do delete only
113  // children elements (and remove the '#' for regexp)
114  if (pattern.substr(0, 1) == std::string("#")) {
115  regexp = pattern.substr(1);
116  onlyChildren = true;
117  }
118 
119  TPRegexp reMatch(regexp.c_str());
120 
121  std::list<TEveElement*> children;
122  parent->FindChildren(children, reAll);
123 
124  for (TEveElement* child : children) {
125  if (reMatch.MatchB(child->GetElementName())) {
126  if (onlyChildren) {
127  B2INFO("Removing children of " << child->GetElementName());
128  child->DestroyElements();
129  } else {
130  B2INFO("Removing " << child->GetElementName());
131  child->Destroy();
132  }
133  } else {
134  removeChildrenByRegExp(child, pattern);
135  }
136  }
137 }
void removeChildrenByRegExp(TEveElement *parent, const std::string &pattern)
Recursive removal of volumes based on regular expression pattern.
Definition: EveGeometry.cc:106

◆ saveExtract()

void saveExtract ( )

Save a geometry extract from the current state of the TGeo geometry.

To actually create a reasonably sized extract, one needs to delete all objects in Top_1 that one doesn't want to save. Selecting them via their name and deleting them in a function should work, but really just crashes. This is all quite horrible, really.

Definition at line 202 of file EveGeometry.cc.

◆ setDeleteVolumes()

void setDeleteVolumes ( const std::vector< std::string > &  volumes)

List of volumes to be removed.

The volume and all its daughters will be deleted. Leading '#' switches to removal of daughter only.

Definition at line 228 of file EveGeometry.cc.

◆ setHideVolumes()

void setHideVolumes ( const std::vector< std::string > &  volumes)

List of volumes to be hidden (can be re-enabled in Eve panel / Geometry scene.

The volume and all its daughters will be hidden.

Definition at line 223 of file EveGeometry.cc.