Skip to content

Clean up and factorize functor code

The following discussion from !3718 (merged) should be addressed:

  • @graven started a discussion: (+3 comments)

    All these functors like MuonCatBoost and MuonLLBg repeat a lot of 'scaffolding' -- when the only difference is which MuonPid member function is invoked at the end. So they can all be instances on a single template implementation, where the template argument is the member function to invoke.

    Basically, one can (should!) implement a GenericMuonPidFunctor such that one can write:

    using MuonCatBoost = GenericMuonPidFunctor< &MuonPid::muonMVA2>;
    using MuonLLBg = GenericMuonPidFunctor< &MuonPid::MuonLLBg >;
    using MuonChi2Corr = GenericMuonPidFunctor< &MuonPid::chi2Corr >;

    see eg this demonstrator on godbolt