Hello,
I’m trying to access the (x,y,z) origins for the (shapes of) volumes in a geometry. I think I’m able to do this successfully, but it is telling me that the origins of each volume is at the origin (0,0,0) (I believe that this should be relative to the top volume) when I know that isn’t true. Specifically:
gSystem->Load("libGeom")
TGeoManager *geo = new TGeoManager()
geo->Import("SingleCube.gdml")
TGeoVolume *top = geo->GetTopVolume()
TObjArray *volumes = geo->GetListOfVolumes()
Int_t nvolumes = volumes->GetEntries()
TGeoVolume *V = NULL
for (int i = 0; i<nvolumes;i++){
if ((V == top) == 0){
V = NULL;
V = (TGeoVolume*)volumes->At(i);
top->AddNode(V,1);
}
}
top->Draw()
And accessing all the volumes at once with volumes->Print()
I get
== Volume: volFieldcage type TGeoVolume positioned 2 times
*** Shape Fieldcage_shape: TGeoBBox ***
dX = 15.87937
dY = 17.00110
dZ = 16.34617
origin: x= 0.00000 y= 0.00000 z= 0.00000
Mixture G10 Aeff=23.7663 Zeff=11.6305 rho=1.85 radlen=14.0429 intlen=51.5075 index=71
Element #0 : C Z= 6.00 A= 12.01 w= 0.158
Element #1 : H Z= 1.00 A= 1.01 w= 0.013
Element #2 : O Z= 8.00 A= 16.00 w= 0.388
Element #3 : Al Z= 13.00 A= 26.98 w= 0.016
== Volume: volSingleCube type TGeoVolume positioned 1 times
*** Shape SingleCube: TGeoBBox ***
dX = 15.87937
dY = 17.00110
dZ = 16.34617
origin: x= 0.00000 y= 0.00000 z= 0.00000
Mixture G10 Aeff=23.7663 Zeff=11.6305 rho=1.85 radlen=14.0429 intlen=51.5075 index=71
Element #0 : C Z= 6.00 A= 12.01 w= 0.158
Element #1 : H Z= 1.00 A= 1.01 w= 0.013
Element #2 : O Z= 8.00 A= 16.00 w= 0.388
Element #3 : Al Z= 13.00 A= 26.98 w= 0.016
To just display a few. The other volumes all give an origin of (0,0,0). But I know this shouldn’t be so because the geometry should look like
But when I run the above script and draw the volumes, I get:
So clearly all the volumes have origins at (0,0,0), when they shouldn’t. Am I doing this incorrectly? I want to be able to, for instance, put all the volumes into a ROOT file to open in a different session. So here, my test is to make sure the origins are correct when I draw the volumes. Any help is greatly appreciated!
Please read tips for efficient and successful posting and posting code
_ROOT Version: 6.12/06
_Platform: Linux
Compiler: Not Provided