6 #include <TEveElement.h>
7 #include <TEveGeoNode.h>
13 const char*
get_name(
const TEveElement * element ) {
15 if (
const TEveGeoNode * node = dynamic_cast<const TEveGeoNode *>( element ))
16 return node->GetName();
17 if (
const TEveGeoShape * shape = dynamic_cast<const TEveGeoShape *>( element ))
18 return shape->GetName();
21 if (
const TNamed * named = dynamic_cast<const TNamed *>( element ))
22 return named->GetName();
28 const char*
get_title(
const TEveElement * element ) {
30 if (
const TEveGeoNode * node = dynamic_cast<const TEveGeoNode *>( element ))
31 return node->GetTitle();
32 if (
const TEveGeoShape * shape = dynamic_cast<const TEveGeoShape *>( element ))
33 return shape->GetTitle();
36 if (
const TNamed * named = dynamic_cast<const TNamed *>( element ))
37 return named->GetTitle();
46 if (TEveGeoNode * node = dynamic_cast<TEveGeoNode *>( element )) {
47 if (node->GetNChildren() == 0 && node->GetNode()->GetVolume()->GetNdaughters() > 0) {
48 TIter
next(node->GetNode()->GetVolume()->GetNodes());
50 while ((dnode = (TGeoNode*)
next()) != 0) {
51 TEveGeoNode* node_re =
new TEveGeoNode(dnode);
52 node->AddElement(node_re);
66 const TGeoShape *
get_shape(
const TEveElement * element ) {
68 if (
const TEveGeoNode * node = dynamic_cast<const TEveGeoNode *>( element )) {
69 return node->GetNode()->GetVolume()->GetShape();
72 if (
const TEveGeoShape * shape = dynamic_cast<const TEveGeoShape *>( element )) {
73 TEveGeoShape * nc_shape = const_cast<TEveGeoShape *>( shape );
74 return const_cast<const TGeoShape *>( nc_shape->GetShape() );
87 if (TEveGeoShape * shape = dynamic_cast<TEveGeoShape *>( element )) {
88 return shape->GetShape();
96 if (
const TEveGeoNode * node = dynamic_cast<const TEveGeoNode *>( element )) {
99 std::vector< const TEveGeoNode * >
nodes;
100 const TEveGeoTopNode * top = 0;
102 while ((top = dynamic_cast<const TEveGeoTopNode *>( node )) == 0) {
104 nodes.push_back(node);
107 TEveGeoNode * nc_node = const_cast<TEveGeoNode *>( node );
108 if (nc_node->BeginParents() == nc_node->EndParents())
112 node = dynamic_cast<const TEveGeoNode *>( * nc_node->BeginParents() );
117 TGeoHMatrix *
matrix =
new TGeoHMatrix();
118 (const_cast<TEveGeoTopNode *>(top))->RefGlobalTrans().SetGeoHMatrix( *
matrix );
119 for (
unsigned int i = 0;
i <
nodes.size(); ++
i)
124 if (
const TEveGeoShape * shape = dynamic_cast<const TEveGeoShape *>( element )) {
126 TGeoHMatrix *
matrix =
new TGeoHMatrix();
127 (const_cast<TEveGeoShape *>(shape))->RefHMTrans().SetGeoHMatrix( *
matrix );
135 TEveGeoShape *
clone(
const TEveElement * element, TEveElement *
parent )
140 shape->SetTransMatrix(
matrix.get() );
145 extract.SetTrans( trans.Array() );
147 extract.SetRnrElements(
true );
160 element->SetMainColor( color );
163 unsigned char transparency = (
unsigned char) roundf(100. - (
alpha * 100.));
164 element->SetMainTransparency( transparency );
169 for (std::list<TEveElement*>::iterator
i = element->BeginChildren();
i != element->EndChildren(); ++
i)
173 element->ElementChanged(
true,
true);
180 if (
const TEveGeoNode * node = dynamic_cast<const TEveGeoNode *>( element )) {
181 return ((node->GetNChildren() == 0) and (node->GetNode()->GetVolume()->GetNdaughters() == 0));
184 if (
const TEveGeoShape * shape = dynamic_cast<const TEveGeoShape *>( element )) {
185 return (shape->GetNChildren() == 0);
188 return (element->GetNChildren() == 0);
197 if (not
name or strncmp(
name, node_name.c_str(), node_name.size()))
201 for (std::list<TEveElement *>::iterator
j = element->BeginChildren();
j != element->EndChildren(); ++
j) {
208 for (
unsigned int i = 0;
i < children_name.size(); ++
i)
209 if (not strncmp(
name, children_name[
i].c_str(), children_name[
i].
size())) {
212 child->SetRnrSelf( visibility );
213 child->SetRnrChildren(
false );
215 child->SetRnrSelf(
false );
216 child->SetRnrChildren( visibility );
222 element->ElementChanged(
true,
true);
228 std::vector<std::string>
endcap;
229 endcap.push_back(
"tec:TEC");
230 endcap.push_back(
"tidf:TIDF");
231 endcap.push_back(
"tidb:TIDB");
232 endcap.push_back(
"pixfwd:PixelForwardZPlus");
233 endcap.push_back(
"pixfwd:PixelForwardZMinus");