Use hasFlag rather than relying on catching `RuntimeError` s
There are a few places in the code that rely on catching the RuntimeError
generated by trying to access a flag that does not exist. This is going to be replaced by an AttributeError
more inline with python's rules.
In preparation, this MR changes these calls to use the hasFlag
method, which is clearer in any case.
FAO @fwinkl, @wlampl, @dguest, also @jmasik, @ksuch and @jchapman as the last people to touch the places I've changed (tagging John rather than Rupert as Rupert has left ATLAS).