24 #include <TGeoShape.h>
25 #include <TGeoVolume.h>
26 #include <TGeoManager.h>
27 #include <TGeoShapeAssembly.h>
29 #include <TEveGeoShape.h>
30 #include <TEveGeoNode.h>
31 #include <TEveElement.h>
32 #include <TEveTrans.h>
39 for(TEveElementList::List_i i=l->BeginChildren(); i!=l->EndChildren(); ++i) {
40 (*i)->SetRnrChildren(b);
46 l->SetRnrSelfChildren(b,b);
47 for(TEveElementList::List_i i=l->BeginChildren(); i!=l->EndChildren(); ++i) {
51 else e->SetRnrSelfChildren(b,b);
61 else if ( level == 1 ) {
63 lst->SetRnrSelf(
true);
65 else if ( level == 0 ) {
66 lst->SetRnrSelf(visible);
70 lst->SetRnrSelf(visible);
74 std::pair<bool,TEveElement*>
79 const TGeoHMatrix& mat,
80 const std::string& nam)
82 TGeoVolume* vol = n ? n->GetVolume() : 0;
85 if ( 0 == vol || level > max_level )
return std::make_pair(
created,(TEveElement*)0);
88 TGeoShape* geoShape = vol->GetShape();
89 TEveElement* element = 0;
92 TGeoNode* pn = (TGeoNode*)p->GetUserData();
97 element = (TEveGeoShape*)p->FindChild(n->GetName());
99 if ( !element && !nam.empty() ) {
100 element = (TEveGeoShape*)p->FindChild(nam.c_str());
102 if ( element )
goto Daughters;
105 if ( geoShape->IsA() == TGeoShapeAssembly::Class() ) {
108 shape->SetUserData(n);
109 shape->SetMainTransparency(
true);
110 shape->SetMainAlpha(0.2);
111 shape->SetPickable(kTRUE);
113 float red, green, blue;
114 vis.
rgb(red, green, blue);
115 shape->SetMainColorRGB(red, green, blue);
121 else if ( 0 == element ) {
122 TEveGeoShape* shape =
new TEveGeoShape(n->GetName());
127 float red, green, blue;
128 vis.
rgb(red, green, blue);
129 shape->SetMainColorRGB(red, green, blue);
131 shape->SetMainTransparency(
true);
132 shape->SetMainAlpha(0.2);
133 shape->SetPickable(kTRUE);
134 shape->RefMainTrans().SetFrom(mat);
135 shape->SetShape((TGeoShape*)geoShape->Clone());
136 if ( level < max_level ) {
137 shape->SetRnrSelfChildren(
true,
true);
139 else if ( level == max_level ) {
140 shape->SetRnrSelfChildren(
true,
false);
142 else if ( level > max_level ) {
143 shape->SetRnrSelfChildren(
false,
false);
145 shape->SetUserData(n);
150 for (Int_t idau = 0, ndau = n->GetNdaughters(); idau < ndau; ++idau) {
151 TGeoNode* daughter = n->GetDaughter(idau);
152 TGeoHMatrix dau_mat(mat);
153 TGeoMatrix* matrix = daughter->GetMatrix();
154 dau_mat.Multiply(matrix);
155 std::pair<bool,TEveElement*> dau_shape =
156 createEveShape(level+1, max_level, element, daughter, dau_mat, daughter->GetName());
157 if ( dau_shape.first ) {
158 element->AddElement(dau_shape.second);
161 return std::make_pair(
created,element);
165 if ( p == n )
return 1;
167 for (Int_t idau = 0, ndau = p->GetNdaughters(); idau < ndau; ++idau) {
169 TGeoNode* daughter = p->GetDaughter(idau);
170 TGeoHMatrix* daughter_matrix = 0;
172 TGeoMatrix* matrix = daughter->GetMatrix();
174 dau_mat.Multiply(matrix);
175 daughter_matrix = &dau_mat;
183 if ( mat ) *mat = *daughter_matrix;
191 if ( !strstr(de.
name(),
"BeamCal") ) {
194 TGeoNode* n = pv.
ptr();
195 TGeoMatrix* matrix = n->GetMatrix();
196 std::pair<bool,TEveElement*> e =
createEveShape(0, levels, parent, n, *matrix, de.
name());
199 list->SetName(de.
name());
204 return std::make_pair(
false,(TEveGeoShape*)0);