Skip to content
Snippets Groups Projects

FIND_DECAY and FIND_MCDECAY functor

Merged Tommaso Fulghesu requested to merge tfulghes-finddecay-functor into master
1 file
+ 47
50
Compare changes
  • Side-by-side
  • Inline
@@ -235,8 +235,7 @@ using dls_2 = std::invoke_result_t<Functors::Composite::ComputeDecayLengthSignif
using dls_3 = std::invoke_result_t<Functors::Composite::ComputeDecayLengthSignificance,
LHCb::Event::PV::PrimaryVertex const&, soa_composite>;
auto chi2perdof_func =
Functors::chain( FF::ValueOr{0.}, FT::Chi2PerDoF{}, Functors::Particle::GetTrack{} );
auto chi2perdof_func = Functors::chain( FF::ValueOr{0.}, FT::Chi2PerDoF{}, Functors::Particle::GetTrack{} );
using chi2perdof_prepared = decltype( chi2perdof_func.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
using chi2perdof_1 = std::invoke_result_t<chi2perdof_prepared, bool, LHCb::Particle const&>;
using chi2perdof_2 = std::invoke_result_t<chi2perdof_prepared, bool, LHCb::Particle const*>;
@@ -245,8 +244,7 @@ using chi2perdof_3 = std::invoke_result_t<chi2perdof_prepared, bool, LHCb::Parti
using chi2perdof_4 = std::invoke_result_t<chi2perdof_prepared, bool, charged_basic>;
using chi2perdof_5 = std::invoke_result_t<chi2perdof_prepared, bool, soa_composite>;
auto chi2_func =
Functors::chain( FF::ValueOr{0.}, FT::Chi2{}, Functors::Particle::GetTrack{} );
auto chi2_func = Functors::chain( FF::ValueOr{0.}, FT::Chi2{}, Functors::Particle::GetTrack{} );
using chi2_prepared = decltype( chi2_func.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
using chi2_1 = std::invoke_result_t<chi2_prepared, bool, LHCb::Particle const&>;
using chi2_2 = std::invoke_result_t<chi2_prepared, bool, LHCb::Particle const*>;
@@ -262,21 +260,18 @@ auto allpv_fd_func =
// bind map and TES functors with forwarding the arguments
Functors::bind(
FF::Map( /* The functor to map over a range. */
// chain magnitude and flight distance functor
Functors::chain(
// get magnitude of the flight distance vector
FC::Magnitude{},
// subtract the vertex position from the particle position
operator-(
// vertex position: LHCb::Vertex -> Gaudi::XYZPoint -> Vec3
// Arg1: LHCb::Vertex
Functors::chain( FC::ToLinAlg{}, FC::Position{},
FC::EndVertex{},
FC::ForwardArgs<1>() ),
// end vertex of particle: LHCb::Particle -> Gaudi::XYZPoint -> Vec3
// Arg0: LHCb::Particle
Functors::chain( FC::ToLinAlg{}, FC::Position{},
FC::ForwardArgs<0>() ) ) ) ),
// chain magnitude and flight distance functor
Functors::chain(
// get magnitude of the flight distance vector
FC::Magnitude{},
// subtract the vertex position from the particle position
operator-(
// vertex position: LHCb::Vertex -> Gaudi::XYZPoint -> Vec3
// Arg1: LHCb::Vertex
Functors::chain( FC::ToLinAlg{}, FC::Position{}, FC::EndVertex{}, FC::ForwardArgs<1>() ),
// end vertex of particle: LHCb::Particle -> Gaudi::XYZPoint -> Vec3
// Arg0: LHCb::Particle
Functors::chain( FC::ToLinAlg{}, FC::Position{}, FC::ForwardArgs<0>() ) ) ) ),
// get TES object and forward it
FC::TES<LHCb::Event::PV::PrimaryVertexContainer>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ),
@@ -292,15 +287,14 @@ using allpv_fd_func_result_type = std::invoke_result_t<allpv_fd_func_type, bool,
// Test for ALLPV_IP
//
// create an instance of ALLPV IP functor (obtained from functor.code() in python)
auto allpv_ip_func = Functors::bind(
FF::Map( FC::ImpactParameter{} ),
Functors::chain(
// vertex position: LHCb::Vertex -> Gaudi::XYZPoint -> Vec3
FF::Map( Functors::chain( FC::ToLinAlg{}, FC::Position{} ) ),
// get TES object and forward it
FC::TES<LHCb::Event::PV::PrimaryVertexContainer>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ) ),
FC::ForwardArgs<>{} );
auto allpv_ip_func = Functors::bind( FF::Map( FC::ImpactParameter{} ),
Functors::chain(
// vertex position: LHCb::Vertex -> Gaudi::XYZPoint -> Vec3
FF::Map( Functors::chain( FC::ToLinAlg{}, FC::Position{} ) ),
// get TES object and forward it
FC::TES<LHCb::Event::PV::PrimaryVertexContainer>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ) ),
FC::ForwardArgs<>{} );
// get the type of the prepared functor that is returned when calling prepare() on the above functor
using allpv_ip_func_type = decltype( allpv_ip_func.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
// get the result_type of invoking the allpv_ip_func_type with inputs.
@@ -312,24 +306,22 @@ using allpv_ip_func_result_type = std::invoke_result_t<allpv_ip_func_type, bool,
auto asym_func = operator/(
operator-(
Functors::chain( ::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{} ),
Functors::chain(
::FF::ValueOr( /* The default value. */ 0.0f ), ::FF::Sum{},
::FF::Map( /* The functor to map over a range. */ Functors::chain(
::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FC::To{} ) ),
Functors::bind( ::FC::Relations{},
::FC::TES<LHCb::Relation1D<LHCb::Particle, LHCb::Particle>>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ),
::FC::ForwardArgs<>() ) ) ),
Functors::chain( ::FF::ValueOr( /* The default value. */ 0.0f ), ::FF::Sum{},
::FF::Map( /* The functor to map over a range. */ Functors::chain(
::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FC::To{} ) ),
Functors::bind( ::FC::Relations{},
::FC::TES<LHCb::Relation1D<LHCb::Particle, LHCb::Particle>>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ),
::FC::ForwardArgs<>() ) ) ),
operator+(
Functors::chain( ::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{} ),
Functors::chain(
::FF::ValueOr( /* The default value. */ 0.0f ), ::FF::Sum{},
::FF::Map( /* The functor to map over a range. */ Functors::chain(
::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FC::To{} ) ),
Functors::bind( ::FC::Relations{},
::FC::TES<LHCb::Relation1D<LHCb::Particle, LHCb::Particle>>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ),
::FC::ForwardArgs<>() ) ) ) );
Functors::chain( ::FF::ValueOr( /* The default value. */ 0.0f ), ::FF::Sum{},
::FF::Map( /* The functor to map over a range. */ Functors::chain(
::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FC::To{} ) ),
Functors::bind( ::FC::Relations{},
::FC::TES<LHCb::Relation1D<LHCb::Particle, LHCb::Particle>>(
/* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ),
::FC::ForwardArgs<>() ) ) ) );
using asym_func_type = decltype( asym_func.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
using asym_func_result_type = std::invoke_result_t<asym_func_type, bool, LHCb::Particle const&>;
@@ -344,19 +336,24 @@ using npvs_func_res_type = std::invoke_result_t<npvs_func_type, bool, LHCb::RecS
using inmuon_1 = std::invoke_result_t<FT::InAcceptance, LHCb::Particle const&>;
// Create an instance for FIND_DECAY functor
using find_decay_func = Functors::chain( ::FF::ValueOr( /* The default value. */ std::integral_constant<int, 0>{} ), ::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FF::Front{}, ::Functors::Decay::FindDecay( /* Decay descriptor */ std::string{"[B0->K+ pi-]CC"} ), ::FC::TES<LHCb::Particle::ConstVector>( /* List of DataHandles */ std::vector{std::string{"FakeLocation"}}) );
//get the type of the prepared functor
using find_decay_func = Functors::chain(
::FF::ValueOr( /* The default value. */ std::integral_constant<int, 0>{} ), ::FC::Rho_Coordinate{},
::FT::ThreeMomentum{}, ::FF::Front{},
::Functors::Decay::FindDecay( /* Decay descriptor */ std::string{"[B0->K+ pi-]CC"} ),
::FC::TES<LHCb::Particle::ConstVector>( /* List of DataHandles */ std::vector{std::string{"FakeLocation"}} ) );
// get the type of the prepared functor
using find_decay_func_type = decltype( find_decay_func.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
// get the result_type of invoking the find_decay_func_type with inputs.
// The bool needs to be there since it is a mask to be passed to prepared functor
// Then the actual input is passed forwarding the arguments (LHCb::Particle const ref).
using find_decay_func_result_type = std::invoke_result_t<find_decay_func_type, bool, LHCb::Particle const&>;
// Check no.2: instead of using a dummy tes location, trying passing directly a std::vector<LHCb::Particle const&>
using find_decay_func2 = Functors::chain( ::FF::ValueOr( /* The default value. */ std::integral_constant<int, 0>{} ), ::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FF::Front{}, ::Functors::Decay::FindDecay( /* Decay descriptor */ std::string{"[B0->K+ pi-]CC"} ) );
using find_decay_func_type2 = decltype( find_decay_func2.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
using find_decay_func2 = Functors::chain( ::FF::ValueOr( /* The default value. */ std::integral_constant<int, 0>{} ),
::FC::Rho_Coordinate{}, ::FT::ThreeMomentum{}, ::FF::Front{},
::Functors::Decay::FindDecay( /* Decay descriptor */ std::string{
"[B0->K+ pi-]CC"} ) );
using find_decay_func_type2 = decltype( find_decay_func2.prepare( EventContext{}, Functors::TopLevelInfo{} ) );
using find_decay_func_result_type2 = std::invoke_result_t<find_decay_func_type2, bool, LHCb::Particle const&>;
BOOST_AUTO_TEST_CASE( instantiate_all ) {
// empty on purpose -- just need to compile and instantiate...
Loading