|Message: Re: Intersection between a straight line and a volume||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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