Message: Re: Getting Volume name from position co-ordinate Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Getting Volume name from position co-ordinate 

Forum: Event and Track Management
Re: None Getting Volume name from position co-ordinate (Dipanwita Banerjee)
Re: Question Re: Getting Volume name from position co-ordinate (Dipanwita Banerjee)
Date: 15 Aug, 2013
From: Gumplinger Peter <Gumplinger Peter>

> I was wondering is there a way to access the current volume name from
> the position co-ordinate?

Please, see the method LocateGlobalPointAndSetup:

http://www-geant4.kek.jp/lxr/source//geometry/navigation/include/G4Navigator.hh#L123

and how it is used in examples:

http://www-geant4.kek.jp/lxr/source/examples/extended/field/field04/src/F04PrimaryGeneratorAction.cc#L85

It is a bit convoluted because you need to make sure the 'geometry is closed' and also that you don't mess with the G4Navigator the G4 tracking is using. So, you have to instantiate your own G4Navigator object first, aNavigator, then:

G4VPhysicalVolume* theVolume = aNavigator->LocateGlobalPointAndSetup(point,dir,false,false);

G4String theVolName = theVolume->GetName();

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Getting Volume name from position co-ordinate   (Dipanwita Banerjee - 16 Aug, 2013)
 Add Message Add Message
to: "Re: Getting Volume name from position co-ordinate"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]