Commit 1fd08660 authored by Nils Krumnack's avatar Nils Krumnack
Browse files

replace CP::ISelectionTool with IAsgSelectionTool

We somehow ended up with two copies of the same interface class.  The
problem with having two interfaces for the same task was that tools
implementing the different interfaces could not be used
interchangeably.  That specifically broke the configuration of some of
the common CP algorithm sequences, which use the same algorithm class
for all selection tools.

I was somewhat torn between which of the two classes to keep, and
while I originally wanted to keep `CP::ISelectionTool`, it turned out
that `IAsgSelectionTool` was much easier to keep.  That is because the
`AcceptInfo` and `AcceptData` classes are in the same package as the
interface class, and anybody who wants to use or implement that
interface will need those two classes as well.

One could potentially move all three classes together to
AsgAnalysisInterfaces if that is considered advantageous, but that
would be a bigger undertaking and they would all have to be moved
together.
parent ec1a9f6e
......@@ -39,7 +39,7 @@ namespace InDet {
/// Create a proper constructor for Athena
ASG_TOOL_CLASS2( InDetSecVtxTrackSelectionTool,
CP::ISelectionTool,
IAsgSelectionTool,
InDet::IInDetTrackSelectionTool )
public:
......
......@@ -8,7 +8,7 @@
#define INDETTRACKSELECTIONTOOL_IINDETTRACKSELECTIONTOOL_H
// Framework include(s):
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "PATCore/IAsgSelectionTool.h"
#include "PATCore/AcceptData.h"
#include "PATCore/AcceptInfo.h"
......@@ -48,7 +48,7 @@ namespace InDet {
/// @author Michael Clark <michael.ryan.clark@cern.ch>
///
///
class IInDetTrackSelectionTool : public virtual CP::ISelectionTool
class IInDetTrackSelectionTool : public virtual IAsgSelectionTool
{
/// Declare the interface that the class provides
ASG_TOOL_INTERFACE( InDet::IInDetTrackSelectionTool )
......
......@@ -40,7 +40,7 @@ namespace InDet {
/// Create a proper constructor for Athena
ASG_TOOL_CLASS2( InDetTrackSelectionTool,
CP::ISelectionTool,
IAsgSelectionTool,
InDet::IInDetTrackSelectionTool )
public:
......
......@@ -39,7 +39,7 @@ class AsgElectronIsEMSelector : public asg::AsgTool,
{
ASG_TOOL_CLASS3(AsgElectronIsEMSelector, IAsgElectronIsEMSelector,
IAsgEGammaIsEMSelector, CP::ISelectionTool)
IAsgEGammaIsEMSelector, IAsgSelectionTool)
public:
/** Standard constructor */
......
......@@ -27,7 +27,7 @@ namespace Root{
class AsgElectronLikelihoodTool : public asg::AsgTool,
virtual public IAsgElectronLikelihoodTool
{
ASG_TOOL_CLASS2(AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool, CP::ISelectionTool)
ASG_TOOL_CLASS2(AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool, IAsgSelectionTool)
public:
/** Standard constructor */
......
......@@ -42,7 +42,7 @@ class AsgForwardElectronIsEMSelector : public asg::AsgTool,
{
ASG_TOOL_CLASS3(AsgForwardElectronIsEMSelector, IAsgForwardElectronIsEMSelector,
IAsgEGammaIsEMSelector, CP::ISelectionTool)
IAsgEGammaIsEMSelector, IAsgSelectionTool)
public:
/** Standard constructor */
......
......@@ -39,7 +39,7 @@ class AsgPhotonIsEMSelector : public asg::AsgTool,
{
ASG_TOOL_CLASS3(AsgPhotonIsEMSelector, IAsgPhotonIsEMSelector,
IAsgEGammaIsEMSelector, CP::ISelectionTool)
IAsgEGammaIsEMSelector, IAsgSelectionTool)
public:
......
......@@ -11,7 +11,6 @@
// Local include(s):
#include "AsgAnalysisInterfaces/IClassificationTool.h"
#include "AsgAnalysisInterfaces/IEfficiencyScaleFactorTool.h"
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h"
#include "AsgAnalysisInterfaces/IObservableTool.h"
#include "AsgAnalysisInterfaces/IPileupReweightingTool.h"
......
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// IAsgSelectionTool.h
// Header file for class IAsgSelectionTool
// Author: Karsten Koeneke <karsten.koeneke@cern.ch>
///////////////////////////////////////////////////////////////////
#ifndef ASGANALYSISINTERFACES_IASGMTSELECTIONTOOL_H
#define ASGANALYSISINTERFACES_IASGMTSELECTIONTOOL_H
// STL includes
// FrameWork includes
#include <AsgTools/IAsgTool.h>
namespace asg {
class AcceptInfo;
class AcceptData;
}
// Forward declaration
namespace xAOD{
class IParticle;
}
namespace CP {
class ISelectionTool
: virtual public asg::IAsgTool
{
/// Declare the interface ID for this pure-virtual interface class to the Athena framework
ASG_TOOL_INTERFACE(ISelectionTool)
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
public:
///////////////////////////////////////////////////////////////////
// Const methods:
///////////////////////////////////////////////////////////////////
/** Method to get the plain AcceptInfo.
This is needed so that one can already get the AcceptInfo
and query what cuts are defined before the first object
is passed to the tool. */
virtual const asg::AcceptInfo& getAcceptInfo() const = 0;
/** Backward compatibility method */
[[deprecated("please use getAcceptInfo() instead")]]
inline const asg::AcceptInfo& getTAccept () const {
return getAcceptInfo();};
/** The main accept method: the actual cuts are applied here */
virtual asg::AcceptData accept( const xAOD::IParticle* /*part*/ ) const = 0;
};
}
#endif //> !PATCORE_IASGSELECTIONTOOL_H
......@@ -3,7 +3,6 @@
<namespace name="CP"/>
<class name="CP::IClassificationTool" />
<class name="CP::IEfficiencyScaleFactorTool" />
<class name="CP::ISelectionTool" />
<class name="CP::IPileupReweightingTool" />
<class name="IGoodRunsListSelectionTool" />
<class name="IObservableTool" />
......
......@@ -18,24 +18,24 @@
*/
// Include the interfaces
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "PATCore/IAsgSelectionTool.h"
#include "xAODEgamma/EgammaFwd.h"
#include "xAODEgamma/PhotonFwd.h"
#include "xAODEgamma/ElectronFwd.h"
class EventContext;
class IAsgEGammaIsEMSelector : virtual public CP::ISelectionTool
class IAsgEGammaIsEMSelector : virtual public IAsgSelectionTool
{
ASG_TOOL_INTERFACE(IAsgEGammaIsEMSelector)
public:
/// @name IAsgEGammaIsEMSelector methods in Addition to the ISelectionTool
/// @name IAsgEGammaIsEMSelector methods in Addition to the IAsgSelectionTool
/// @{
/// accept with pointer to IParticle so as to not hide the ISelectionTool one
/// accept with pointer to IParticle so as to not hide the IAsgSelectionTool one
virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
virtual asg::AcceptData accept( const EventContext& ctx, const xAOD::IParticle* part ) const = 0;
......
......@@ -14,23 +14,23 @@
*/
// Include the interfaces
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "PATCore/IAsgSelectionTool.h"
#include "xAODEgamma/ElectronFwd.h"
#include "xAODEgamma/EgammaFwd.h"
#include "GaudiKernel/EventContext.h"
class IAsgElectronChargeIDSelectorTool : virtual public CP::ISelectionTool
class IAsgElectronChargeIDSelectorTool : virtual public IAsgSelectionTool
{
ASG_TOOL_INTERFACE(IAsgElectronChargeIDSelectorTool)
public:
/// @name IAsgElectronChargeIDSelectorTool methods in Addition to the ISelectionTool ones
/// @name IAsgElectronChargeIDSelectorTool methods in Addition to the IAsgSelectionTool ones
/// Some are there to mainly support the calls done from the online/Trigger side
/// @{
/// accept with pointer to IParticle so as to not hide the ISelectionTool one
/// accept with pointer to IParticle so as to not hide the IAsgSelectionTool one
virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
/// accept method with pointer to electron
virtual asg::AcceptData accept( const xAOD::Electron* part ) const = 0;
......
......@@ -15,24 +15,24 @@
*/
// Include the interfaces
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "PATCore/IAsgSelectionTool.h"
#include "xAODEgamma/ElectronFwd.h"
#include "xAODEgamma/EgammaFwd.h"
class EventContext;
class IAsgElectronLikelihoodTool : virtual public CP::ISelectionTool
class IAsgElectronLikelihoodTool : virtual public IAsgSelectionTool
{
ASG_TOOL_INTERFACE(IAsgElectronLikelihoodTool)
public:
/// @name IAsgElectronLikelihoodTool methods in Addition to the ISelectionTool ones
/// @name IAsgElectronLikelihoodTool methods in Addition to the IAsgSelectionTool ones
/// Some are there to mainly support the calls done from the online/Trigger side
/// @{
/// accept with pointer to IParticle so as to not hide the ISelectionTool one
/// accept with pointer to IParticle so as to not hide the IAsgSelectionTool one
virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
virtual asg::AcceptData accept( const EventContext& ctx, const xAOD::IParticle* part ) const = 0;
/// accept method with pointer to electron
......
......@@ -13,20 +13,20 @@
*/
// Include the interfaces
#include "AsgAnalysisInterfaces/ISelectionTool.h"
#include "PATCore/IAsgSelectionTool.h"
#include "xAODEgamma/ElectronFwd.h"
class IAsgElectronMultiLeptonSelector : virtual public CP::ISelectionTool
class IAsgElectronMultiLeptonSelector : virtual public IAsgSelectionTool
{
ASG_TOOL_INTERFACE(IAsgElectronMultiLeptonSelector)
public:
/// @name IAsgElectronMultiLeptonSelector methods in addition to the ISelectionTool ones
/// @name IAsgElectronMultiLeptonSelector methods in addition to the IAsgSelectionTool ones
///{@
/// accept with pointer to IParticle so as to not hide the ISelectionTool one
/// accept with pointer to IParticle so as to not hide the IAsgSelectionTool one
virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
/// accept method with pointer to electron */
......
......@@ -69,7 +69,7 @@ private:
"The selector result names"
};
ToolHandleArray<CP::ISelectionTool> m_genericIsEMselectors{
ToolHandleArray<IAsgSelectionTool> m_genericIsEMselectors{
this,
"genericIsEMselectors",
{},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment