// EveExperiments.cpp : Defines the entry point for the console application. // #include "stdafx.h" //void hddsroot(); bool gMakeEveExtract = false; void exctract_geometry() { TGeoManager::Import("halld_geometry.root"); gGeoManager->DefaultColors(); TRint *app = new TRint("App", 0, 0); TEveManager::Create(kFALSE); TEveGeoTopNode* en = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode()); gEve->AddGlobalElement(en); //gEve->Redraw3D(kTRUE); app->Run(kTRUE); en->ExpandIntoListTreesRecursively(); en->SaveExtract("halld_geometry_extract.root", "halld_geometry_extract", kFALSE); TEveManager::Terminate(); app->Terminate(0); return; } void do_through_geometry() { TGeoManager::Import("halld_geometry.root"); gGeoManager->DefaultColors(); TRint *app = new TRint("App", 0, 0); TEveManager::Create(kTRUE); TEveGeoTopNode* en = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode()); gEve->AddGlobalElement(en); en->ExpandIntoListTreesRecursively(); //en->SaveExtract("halld_geometry_extract.root", "halld_geometry_extract", kFALSE); gEve->Redraw3D(); app->Run(kTRUE); TEveManager::Terminate(); app->Terminate(0); return; } int main(int argc, char** argv) { // Easy-mode std::vector args(argv, argv+argc); for (size_t i = 1; i < args.size(); ++i) { if(args[i]=="--extract") { exctract_geometry(); return 0; } } //do_through_geometry(); return 0; //TGeoManager::Import("halld_geometry.root"); //gGeoManager->DefaultColors(); TRint *app = new TRint("App", &argc, argv); TEveManager::Create(); TEveViewer *viewer = gEve->SpawnNewViewer("Projections"); // scene TEveScene* scene = gEve->SpawnNewScene("Projected Geom"); viewer->AddScene(scene); TGLViewer* pgv = viewer->GetGLViewer(); pgv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); TEveProjectionManager* mng = new TEveProjectionManager(); mng->SetProjection(TEveProjection::kPT_RPhi); scene->AddElement(mng); TEveProjectionAxes* axes = new TEveProjectionAxes(mng); scene->AddElement(axes); gEve->AddToListTree(axes, kTRUE); gEve->AddToListTree(mng, kTRUE); //gEve->GetDefaultViewer()->SetElementName("3D View"); //TEveGeoTopNode* en = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode()); //en->SetVisLevel(4); //en->GetNode()->GetVolume()->SetVisibility(kFALSE); //gEve->AddGlobalElement(en); //gEve->Redraw3D(kTRUE); //app->Run(kTRUE); TFile* geom = TFile::Open("halld_geometry_extract.root", "CACHEREAD"); if (!geom) return 1; TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) geom->Get("halld_geometry_extract"); TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0); geom->Close(); delete geom; gEve->AddGlobalElement(gsre); mng->ImportElements(gsre); TEveLine* line = new TEveLine(); line->SetMainColor(kGreen); for (Int_t i=0; i<160; ++i) line->SetNextPoint(40*sin(0.2*i), 40*cos(0.2*i), 180-i); gEve->AddElement(line); mng->ImportElements(line); line->SetRnrSelf(kFALSE); gEve->Redraw3D(kTRUE); app->Run(kTRUE); if (gEve && gEve->GetBrowser()) gEve->GetBrowser()->UnmapWindow(); TEveManager::Terminate(); app->Terminate(0); return 0; }