Message: Re: scoring particles traversing a plane  Not Logged In (login) 
There are several ways to do this.
1) The simplest is to partition your cube of water into two boxes such that there is a boundary where you want to sample. Then you can use G4UserSteppingAction to handle scoring whenever a track stops at the desired boundary. 2) In principle you could place a volume into a secondary world such that there is a boundary where you want to sample. This can make the sample plane be independent of the volumes in the mass (default) world. I was not able to get this to work, however (but that was many releases ago and it may well work now). 3) Do it yourself: represent the plane as a point and a 3vector normal to the plane. In UserSteppingAction determine whether the step crosses the plane by examining step>GetPreStepPoint() and step>GetPostStepPoint(); for steps that cross the plane, linearly interpolate to the plane and do the sampling. For better accuracy (smaller interpolation distance), you could couple this with a process that limits the step size near the plane, or simply limit the step size globally or within the enclosing volume. NOTE: if the sampling plane happens to coincide with a volume boundary, then you must handle the case where both points are on the plane (ignore such steps); you must also handle the case where one of the points is on the plane, taking care to not double count. G4beamline is an opensource program based on Geant4 that has code for (3) in its 'zntuple' command. It can be downloaded from http://g4beamline.muonsinc.com . But be aware it is a large and nontrivial program.

Inline Depth:  Outline Depth:  Add message: 
to: 