3 #include "TGeoManager.h"
4 #include "TGeoVolume.h"
8 void CollectVolumes(TGeoNode *theDetector, TObjArray &logical_stored, TObjArray &phycical_stored)
11 TGeoVolume *alogical = theDetector->GetVolume(); TGeoNode *aphysical = 0x0; Bool_t in_the_list;
14 for (
size_t i = 0; i < phycical_stored.GetEntries() ; i++) {
15 if ( aphysical == phycical_stored[i] ) {
21 phycical_stored.Add(theDetector);
24 for (
size_t i = 0; i < logical_stored.GetEntries() ; i++) {
25 if ( alogical == logical_stored[i] ) {
31 logical_stored.Add(alogical);
35 for (
size_t i = 0; i < alogical->GetNdaughters(); i++) {
36 aphysical = alogical->GetNode(i);
42 TGeoVolume *
ShowDetector(
const char *basename =
"DetectorFactory/Scintillators/CParisPW_2", Option_t *opt_draw =
"ogl")
44 TString detname, fullname; TObjArray logical_stored; TObjArray phycical_stored;
48 cout << fullname << endl;
50 TGeoManager::Import(fullname.Data()); world = gGeoManager->GetTopVolume();
53 std::cout <<
"\n ***** The detector " << basename <<
" has not been found in the factory ! ***** " << std::endl;
58 CollectVolumes(gGeoManager->GetTopNode(),logical_stored,phycical_stored);
60 fullname = basename; fullname +=
".amap"; std::ifstream amap(fullname.Data());
61 if ( amap.is_open() ) {
63 std::string touchable, aline;
67 while ( amap.good() ) {
69 istringstream decode(aline); TString vname, key_sd, sd, key_color; Float_t r,g,b,a;
81 for (
size_t i = 0; i < logical_stored.GetEntries(); i++) {
82 TString tmp = logical_stored[i]->GetName();
84 cout <<
" **** Set Attributes to: " << tmp <<
" using " << aline << endl;
86 TGeoVolume *alogical = (TGeoVolume *)logical_stored[i];
88 alogical->SetFillColor( TColor::GetColor(r,g,b) );
89 alogical->SetLineColor( TColor::GetColor(r,g,b) );
90 alogical->SetTransparency(100*(1-a));
98 if ( opt_draw !=
"-" ) {
99 world->Draw(opt_draw);
101 gGeoManager->SetVisOption(0);
107 void ShowInEve(
const char *basename =
"DetectorFactory/Scintillators/CParisPW_2")
109 TEveManager::Create();
112 TEveGeoTopNode* inn =
new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode());
113 gEve->AddGlobalElement(inn);
115 gEve->FullRedraw3D(kTRUE);
119 TGLViewer *v = gEve->GetDefaultGLViewer();
120 v->GetClipSet()->SetClipType(1);
121 v->RefreshPadEditor(v);
123 v->CurrentCamera().RotateRad(-.7, 0.5);
136 gSystem->Rename(t1.Data(),t2.Data());
141 gSystem->Rename(t1.Data(),t2.Data());
146 gSystem->Rename(t1.Data(),t2.Data());
void CollectVolumes(TGeoNode *theDetector, TObjArray &logical_stored, TObjArray &phycical_stored)
From the Full geometry, extract the logical and physical [nodes] volumes.
TGeoVolume * ShowDetector(const char *basename="DetectorFactory/Scintillators/CParisPW_2", Option_t *opt_draw="ogl")
Read the detector in the factory and show it in open GL window.
void ShowInEve(const char *basename="DetectorFactory/Scintillators/CParisPW_2")
Read the detector in the factory and show it in Eve.
void RenameSToGSDetector(const char *from, const char *to)
rename the three files