Skip to content
Snippets Groups Projects
Commit 947c92b7 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Merge branch 'tfulghes-persist-selection' into 'master'

Get particle selection from WeightedRelationTable

See merge request !3434
parents 9f00afb4 2a253b28
No related branches found
No related tags found
1 merge request!3434Get particle selection from WeightedRelationTable
Pipeline #5672011 passed
......@@ -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 )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment