I am trying to build a collimator. For this in need to filter particles with respect to their angle of incidence. i.e. I need a distribution with Counts on Y-axis and Angle of incidence in X-axis??
Does anyone know how to do that? Are there any examples?
Thanks very much in advance!
You can do this either in a generic stepping action, or in a sensitive detector attached to your target volume. If you use a stepping action, then you’ll have to filter by hand on both particle type and current volume (an SD does the latter for you).
If you’re building a collimator, you may want/need to make the “hole” a daughter volume made of vacuum, rather than a boolean subtraction. That gets you an extra step with a boundary crossing to do the job.
- Look at the pre-step point and filter on a status of
fGeomBoundary. That will give you the track at its first step into your volume of interest.
- Get the post-step Touchable and extract both the transform to get from global to local coordinates, and the underlying Solid of the volume.
- Using the pre-step position, transform it to local coordinates, and pass it to solid->SurfaceNormal(localPos). That gives you a three-vector pointing outward from the volume’s surface at the pre-step point.
- Get the pre-step momentum, and transform it to local coordinates. The dot product of localMom with -Normal (from above) gives you the angle of incidence cos(theta) on your target.