Skip to content

reduce the usage of Measurement::type()

Gerhard Raven requested to merge streamline-measurement-further into master

Instead of using Measurement::type(), and then checking its value, please prefer to directly check for the type of interest. For example, prefer is<LHCB::Measurement::VP>() over type()==LHCb::Measurement::Type::VP. In addition, is provides convenience specialisations, eg. in addition to asking is<LHCb::Measurement::VeloLitePhi>() one can ask is<LHCb::Measurement::Velo>() which will return true for VeloLiteR, VeloR, VeloLitePhi and VeloPhi. Another reason is that the use of is<> and the corresponding getIf<> and visit methods typically leads to better code generation, as there is no reason to first check, and then subsequently perform some action depending on the check. Finally, type() relies on a mapping between an enum and types, where as is, getIf and visit directly use the underlying type, and hence typically provide more safe code.

WARNING: this MR changes the behavior of several tools, amongst which the run2 and upgrade ghost ID tools: these tools used to require (over)specific Measurement types eg. UT or ITLite when counting the number of (inactive) hits. As a result, the results depended on the configuration of the decoding and trackfit (eg. whether to use ITLite or ITFull clusters). A side effect of this MR is that the counting of measurements becomes invariant under the change between eg. ITFull and ITLite.

Edited by Marco Cattaneo

Merge request reports

Loading