Belle II Software  release-05-02-19
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 18 of file EveGeometry.h.

18  {
19  c_Full,
21  };

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 98 of file EveGeometry.cc.

99 {
100  TPRegexp reAll(".*");
101  bool onlyChildren = false;
102  std::string regexp = pattern;
103 
104  // For patterns with leading '#', do delete only
105  // children elements (and remove the '#' for regexp)
106  if (pattern.substr(0, 1) == std::string("#")) {
107  regexp = pattern.substr(1);
108  onlyChildren = true;
109  }
110 
111  TPRegexp reMatch(regexp.c_str());
112 
113  std::list<TEveElement*> children;
114  parent->FindChildren(children, reAll);
115 
116  for (TEveElement* child : children) {
117  if (reMatch.MatchB(child->GetElementName())) {
118  if (onlyChildren) {
119  B2INFO("Removing children of " << child->GetElementName());
120  child->DestroyElements();
121  } else {
122  B2INFO("Removing " << child->GetElementName());
123  child->Destroy();
124  }
125  } else {
126  removeChildrenByRegExp(child, pattern);
127  }
128  }
129 }

◆ 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 194 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 220 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 215 of file EveGeometry.cc.

Belle2::EveGeometry::c_Simplified
@ c_Simplified
a simplified Belle II geometry.
Definition: EveGeometry.h:20
Belle2::EveGeometry::removeChildrenByRegExp
void removeChildrenByRegExp(TEveElement *parent, const std::string &pattern)
Recursive removal of volumes based on regular expression pattern.
Definition: EveGeometry.cc:98
Belle2::EveGeometry::c_Full
@ c_Full
Full geometry converted from Geant4 (use this for non-standard Belle II setups!).
Definition: EveGeometry.h:19