Filtering steps in the future

It is possible to filter an step with a future condition. For example you may want to score the energy of the steps that are in a volume only if the track in a future step reaches another volume. This feature needs a special mechanism, as the steps cannot be saved until knowing if a future step will fulfill the second consition, and when this happens the steps to be saved have been deleted (Geant4 only saves one step at a time).

To use this mechanism a GmFutureFilter has to be defined, giving as arguments two filters: first the one that should fulfill the steps to be used (for scoring, for saving their information, filling histograms, ...) and second the one that shuld fulfill the steps that trigger the use of the first steps.

/gamos/filter myFutureFilter GmFutureFilter FILTER_PAST FILTER_FUTURE

If a future filter is used with a user action, it must be the only filter. If you want to add more normal filter together with the future filter you should combine them with GmANDFilter and put them as FILTER_PAST of the future filter.

GmFutureFilter only acts in one track, this means that the steps to be used as well as the future steps belong to the same track. If you want to set a condition in the future also to the children tracks of the steps to be used (e.g. score the energy of the steps that are in a volume only if the track or any of the secondary tracks created at this step or any future step of this track, including the children of these secondary tracks, reach another given volume, you have to use GmFutureWithChildrenFilter.

Future filters only act on steps, so if you use them for example together with a GmTrackDataHistosUA they will always return true, i.e. they will have no effect.

In the case of scorers the use of future filters has to take into account the fact that scorers are only invoked when a step happens in the detector volume that has attached the scorer. This could create a problem if the FILTER_FUTURE implies a geometrical condition, like for example if steps happens in a given volume. In this case the scorer will not be invoked and this filter will never be checked. The solution for this is that you attach a detector to the volume of the FILTER_FUTURE and then add in the FILTER_PAST filter asking for steps to be only in the volume(s) where you want to score.