Skip to content
Snippets Groups Projects
Commit 3fdc7e95 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

treat SmartRef as-if it was a pointer

parent 16402734
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "SelKernel/ParticleTraits.h" #include "SelKernel/ParticleTraits.h"
#include "GaudiKernel/GenericMatrixTypes.h" #include "GaudiKernel/GenericMatrixTypes.h"
#include "GaudiKernel/SmartRef.h"
#include "GaudiKernel/detected.h" #include "GaudiKernel/detected.h"
#include <cassert> #include <cassert>
...@@ -87,7 +88,10 @@ namespace Sel::Utils { ...@@ -87,7 +88,10 @@ namespace Sel::Utils {
template <typename T> template <typename T>
auto&& deref_if_ptr( T&& x ) { auto&& deref_if_ptr( T&& x ) {
if constexpr ( std::is_pointer_v<std::remove_reference_t<T>> ) { if constexpr ( LHCb::Event::details::is_SmartRef_v<std::remove_cv_t<std::remove_reference_t<T>>> ) {
assert( x );
return *x;
} else if constexpr ( std::is_pointer_v<std::remove_reference_t<T>> ) {
assert( x ); // turn on DEBUG flags if you want to check this assert( x ); // turn on DEBUG flags if you want to check this
return *x; return *x;
} else { } else {
...@@ -134,7 +138,6 @@ namespace Sel::Utils { ...@@ -134,7 +138,6 @@ namespace Sel::Utils {
auto flightDistanceChi2( Vertex1 const& v1, Vertex2 const& v2 ) { auto flightDistanceChi2( Vertex1 const& v1, Vertex2 const& v2 ) {
using LHCb::Event::endVertexPos; using LHCb::Event::endVertexPos;
using LHCb::Event::posCovMatrix; using LHCb::Event::posCovMatrix;
;
auto cov = posCovMatrix( v1 ) + posCovMatrix( v2 ); auto cov = posCovMatrix( v1 ) + posCovMatrix( v2 );
cov = cov.invChol(); // what if it fails? cov = cov.invChol(); // what if it fails?
return similarity( endVertexPos( v1 ) - endVertexPos( v2 ), cov ); return similarity( endVertexPos( v1 ) - endVertexPos( v2 ), cov );
......
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