Dear all,
I am having a problem in visualizing some volumes with Eve. I have the geometry file and the macro to open and inspect it, but I can see only some Volumes and others are not visible.
See for example the screenshot available here:
I have a DetBox->DetCage->6 layers + cushion, and each layer contains many tubes. I can only see the cushion (?).
You can find the geometry file and the macro to access it and visualize it here:
https://www.dropbox.com/s/kydilga71cb5o3d/muCastorApparatus_2020-06-05-12-24-29_0.root?dl=0 (17 kB)
https://www.dropbox.com/s/y3ysqrgr6gg8033/checkGeo.C?dl=0
(simply root checkGeo.C)
The code (checkGeo.C to access and view the geometry with TEve) is also reported here below.
Thank you.
Best, Germano
_ROOT Version: 6.16
_Platform: Mac OSX
_Compiler: default
#include <Riostream.h>
#include <iostream>
#include "TEveManager.h"
#include "TEveGeoNode.h"
#include "TGeoManager.h"
#include "TGeoNode.h"
#include "TGeoVolume.h"
#include "TGeoMedium.h"
#include <TFile.h>
#include <vector>
Bool_t makeGeo(Int_t);
void checkGeo(Int_t runNumber=0)
{
/******************************************************************************/
// CHECKING THE GEOMETRY
/******************************************************************************/
// Getting the geometry from output file
//-----------------------------------------------------------------------------
TEveManager::Create();
///< Building the simple "gentle" geometry (and saving into a "new" file)
Bool_t geo = makeGeo(runNumber);
if(!geo) {
cout << "checkGeo --> could not make geometry - please check file name/run number" << endl;
return;
}
///< Reading "gentle" geometry file generated with makeGeo
ostringstream gEveGeoInput;
gEveGeoInput << "output/muCastorEveApparatus-" << runNumber << ".root";
TFile* geom = TFile::Open(gEveGeoInput.str().c_str());
TIter next(gDirectory->GetListOfKeys());
TKey* key;
TString shape("TEveGeoShapeExtract");
while ((key = (TKey*) next())){
if (shape == key->GetClassName())
{
TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) key->ReadObj();
TEveGeoShape* gGeomGentle = TEveGeoShape::ImportShapeExtract(gse, 0);
gEve->AddGlobalElement(gGeomGentle);
}
}
// Getting the volume of interest
// Visualization
TEveElement* top = gEve->GetCurrentEvent();
gEve->FullRedraw3D(kTRUE, kTRUE);
}
Bool_t makeGeo(Int_t runNumber=0) {
/*****************************************************************************************/
// MAKING SIMPLE GEOMETRY
/*****************************************************************************************/
//-----------------------------------------------------------------------------------------
// Getting the geometry from output file and making the gentle geometry (symple geometry)
//-----------------------------------------------------------------------------------------
gSystem->Load("libGeom");
// to run after 03/03/2016 (run with time-Nrun information)
std::ostringstream sgeo;
sgeo << "ls output/muCastorApparatus_*_" << runNumber << ".root";
TString file_name(gSystem->GetFromPipe(sgeo.str().c_str()));
string sfile = file_name.Data();
if(strcmp(sfile.c_str(),"")==0) {
cout << "Please check presence of file " << runNumber << endl;
return false;
}
gGeoManager = TGeoManager::Import(file_name);
ostringstream gEveGeoOutput;
gEveGeoOutput << "output/muCastorEveApparatus-" << runNumber << ".root";
gGeoManager->CheckOverlaps(0.01);
gGeoManager->PrintOverlaps();
TGeoNode* topNode = gGeoManager->GetTopNode();
TEveGeoTopNode* eveTopNode = new TEveGeoTopNode(gGeoManager, topNode);
// eveTopNode->SetVisOption(0);
// eveTopNode->SetVisLevel(6);
// eveTopNode->GetNode()->GetVolume()->SetVisibility(kFALSE);
gEve->AddElement(eveTopNode);
//gEve->Redraw3D(kTRUE); // Reset camera after the first event has been shown.
eveTopNode->ExpandIntoListTreesRecursively();
eveTopNode->SaveExtract(gEveGeoOutput.str().c_str(),"Gentle",kTRUE);
gEve->GetCurrentEvent()->DestroyElements();
return true;
}