Geometry Package & GDML

HI Andrei,

Thanks for your help! :slight_smile:

Here’s a screenshot of it working:


void worldDraw() {
    gSystem->Load("libGeom");
    gSystem->Load("libGdml");
    TGeoManager *geom = TGeoManager::Import("world.gdml");
    TGeoMaterial *mat = geom->GetMaterial("Vacuum");
    mat->SetTransparency( 50 );
    TGeoVolume *top = gGeoManager->GetTopVolume();
    top->SetLineColor( kRed );
    geom->SetTopVisible();
    TGeoVolume *box =  geom->GetVolume("Box");
    box->SetLineColor( kGreen );
    top->Draw("ogl");
}

Some more questions:

:question: Is there a way to parse a GDML file so that you don’t have to know the names of the materials and volumes in order to Get() them? I’d like to be able to read an arbitrary GDML file and display the contents.
:question: How do IDs work?

:question: Could you preserve settings like transparency and colour to do with displaying the contents of a GDML file by writing them to a data file that could be parsed by ROOT? e.g.

-- file "world.dat" --
transparency "Vacuum" 50
lineColor "Top" kRed
lineColor "Box" kGreen
-- end "world.dat" --

:bulb: Perhaps an XML file? (I guess it would make sense to have it look similar to GDML)

<?xml version="1.0">
<data>
	<materials>
		<material name="Vacuum">
			<transparency value="50"/>
		</material>
	</materials>
	<structure>
	<volume name="Top">
			<lineColor value="kRed">
		</volume>
		<volume name="Box">
			<lineColor value="kGreen">
		</volume>
	</structure>
</data>

Thanks,
Peter
:smiley: