GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » shape of a volume
icon5.gif  shape of a volume [message #11303] Mon, 13 December 2010 11:49 Go to next message
Olaf Hartmann is currently offline  Olaf Hartmann
Messages: 105
Registered: December 2003
Location: Wien-Alsergrund
continuous participant
From: *smi.oeaw.ac.at
Hi all,

I see a somewhat strange behaviour from the following lines of code:

if (!gGeoManager) GetGeoManager();
TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
TGeoShape* actShape = actVolume->GetShape();
const char* fShapeName = actShape->GetName();

cout << "Volume is " << fShapeName << endl;


Instead of the shape name I get always the volume name in the output. Interactively, at the ROOT prompt, it works:

Quote:

root [1] TGeoVolume* actVolume = gGeoManager->GetVolume("FscAbsorber")
root [2] TGeoShape* actShape = actVolume->GetShape();
root [3] actShape->GetName();
root [4] actShape->GetName()
(const char* 0x2cfa898)"TGeoBBox"


I wonder how to get the shape name inside the code?

Cheers
Olaf.



Re: problem gone [message #11306 is a reply to message #11303] Mon, 13 December 2010 15:44 Go to previous messageGo to next message
Olaf Hartmann is currently offline  Olaf Hartmann
Messages: 105
Registered: December 2003
Location: Wien-Alsergrund
continuous participant
From: *smi.oeaw.ac.at
The problem is gone. I don't know why since I did not change the code ... Confused
Re: shape of a volume - always TGeoBBox ? [message #11308 is a reply to message #11303] Mon, 13 December 2010 16:39 Go to previous messageGo to next message
Olaf Hartmann is currently offline  Olaf Hartmann
Messages: 105
Registered: December 2003
Location: Wien-Alsergrund
continuous participant
From: *smi.oeaw.ac.at
Dear all,

I just realized that asking the GeoManager about the shape of a volume he always answers TGeoBBox, which is a bounding box of each of the volumes, even if they're originally of type e.g. TGeoTube.

Quote:

root [2] gGeoManager->GetVolume(1211)->GetShape()->InspectShape()
*** Shape stt01wire1880: TGeoTube ***
Rmin = 0.00000
Rmax = 0.00100
dz = 31.80215
Bounding box:
*** Shape stt01wire1880: TGeoBBox ***
dX = 0.00100
dY = 0.00100
dZ = 31.80215
origin: x= 0.00000 y= 0.00000 z= 0.00000



As I wrote in the earlier mail, I tried to access the dimensions of the physical volumes:

   TGeoVolume* actVolume = gGeoManager->GetVolume(fVolumeID);
TGeoShape* actShape = actVolume->GetShape();
const char* fShapeName = actShape->GetName();


fShapeName is always TGeoBBox. How can I arrive to the underlying shape (e.g. TGeoTube) ?

Cheers
Olaf.


Re: shape of a volume - always TGeoBBox ? [message #11309 is a reply to message #11308] Mon, 13 December 2010 16:53 Go to previous messageGo to next message
Lia Lavezzi
Messages: 291
Registered: May 2007
Location: Torino
first-grade participant

From: *pv.infn.it
Hi Olaf,
in stt/PndSttMapCreator.cxx I retrieve the geometry of the TGeoTube, but the very starting point is the list of FairGeoNodes from the PndGeoSttPar...
The code does:
FairGeoNode *pnode = (FairGeoNode*) geoPassNodes->FindObject(tubename);
...
TGeoVolume* rootvol = pnode->getRootVolume();
TGeoTube *tube = (TGeoTube*) rootvol->GetShape();

...I don' t know if this may be helpful...
Lia.
Re: shape of a volume - always TGeoBBox ? [message #11311 is a reply to message #11309] Mon, 13 December 2010 17:09 Go to previous messageGo to next message
Olaf Hartmann is currently offline  Olaf Hartmann
Messages: 105
Registered: December 2003
Location: Wien-Alsergrund
continuous participant
From: *smi.oeaw.ac.at
Ciao Lia,

Lia Lavezzi wrote on Mon, 13 December 2010 16:53

Hi Olaf,
in stt/PndSttMapCreator.cxx I retrieve the geometry of the TGeoTube, but the very starting point is the list of FairGeoNodes from the PndGeoSttPar...
The code does:
FairGeoNode *pnode = (FairGeoNode*) geoPassNodes->FindObject(tubename);
...
TGeoVolume* rootvol = pnode->getRootVolume();
TGeoTube *tube = (TGeoTube*) rootvol->GetShape();

...I don' t know if this may be helpful...
Lia.


As I read, this is specific for STT (I need something general) ... and in your example it seems that you already know that you're looking for a tube. So I wonder if

TGeoVolume* rootvol = pnode->getRootVolume();
TGeoShape* volshape = rootvol->GetShape();

would work in your case, giving TGeoTube as shape name?

Thanks
Olaf.
Re: shape of a volume - always TGeoBBox ? [message #11312 is a reply to message #11311] Mon, 13 December 2010 17:34 Go to previous message
Lia Lavezzi
Messages: 291
Registered: May 2007
Location: Torino
first-grade participant

From: *pv.infn.it
Quote:

As I read, this is specific for STT (I need something general)

Yes, this was written for the tubes, but also the other detectors fill the passive/active node list... maybe it could be generalized.

Quote:

... and in your example it seems that you already know that you're looking for a tube. So I wonder if
TGeoVolume* rootvol = pnode->getRootVolume();
TGeoShape* volshape = rootvol->GetShape();
would work in your case, giving TGeoTube as shape name?

No, I just tried and it gives me "stt01tube", but InspectShape works and recognizes it as a TGeoTube.
Ciao,
Lia.
Previous Topic: Implementation of PndGemMCPoint::SetSensorId(int) is missing
Next Topic: macro/param/*.root for Fwd EMC
Goto Forum:
  


Current Time: Wed Dec 08 11:30:00 CET 2021

Total time taken to generate the page: 0.02147 seconds