Skip to content
Snippets Groups Projects

remove LokiProtoParticles

Merged Gerhard Raven requested to merge remove-loki-protoparticles into master
30 files
+ 49
5275
Compare changes
  • Side-by-side
  • Inline
Files
30
@@ -8,16 +8,42 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "LoKiWrapper.h"
#include "Event/Particle.h"
#include "Gaudi/Property.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiKernel/StatusCode.h"
#include "LoKi/BasicFunctors.h"
#include "LoKi/ProtoParticles.h"
#include "LoKi/IHybridFactory.h"
#include "LoKi/PhysTypes.h"
DECLARE_COMPONENT( LoKiWrapper )
#include <functional>
#include <map>
#include <string>
#include <vector>
LoKiWrapper::LoKiWrapper( const std::string& type, const std::string& name, const IInterface* interface )
: GaudiTool( type, name, interface ) {
declareInterface<ILoKiWrapper>( this );
}
#include "boost/algorithm/string/predicate.hpp"
#include "ILoKiWrapper.h"
class LoKiWrapper : public extends<GaudiTool, ILoKiWrapper> {
public:
using extends::extends;
StatusCode initialize() override;
std::function<double()> getFunctor( const std::string& functorName ) override;
void setOutlets( const LHCb::Particle* const* pTaggingParticle, const LHCb::Particle* const* pSignalCandidate,
const LHCb::RecVertex* const* pRecVertex ) override;
private:
LoKi::IHybridFactory* m_factory = nullptr;
const LHCb::Particle* const* m_pTaggingParticle = nullptr;
const LHCb::Particle* const* m_pSignalCandidate = nullptr;
const LHCb::RecVertex* const* m_pAssociatedVertex = nullptr;
};
DECLARE_COMPONENT( LoKiWrapper )
StatusCode LoKiWrapper::initialize() {
auto sc = GaudiTool::initialize();
@@ -64,33 +90,6 @@ std::function<double()> LoKiWrapper::getFunctor( const std::string& functorName
return [vertexFunctor, this]() -> double { return vertexFunctor( *this->m_pAssociatedVertex ); };
}
// only for testing
// @TODO: remove this and either find a way to implement these lokifunctors
// in a more general way or implement those inside feature_generator as
// custom functors.
LoKi::BasicFunctors<const LHCb::ProtoParticle*>::PredicateFromPredicate protoParticleFunctorB =
LoKi::Constant<const LHCb::ProtoParticle*, bool>( false );
sc = m_factory->get( functorName, protoParticleFunctorB );
if ( sc == StatusCode::SUCCESS ) {
if ( msgLevel( MSG::DEBUG ) )
debug() << "[LoKiWrapper::getFunctor] "
<< "Initializing feature " << functorName << " as protoParticleFunctor." << endmsg;
return [protoParticleFunctorB, this]() -> double {
return protoParticleFunctorB( ( *this->m_pTaggingParticle )->proto() );
};
}
LoKi::BasicFunctors<const LHCb::ProtoParticle*>::FunctionFromFunction protoParticleFunctor =
LoKi::Constant<const LHCb::ProtoParticle*, double>( 0 );
sc = m_factory->get( functorName, protoParticleFunctor );
if ( sc == StatusCode::SUCCESS ) {
if ( msgLevel( MSG::DEBUG ) )
debug() << "[LoKiWrapper::getFunctor] "
<< "Initializing feature " << functorName << " as protoParticleFunctor." << endmsg;
return [protoParticleFunctor, this]() -> double {
return protoParticleFunctor( ( *this->m_pTaggingParticle )->proto() );
};
}
if ( msgLevel( MSG::FATAL ) )
fatal() << "[LoKiWrapper::getFunctor] "
<< "Feature " << functorName << " could not be initialized." << endmsg;
Loading