Skip to content
Snippets Groups Projects

Get particle selection from WeightedRelationTable

Merged Tommaso Fulghesu requested to merge tfulghes-persist-selection into master
@@ -22,9 +22,10 @@
namespace {
using WeightedRelationTable = LHCb::Relation1D<LHCb::Particle, LHCb::Particle>;
using Transformer =
using RelTableTransformer =
LHCb::Algorithm::Transformer<WeightedRelationTable( const LHCb::Particle::Range&, const LHCb::Particle::Range& )>;
using weight_t = bool;
using SelectionTransformer = LHCb::Algorithm::Transformer<LHCb::Particle::Selection( const WeightedRelationTable& )>;
using weight_t = bool;
struct Funct {
constexpr static auto PropertyName = "Cut";
@@ -60,14 +61,14 @@ namespace {
// This algorithm includes GetPhotonsForDalitzDecay
struct WeightedRelTableAlg : with_functors<Transformer, Funct> {
struct WeightedRelTableAlg final : with_functors<RelTableTransformer, Funct> {
// ==========================================================================
/** the standard constructor
* @param name algorithm instance name
* @param pSvc service locator
*/
WeightedRelTableAlg( const std::string& name, ISvcLocator* pSvc )
: with_functors<Transformer, Funct>::with_functors(
: with_functors<RelTableTransformer, Funct>::with_functors(
name, pSvc, {KeyValue{"InputCandidates", ""}, KeyValue{"ReferenceParticles", ""}},
KeyValue{"OutputRelations", ""} ) {}
@@ -102,4 +103,22 @@ private:
mutable Gaudi::Accumulators::SummingCounter<> m_outCount{this, "#OutputParticles"};
};
struct SelectionFromWeightedRelationTable final : SelectionTransformer {
// ==========================================================================
/** the standard constructor
* @param name algorithm instance name
* @param pSvc service locator
*/
SelectionFromWeightedRelationTable( const std::string& name, ISvcLocator* svcLoc )
: Transformer( name, svcLoc, KeyValue( "InputRelations", "" ), KeyValue( "OutputLocation", "" ) ) {}
LHCb::Particle::Selection operator()( const WeightedRelationTable& input ) const override {
LHCb::Particle::Selection selection;
for ( const auto& rel : input.relations() ) selection.push_back( rel.to() );
return selection;
}
};
DECLARE_COMPONENT( WeightedRelTableAlg )
DECLARE_COMPONENT( SelectionFromWeightedRelationTable )
Loading