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)
120 *matrix *= *(nodes[
i]->GetNode()->GetMatrix());
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() );
144 extract.SetShape( (TGeoShape *)
get_shape(element)->Clone() );
145 extract.SetTrans(
trans.Array() );
146 extract.SetRnrSelf(
true );
147 extract.SetRnrElements(
true );
149 TEveGeoShape *
clone = TEveGeoShape::ImportShapeExtract( &extract, parent );
160 element->SetMainColor( color );
161 if (alpha > 1.) alpha = 1.;
162 if (alpha < 0.) alpha = 0.;
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");
const char * get_title(const TEveElement *element)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void show_tracker_endcap(TEveElement *tracker)
void hide_tracker_endcap(TEveElement *tracker)
const TGeoShape * get_shape(const TEveElement *element)
void set_children_visibility(TEveElement *element, const std::string &node_name, const std::vector< std::string > &children_name, bool visibility)
void set_tracker_endcap_visibility(TEveElement *tracker, bool visibility)
void set_color(TEveElement *element, Color_t color, float alpha, unsigned int levels)
TGeoMatrix * get_transform(const TEveElement *element)
int extract(std::vector< int > *output, const std::string &dati)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
void expand_node(TEveElement *element)
const char * get_name(const TEveElement *element)
tuple size
Write out results.
bool is_leaf_node(const TEveElement *element)