Message: Re: Intersection between a straight line and a volume Not Logged In (login)

## Re: Intersection between a straight line and a volume

Forum: Geometry
Re: Intersection between a straight line and a volume (Alain Ferragut)
Date: 09 Jun, 2011
From: John Apostolakis <John Apostolakis>

 Dear Alain, The simplest way is to - use a geantino as a particle (which does not interact) - set the initial point and direction using the particle gun, - set the verbosity of tracking using /tracking/verbose 1 and track a particle. The verbosity should report if you have crossed that volume. But you you want to do this systematically, please find below a quick sketch of how to move through a geometry which you have described to Geant4 -- and which you have closed (e.g. by running one track through it with beamOn). You will need to navigate from the current point until you have exited the world in order to see whether you 0) Make sure that you are not doing this during tracking - else it will confuse the Geant4 tracking 1) Get the Navigator G4Navigator pNavigator= G4TransportationManager->GetNavigatorForTracking(); 2) Locate at your current point (G4ThreeVector point;) G4VPhysicalVolume volHere= pNavigator->LocateGlobalPointAndSetup( point ); if (volHere == 0) // you are done - it is outside the world else if ( .. Check volHere->GetName() against the volume you are trying to intersect. 3) Ask it to move to the next boundary: G4double stepSize= pNavigator->ComputeStep( point, direction ); 4) Find the location of the next boundary: G4ThreeVector newPoint= point + stepSize * direction; 5) Check whether you have managed to move (newPoint - point).mag2() > 0 and restart at Step 2) above with point=newPoint. Please excuse any typos - you can find the signatures of key methods in G4Navigator.hh eg by look in Geant4 LXR or your source code. Hope this helps, Cheers, John On 6/7/11 4:23 PM, Alain Ferragut wrote: > > *** Discussion title: Geometry > > Hello, Is it possible to do the following : knowing the current location > and the velocity (vector) of a particle, I would like to test if a > specific volume in my geometry will be intersected by the straight line > passing at my particle location and oriented by the current particle > velocity vector ? > > Thanks, > > Alain > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1126.html -- John Apostolakis Tel: Office +41-22-767-7239 Mobile +41-76-242-0801

 to: "Re: Intersection between a straight line and a volume"
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 ]