Usage of BooleanDetector in python has unexpected results

Hi @leoghizoni,

Welcome back to the forum then !

I think you need to negate the FieldOfViewDetector detector when doing the andCombine, either with NegateDetector(fovDetector) or BooleanDetector.notCombine(fovDetector ).

g function of the FOV detector is negative when target is in FOV.
g function of elevation detector is positive when target elavation is above user-defined threshold.
g function of andCombine is positive when all detectors are positive, and negative otherwise.

So, in your code, you’re actually checking events where elevation is above threshold and target is not in FOV.
Maybe you could read this former post to have some more explanations.

Usage of BooleanDetector can be tricky because you need to be extra careful with the sign of the g functions of the combined detectors.

Hope this helps,
Maxime

2 Likes