Skip to content
Snippets Groups Projects
Commit cb6345bd authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'cherry-AssociationUtils-2020-04-16' into 'master'

cherry-pick AssociationUtils from 21.2

See merge request atlas/athena!32085
parents 4f219151 be81e471
No related branches found
No related tags found
No related merge requests found
Showing
with 219 additions and 212 deletions
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_ALTMUJETOVERLAPTOOL_H
#define ASSOCIATIONUTILS_ALTMUJETOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_LINKDEF_H
#define ASSOCIATIONUTILS_LINKDEF_H
#ifdef __CLING__
#ifndef ASSOCIATIONUTILSDICT_H
#define ASSOCIATIONUTILSDICT_H
#include "AssociationUtils/IOverlapTool.h"
#include "AssociationUtils/IOverlapRemovalTool.h"
#include "AssociationUtils/IObjectAssociator.h"
#include "AssociationUtils/OverlapRemovalTool.h"
#include "AssociationUtils/BaseOverlapTool.h"
#include "AssociationUtils/DeltaROverlapTool.h"
#include "AssociationUtils/EleEleOverlapTool.h"
#include "AssociationUtils/EleMuSharedTrkOverlapTool.h"
#include "AssociationUtils/EleJetOverlapTool.h"
#include "AssociationUtils/EleMuSharedTrkOverlapTool.h"
#include "AssociationUtils/MuJetOverlapTool.h"
#include "AssociationUtils/MuPFJetOverlapTool.h"
#include "AssociationUtils/AltMuJetOverlapTool.h"
#include "AssociationUtils/TauLooseEleOverlapTool.h"
#include "AssociationUtils/TauLooseMuOverlapTool.h"
#include "AssociationUtils/TauJetOverlapTool.h"
#include "AssociationUtils/TauAntiTauJetOverlapTool.h"
#include "AssociationUtils/ObjLinkOverlapTool.h"
//#include "AssociationUtils/ORToolBox.h"
#include "AssociationUtils/ToolBox.h"
#include "AssociationUtils/BJetHelper.h"
#include "AssociationUtils/DeltaRMatcher.h"
#include "AssociationUtils/MuJetGhostDRMatcher.h"
#include "AssociationUtils/OverlapDecorationHelper.h"
#include "AssociationUtils/OverlapLinkHelper.h"
#include "AssociationUtils/OverlapRemovalGenUseAlg.h"
#include "AssociationUtils/IOverlapRemovalToolLegacy.h"
#include "AssociationUtils/OverlapRemovalToolLegacy.h"
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclass;
#pragma link C++ namespace ORUtils;
#pragma link C++ class ORUtils::IOverlapRemovalTool+;
#pragma link C++ class ORUtils::IOverlapTool+;
#pragma link C++ class ORUtils::BaseOverlapTool+;
#pragma link C++ class ORUtils::OverlapRemovalTool+;
#pragma link C++ class ORUtils::DeltaROverlapTool+;
#pragma link C++ class ORUtils::EleEleOverlapTool+;
#pragma link C++ class ORUtils::EleJetOverlapTool+;
#pragma link C++ class ORUtils::EleMuSharedTrkOverlapTool+;
#pragma link C++ class ORUtils::MuJetOverlapTool+;
#pragma link C++ class ORUtils::AltMuJetOverlapTool+;
#pragma link C++ class ORUtils::TauLooseEleOverlapTool+;
#pragma link C++ class ORUtils::TauLooseMuOverlapTool+;
#pragma link C++ class ORUtils::TauJetOverlapTool+;
#pragma link C++ class ORUtils::TauAntiTauJetOverlapTool+;
#pragma link C++ class ORUtils::ObjLinkOverlapTool+;
// Helpers
#pragma link C++ class ORUtils::ToolBox+;
//#pragma link C++ class ORUtils::ToolBoxBase+;
//#pragma link C++ class ORUtils::ORToolBox+;
#pragma link C++ class ORUtils::BJetHelper+;
#pragma link C++ class ORUtils::DeltaRMatcher+;
#pragma link C++ class ORUtils::SlidingDeltaRMatcher+;
#pragma link C++ class ORUtils::MuJetGhostDRMatcher+;
#pragma link C++ class ORUtils::OverlapDecorationHelper+;
#pragma link C++ class ORUtils::OverlapLinkHelper+;
// Legacy tools
#pragma link C++ class IOverlapRemovalTool+;
#pragma link C++ class OverlapRemovalTool+;
#endif // __CLING__
#endif // ASSOCIATIONUTILS_LINKDEF_H
#endif
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_BJETHELPER_H
#define ASSOCIATIONUTILS_BJETHELPER_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_BASEOVERLAPTOOL_H
#define ASSOCIATIONUTILS_BASEOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_DELTARMATCHER_H
#define ASSOCIATIONUTILS_DELTARMATCHER_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_OVERLAPTOOLDR_H
#define ASSOCIATIONUTILS_OVERLAPTOOLDR_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_ELEELEOVERLAPTOOL_H
#define ASSOCIATIONUTILS_ELEELEOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_ELEJETOVERLAPTOOL_H
#define ASSOCIATIONUTILS_ELEJETOVERLAPTOOL_H
......@@ -47,9 +48,10 @@ namespace ORUtils
EleJetOverlapTool(const std::string& name);
/// @brief Identify overlapping electrons and jets.
/// First, electrons are flagged for removal if they overlap with
/// non-b-labeled jets within the inner dR cone. Next, jets are flagged
/// for removal if they overlap with remaining electrons in the outer dR cone.
/// First, non-b-labeled jets are flagged for removal if they overlap
/// with electrons within the inner dR cone.
/// Next, electrons are flagged for removal if they overlap with the
/// remaining jets in the outer dR cone.
virtual StatusCode
findOverlaps(const xAOD::IParticleContainer& cont1,
const xAOD::IParticleContainer& cont2) const override;
......@@ -73,6 +75,9 @@ namespace ORUtils
/// Input jet decoration which labels a bjet
std::string m_bJetLabel;
/// Max electron PT for b-tag aware OR
double m_maxElePtForBJetAwareOR;
/// Toggle PT ratio criteria
bool m_applyPtRatio;
/// Minimum e/jet pt ratio to remove a jet
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_SHAREDTRKOVERLAPTOOL_H
#define ASSOCIATIONUTILS_SHAREDTRKOVERLAPTOOL_H
......@@ -14,17 +15,24 @@
// Local includes
#include "AssociationUtils/IOverlapTool.h"
#include "AssociationUtils/BaseOverlapTool.h"
#include "AssociationUtils/DeltaRMatcher.h"
namespace ORUtils
{
/// @class EleMuSharedTrkOverlapTool
/// @brief Tool for removing overlaps between electrons and muons that
/// share a track.
/// share a track or are DR matched.
///
/// I don't yet know if it's straightforward to generalize to any kind of
/// particles.
///
/// The procedure works as follows.
/// 1. Remove muons if they share a track with an electron, they are
/// calorimeter-tagged and removeCaloMuons is activated.
/// 2. Remove electrons if they share a track with a muon or if they
/// are DR matched to a muon and useDRMatching is activated.
///
/// @author Steve Farrell <Steven.Farrell@cern.ch>
///
class EleMuSharedTrkOverlapTool : public virtual IOverlapTool,
......@@ -64,10 +72,20 @@ namespace ORUtils
/// Flag to remove calo-muons overlapping with electrons
bool m_removeCaloMuons;
/// Flag to remove electrons in a dR cone of muons (default: false)
bool m_useDRMatching;
/// Maximum dR between electrons and muons if m_useDRMatching is used
float m_maxDR;
/// Calculate delta-R using rapidity
bool m_useRapidity;
//
// Utilities
//
/// Delta-R matcher
std::unique_ptr<DeltaRMatcher> m_dRMatcher;
}; // class EleMuSharedTrkOverlapTool
} // namespace ORUtils
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_IOBJECTASSOCIATOR_H
#define ASSOCIATIONUTILS_IOBJECTASSOCIATOR_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL2_H
#define ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL2_H
#ifndef ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL_H
#define ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL_H
// Framework includes
#include "AsgTools/IAsgTool.h"
......@@ -14,9 +15,6 @@
#include "xAODMuon/MuonContainer.h"
#include "xAODTau/TauJetContainer.h"
// Backwards compatibility
#include "AssociationUtils/IOverlapRemovalToolLegacy.h"
namespace ORUtils
{
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL_H
#define ASSOCIATIONUTILS_IOVERLAPREMOVALTOOL_H
// Framework includes
#include "AsgTools/IAsgTool.h"
// EDM includes
#include "xAODEgamma/ElectronContainer.h"
#include "xAODEgamma/PhotonContainer.h"
#include "xAODJet/JetContainer.h"
#include "xAODMuon/MuonContainer.h"
#include "xAODTau/TauJetContainer.h"
/// Interface for the overlap removal tool
///
/// @author Steve Farrell <steven.farrell@cern.ch>
///
class IOverlapRemovalTool : public virtual asg::IAsgTool
{
/// Declare the interface
ASG_TOOL_INTERFACE(IOverlapRemovalTool)
public:
/// Top-level method for performing full overlap-removal.
/// The individual OR methods will be called in the recommended order,
/// and the considered objects will be decorated with the output result.
/// Use this method form when the electron and muon containers are
/// sufficiently loose for the tau-lep overlap removal.
virtual StatusCode removeOverlaps(const xAOD::ElectronContainer* electrons,
const xAOD::MuonContainer* muons,
const xAOD::JetContainer* jets,
const xAOD::TauJetContainer* taus = 0,
const xAOD::PhotonContainer* photons = 0) = 0;
/// Top-level method for performing full overlap-removal.
/// The individual OR methods will be called in the recommended order,
/// and the considered objects will be decorated with the output result.
/// Use this method form when you're using view-containers or subset
/// containers in order to provide the loose electrons and muons for the
/// tau-lep overlap removal.
virtual StatusCode removeOverlaps(const xAOD::ElectronContainer* electrons,
const xAOD::MuonContainer* muons,
const xAOD::JetContainer* jets,
const xAOD::TauJetContainer* taus,
const xAOD::ElectronContainer* looseElectrons,
const xAOD::MuonContainer* looseMuons,
const xAOD::PhotonContainer* photons = 0) = 0;
/// Remove overlapping electrons and jets.
/// This method will decorate both the electrons and jets according to
/// both the e-jet and jet-e overlap removal prescriptions
virtual StatusCode removeEleJetOverlap(const xAOD::ElectronContainer& electrons,
const xAOD::JetContainer& jets) = 0;
/// Remove overlapping muons and jets
virtual StatusCode removeMuonJetOverlap(const xAOD::MuonContainer& muons,
const xAOD::JetContainer& jets) = 0;
/// Remove overlapping electrons and muons
virtual StatusCode removeEleMuonOverlap(const xAOD::ElectronContainer& electrons,
const xAOD::MuonContainer& muons) = 0;
/// Remove jets overlapping with taus
virtual StatusCode removeTauJetOverlap(const xAOD::TauJetContainer& taus,
const xAOD::JetContainer& jets) = 0;
/// Remove overlapping taus and electrons
virtual StatusCode removeTauEleOverlap(const xAOD::TauJetContainer& taus,
const xAOD::ElectronContainer& electrons) = 0;
/// Remove overlapping taus and muons
virtual StatusCode removeTauMuonOverlap(const xAOD::TauJetContainer& taus,
const xAOD::MuonContainer& muons) = 0;
/// Remove overlapping photons and electrons
virtual StatusCode removePhotonEleOverlap(const xAOD::PhotonContainer& photons,
const xAOD::ElectronContainer& electrons) = 0;
/// Remove overlapping photons and muons
virtual StatusCode removePhotonMuonOverlap(const xAOD::PhotonContainer& photons,
const xAOD::MuonContainer& muons) = 0;
/// Remove overlapping photons
virtual StatusCode removePhotonPhotonOverlap(const xAOD::PhotonContainer& photons) = 0;
/// Remove overlapping photons and jets
virtual StatusCode removePhotonJetOverlap(const xAOD::PhotonContainer& photons,
const xAOD::JetContainer& jets) = 0;
}; // class IOverlapRemovalTool
#endif
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_IOVERLAPTOOL_H
#define ASSOCIATIONUTILS_IOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_MACROCHECKS_H
#define ASSOCIATIONUTILS_MACROCHECKS_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_MUJETGHOSTMATCHER_H
#define ASSOCIATIONUTILS_MUJETGHOSTMATCHER_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_MUJETOVERLAPTOOL_H
#define ASSOCIATIONUTILS_MUJETOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_MUPFJETOVERLAPTOOL_H
#define ASSOCIATIONUTILS_MUPFJETOVERLAPTOOL_H
// Framework includes
#include "AsgTools/AsgTool.h"
// EDM includes
#include "xAODMuon/MuonContainer.h"
#include "xAODJet/JetContainer.h"
#include "xAODTracking/VertexContainer.h"
// Local includes
#include "AssociationUtils/IOverlapTool.h"
#include "AssociationUtils/BaseOverlapTool.h"
#include "AssociationUtils/IObjectAssociator.h"
namespace ORUtils
{
/// @class MuPFJetOverlapTool
/// @brief A tool implementing the recommended removal of PFlow jets which
/// are reconstructed from muon ID tracks.
///
/// This tool takes muons and jets and removes jets based on
/// various criteria including delta-R, jet track multiplicity, mu_ID_pt/jet_SumTrkPt
/// ratio and muon calo isolation (topoetcone40 variable).
///
/// The variable used for calo isolation is topoetcone40 and must be present.
/// For the jets the variables NumTrkPt500 and SumPtTrkPt500 must be present.
///
/// The procedure works as follows.
/// - Remove jets that overlap with muons which satisfy a variety of criteria.
/// Two different windows in nTrk are used, and in each a cut is performed of the form
/// topoetcone40<y0
/// OR topoetcone40<y0+(y2-y1)/(x2-x1)*(mu_id_pt/jet_SumPtTrkPt500-x1)
/// OR mu_id_pt/jet_SumPtTrkPt500>x2
///
/// - Note no muons are removed in this procedure
///
/// To determine jet track properties, the primary vertex is retrieved
/// and used to query the NumTrkPt500 and SumPtTrkPt500 jet attribute.
///
/// Some special configuration properties
/// UseSlidingDR - activate sliding dR cone (c1 + c2/muPt)
///
///
/// These properties are useful for specifying PV-related quantities so that
/// the tool doesn't need to retrieve the PV:
/// JetNumTrackDecoration - user-defined numTrk decoration
/// JetSumTrackPTDecoration - user-defined sumTrkPt decoration
///
/// @author Chris Young <christopher.young@cern.ch>
///
class MuPFJetOverlapTool : public virtual IOverlapTool,
public BaseOverlapTool
{
/// Create proper constructor for Athena
ASG_TOOL_CLASS(MuPFJetOverlapTool, IOverlapTool)
public:
/// Standalone constructor
MuPFJetOverlapTool(const std::string& name);
/// @brief Identify overlapping muons and jets.
/// First, low-track-multiplicity jets are flagged if they overlap with
/// muons. Second, muons are flagged if they overlap with the remaining
/// jets.
virtual StatusCode
findOverlaps(const xAOD::IParticleContainer& cont1,
const xAOD::IParticleContainer& cont2) const override;
/// @brief Identify overlapping muons and jets.
/// The above method calls this one.
virtual StatusCode
findOverlaps(const xAOD::MuonContainer& muons,
const xAOD::JetContainer& jets) const;
protected:
/// Initialize the tool
virtual StatusCode initializeDerived() override;
private:
/// Retrieve the primary vertex used to count jet tracks
const xAOD::Vertex* getPrimVtx() const;
/// Get the number of tracks in a jet w.r.t. requested vertex
int getNumTracks(const xAOD::Jet& jet, size_t vtxIdx) const;
/// Get the sum trk pt in a jet w.r.t. requested vertex
float getSumTrackPt(const xAOD::Jet& jet, size_t vtxIdx) const;
/// @name Configurable properties
/// @{
/// Minimum number of jet tracks to use the looser jet rejection criteria
int m_numJetTrk;
/// The 5 parameters that define the low nTrk criteria for removing jets.
float m_muPFJet_lowNtrk_x1;
float m_muPFJet_lowNtrk_x2;
float m_muPFJet_lowNtrk_y0;
float m_muPFJet_lowNtrk_y1;
float m_muPFJet_lowNtrk_y2;
/// The 5 parameters that define the high nTrk criteria for removing jets.
float m_muPFJet_highNtrk_x1;
float m_muPFJet_highNtrk_x2;
float m_muPFJet_highNtrk_y0;
float m_muPFJet_highNtrk_y1;
float m_muPFJet_highNtrk_y2;
/// Optional user decoration for jet numTrack of type 'int'
std::string m_jetNumTrkDec;
/// Optional user decoration for jet sumTrackPT of type 'float'
std::string m_jetSumTrkPtDec;
/// dR cone within which jets can get removed
float m_coneDR;
/// Calculate deltaR using rapidity
bool m_useRapidity;
/// @}
/// @name Utilities
/// @{
/// Delta-R matcher for the cone
std::unique_ptr<IParticleAssociator> m_dRMatchCone;
/// @}
}; // class MuPFJetOverlapTool
} // namespace ORUtils
#endif
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_ORTOOLBOX_H
#define ASSOCIATIONUTILS_ORTOOLBOX_H
// This code should only be used in RootCore
#ifdef ROOTCORE
// Framework includes
#include "AsgTools/AsgTool.h"
#include "AsgTools/AnaToolHandle.h"
// Local includes
#include "AssociationUtils/IOverlapTool.h"
#include "AssociationUtils/IOverlapRemovalTool.h"
namespace ORUtils
{
/// @class ToolBoxBase
/// @brief A generic helper class for holding tools.
///
/// This is being replaced by the new ToolBox class.
///
/// @author Steve Farrell <Steven.Farrell@cern.ch>
///
class ToolBoxBase
{
public:
// Tool-map typedefs
using MapType_t = std::map< std::string, std::unique_ptr<asg::AsgTool> >;
using const_iterator = typename MapType_t::const_iterator;
/// Initializes all tools in the toolbox
StatusCode initialize();
/// Set message level of all tools in one go
void setMsgLevel(MSG::Level lvl);
/// @brief Retrieve an AsgTool pointer
/// Returns NULL in case the tool isn't found.
asg::AsgTool* getTool(const std::string& key, bool quiet=false);
/// @brief Add a tool to the box.
/// Overwrites a pre-existing tool.
void setTool(const std::string& key, std::unique_ptr<asg::AsgTool> tool);
/// Read-only iteration over the map elements
const_iterator begin() const;
/// Read-only iteration over the map elements
const_iterator end() const;
private:
/// @brief Map of key to tool pointer.
/// Key does not necessarily need to be the tool name, though using the
/// tool name might make the most sense in most situations.
MapType_t m_tools;
}; // class ToolBoxBase
/// @class ORToolBox
/// @brief Specialized toolbox for overlap tools and a master tool.
///
/// This is being replaced by the new ToolBox class.
///
/// @author Steve Farrell <Steven.Farrell@cern.ch>
///
class ORToolBox : public ToolBoxBase
{
public:
/// Get AsgTool ptr to the master tool
asg::AsgTool* getMasterTool();
/// Set the master tool (uses key="master")
void setMasterTool(std::unique_ptr<asg::AsgTool> tool);
/// @brief Add one overlap tool.
/// If master tool is already added, then the tool will also be
/// assigned to the master tool using the key. The tool name will
/// be used in case the key is empty (default).
StatusCode addOverlapTool(std::unique_ptr<asg::AsgTool> tool,
std::string key = "");
/// Get a ToolHandle to an IOverlapTool
ToolHandle<IOverlapTool> getHandle(const std::string& key);
/// Get a ToolHandle to the master IOverlapRemovalTool
ToolHandle<IOverlapRemovalTool> getMasterHandle();
}; // class ORToolBox
} // namespace ORUtils
#endif // ROOTCORE
#endif // ASSOCIATIONUTILS_ORTOOLBOX_H
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_OBJLINKOVERLAPTOOL_H
#define ASSOCIATIONUTILS_OBJLINKOVERLAPTOOL_H
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ASSOCIATIONUTILS_OVERLAPDECORATIONHELPER_H
#define ASSOCIATIONUTILS_OVERLAPDECORATIONHELPER_H
......
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