Skip to content
Snippets Groups Projects
Commit 447e7e5f authored by philten's avatar philten
Browse files

LBHLT-76 naive method for adding extra info for the topo

parent 99e018a3
Branches TopoExtraInfo
No related tags found
No related merge requests found
......@@ -50,9 +50,9 @@ namespace LoKi
public:
// ======================================================================
/// constructor from the tool name
Value ( const std::string& tool ) ;
Value ( const std::string& tool, int key = -1 ) ;
/// constructor from the tool
Value ( const IParticleValue* tool ) ;
Value ( const IParticleValue* tool, int key = -1 ) ;
/// copy constructor
Value ( const Value& right ) = default;
/// MANDATORY: virtual destructor
......@@ -68,6 +68,7 @@ namespace LoKi
// ======================================================================
/// the tool itself
LoKi::Interface<IParticleValue> m_function ; // the tool itself
int m_key ; // optionally write value to extra info with this key
// ======================================================================
} ;
// ========================================================================
......
......@@ -18,6 +18,7 @@
// ============================================================================
// LoKiPhys
// ============================================================================
#include "LoKi/ExtraInfo.h"
#include "LoKi/Particles44.h"
// ============================================================================
/** @file
......@@ -39,8 +40,8 @@
// constructor from the tool name
// ============================================================================
LoKi::Particles::Value::Value
( const std::string& function )
: LoKi::AuxFunBase ( std::tie ( function ) )
( const std::string& function, int key )
: LoKi::AuxFunBase ( std::tie ( function ) ), m_key(key)
{
// 1. get from the context
LoKi::ILoKiSvc* loki = lokiSvc() ;
......@@ -67,9 +68,9 @@ LoKi::Particles::Value::Value
// constructor from the function
// ============================================================================
LoKi::Particles::Value::Value
( const IParticleValue* function )
( const IParticleValue* function, int key )
: LoKi::AuxFunBase{ std::tie() }
, m_function ( function )
, m_function ( function ), m_key(key)
{}
// ============================================================================
// MANDATORY: virtual destructor
......@@ -103,7 +104,10 @@ LoKi::Particles::Value::operator()
return false ; // RETURN
}
// use tool
return m_function->operator()( p ) ;
auto v = m_function->operator()( p ) ;
if (m_key >= 0 && !LoKi::ExtraInfo::hasInfo(p, m_key))
LoKi::ExtraInfo::addInfo(p, m_key, v);
return v ;
}
// ============================================================================
// OPTIONAL: the specific printout
......
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