ATLAS Offline Software
Loading...
Searching...
No Matches
CP::IsolationCloseByCorrectionTool Class Reference

#include <IsolationCloseByCorrectionTool.h>

Inheritance diagram for CP::IsolationCloseByCorrectionTool:

Classes

struct  ObjectCache

Public Types

enum  TopoConeCorrectionModel { SubtractObjectsDirectly = -1 , UseAveragedDecorators = 0 }
using caloDecorNames = std::array<std::string, 4>
using IsoHelperMap = std::map<IsoType, std::unique_ptr<IsoVariableHelper>>
using PrimaryCollection = std::set<const xAOD::IParticle*>
 Helper struct to collect all relevant objects for the procedure.

Public Member Functions

 IsolationCloseByCorrectionTool (const std::string &name)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual CorrectionCode getCloseByCorrection (std::vector< float > &corrections, const xAOD::IParticle &par, const std::vector< xAOD::Iso::IsolationType > &types, const xAOD::IParticleContainer &closePar) const override
virtual asg::AcceptData acceptCorrected (const xAOD::IParticle &x, const xAOD::IParticleContainer &closePar) const override
virtual CorrectionCode getCloseByIsoCorrection (const EventContext &ctx, const xAOD::ElectronContainer *Electrons, const xAOD::MuonContainer *Muons, const xAOD::PhotonContainer *Photons) const override
virtual float getOriginalIsolation (const xAOD::IParticle &P, IsoType type) const override
virtual float getOriginalIsolation (const xAOD::IParticle *particle, IsoType type) const override
TrackSet getTrackCandidates (const EventContext &ctx, const xAOD::IParticle *particle) const override
 Load all TrackParticles associated with the particles in the Container. The particles have to pass the selection decoration flag.
const xAOD::IParticle * isoRefParticle (const xAOD::IParticle *particle) const override
 Retrieve the reference particle to define the cone axis in which the track particles contributing to the isolation have to be.
void associateCluster (const xAOD::IParticle *particle, float &eta, float &phi, float &energy) const override
 Retrieve the associated clusters from the Particle and calculate the average eta/phi/energy.
void associateFlowElement (const EventContext &ctx, const xAOD::IParticle *particle, float &eta, float &phi, float &energy) const override
void getExtrapEtaPhi (const xAOD::IParticle *particlear, float &eta, float &phi) const
void loadPrimaryParticles (const xAOD::IParticleContainer *container, ObjectCache &cache) const
 Filter all electrons/muons/photons from the collection which pass the selection decoration.
void loadAssociatedObjects (const EventContext &ctx, ObjectCache &cache) const
 Load all associated tracks / clusters / flow elements into the cache.
bool isSame (const xAOD::IParticle *particle, const xAOD::IParticle *particle1) const
bool overlap (const xAOD::IParticle *particle, const xAOD::IParticle *particle1, float dR) const
float deltaR2 (const xAOD::IParticle *particle, const xAOD::IParticle *particle1, bool AvgCalo=false) const
const xAOD::Vertex * retrieveIDBestPrimaryVertex (const EventContext &ctx) const
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Static Public Member Functions

static const caloDecorNames & caloDecors ()
 Returns an array with the calo cluster decoration names [0]-> eta, [1]->phi, [2]->energy. [3]->isDecorated.
static const caloDecorNames & pflowDecors ()
static bool isFixedTrackIso (xAOD::Iso::IsolationType type)
static bool isVarTrackIso (xAOD::Iso::IsolationType type)
static bool isFixedTrackIsoTTVA (xAOD::Iso::IsolationType type)
static bool isVarTrackIsoTTVA (xAOD::Iso::IsolationType Iso)
static bool isTrackIso (xAOD::Iso::IsolationType type)
static bool isTrackIsoTTVA (xAOD::Iso::IsolationType type)
static float trackPtCut (xAOD::Iso::IsolationType type)
static bool isTopoEtIso (xAOD::Iso::IsolationType type)
static bool isPFlowIso (xAOD::Iso::IsolationType type)
static bool isEgamma (const xAOD::IParticle *particle)
static float clusterEtMinusTile (const xAOD::CaloCluster *C)
static std::string particleName (const xAOD::IParticle *C)
static std::string particleName (xAOD::Type::ObjectType T)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

void isoTypesFromWP (const std::vector< std::unique_ptr< IsolationWP > > &WP, IsoVector &types)
 Helper function to load all Isolation types from the iso working points.
TrackSet getAssociatedTracks (const xAOD::IParticle *P) const
 Retrieve all Inner detector tracks associated with the primary particle.
TrackSet getAssociatedTracks (const xAOD::IParticle *P, const xAOD::Vertex *vtx) const
 Retrieve the subset of tracks passing the isolation selection.
void getAssocFlowElements (const EventContext &ctx, ObjectCache &cache) const
 Retrieve all Flow elements associated with the particles in the cache.
CorrectionCode performCloseByCorrection (const EventContext &ctx, ObjectCache &cache) const
void lockDecorations (const xAOD::IParticleContainer *parts, const IsoVector &isoTypes) const
const IsoVector & getIsolationTypes (const xAOD::IParticle *particle) const
CorrectionCode subtractCloseByContribution (const EventContext &ctx, const xAOD::IParticle *P, ObjectCache &cache) const
CorrectionCode getCloseByCorrectionTrackIso (const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
CorrectionCode getCloseByCorrectionTopoIso (const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, ObjectCache &cache, float &isoValue) const
CorrectionCode getCloseByCorrectionPflowIso (const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
CorrectionCode copyIsoValuesForPartsNotSelected (const xAOD::IParticle *part) const
ClusterSet getAssociatedClusters (const EventContext &ctx, const xAOD::IParticle *particle, ObjectCache &cache) const
 Loads the topo clusters associated with the primary IParticle.
PflowSet getAssocFlowElements (const EventContext &ctx, const xAOD::IParticle *particle) const
 Loads the pflow elements associated with the primary IParticle.
bool getExtrapEtaPhi (const EventContext &ctx, const xAOD::TrackParticle *tp, float &eta, float &phi) const
 helper to get eta,phi of muon extrap
float coneSize (const xAOD::IParticle *particle, IsoType Cone) const
float unCalibPt (const xAOD::IParticle *particle) const
bool passSelectionQuality (const xAOD::IParticle *particle) const
bool passFirstStage (const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx) const
 The Track particle has to pass the Track selection tool and the TTVA selection.
void printIsolationCones (const IsoVector &types, xAOD::Type::ObjectType T) const
void declareDependency (const std::vector< std::string > &containers, const IsoVector &types)
 Helper function to declare the data dependencies.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< InDet::IInDetTrackSelectionTool > m_trkselTool
ToolHandle< CP::ITrackVertexAssociationTool > m_ttvaTool
ToolHandle< CP::IIsolationSelectionTool > m_selectorTool
Gaudi::Property< std::string > m_quality_name
Gaudi::Property< std::string > m_passOR_name
Gaudi::Property< std::string > m_isoSelection_name {this, "IsolationSelectionDecorator", "", "Name of the final isolation decorator."}
Gaudi::Property< std::string > m_backup_prefix
Gaudi::Property< std::string > m_isoDecSuffix
Gaudi::Property< std::string > m_caloDecSuffix
Gaudi::Property< int > m_caloModel {this, "CaloCorrectionModel", TopoConeCorrectionModel::SubtractObjectsDirectly}
 EXPERT PROPERTIES.
Gaudi::Property< float > m_coreConeEl
Gaudi::Property< float > m_coreConeMu {this, "CoreConeMuons", 0.05, "This is the size of the core cone for the topoetcone variables."}
Gaudi::Property< float > m_ptvarconeRadius {this, "PtvarconeRadius", 1.e4, "This is the kT parameter for the ptvarcone variables."}
Gaudi::Property< float > m_maxTopoPolution
Gaudi::Property< float > m_ConeSizeVariation
Gaudi::Property< bool > m_declareCaloDecors {this, "declareCaloDecors", false, "If set to true, the data dependency on the calo/pflow decors will be declared"}
Gaudi::Property< std::vector< std::string > > m_elecKeys
 Declare the data dependencies of the Input containers.
Gaudi::Property< std::vector< std::string > > m_muonKeys
Gaudi::Property< std::vector< std::string > > m_photKeys
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_isoVarKeys
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_isoWriteDecVarKeys
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool {this, "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"}
 calo extension tool for muon track particle extrapolation to calo
SG::ReadHandleKey< xAOD::VertexContainer > m_VtxKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_CaloClusterKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_PflowKey
IsoVector m_muon_isoTypes {}
 Isolation variables used by the muon working point.
IsoVector m_electron_isoTypes {}
 Isolation variables used by the electron working point.
IsoVector m_photon_isoTypes {}
 Isolation variables used by the photon working point.
bool m_has_nonTTVA {false}
 Switch whether a pile-up non robust TTVA working point is defined.
bool m_hasPflowIso {false}
 Switch whether a pflow isolation working point is defined.
bool m_hasEtConeIso {false}
 Switch whether a topoetcone isolation working point is defined.
bool m_isInitialised {false}
SelectionAccessor m_acc_quality {nullptr}
SelectionAccessor m_acc_passOR {nullptr}
SelectionDecorator m_dec_isoselection {nullptr}
IsoHelperMap m_isohelpers ATLAS_THREAD_SAFE
std::mutex m_isoHelpersMutex ATLAS_THREAD_SAFE
 Mutex to protect the map if the method with signature getCloseByCorrection(std::vector<float>& corrections, const xAOD::IParticle& par, const std::vector<xAOD::Iso::IsolationType>& types, const xAOD::IParticleContainer& closePar) is called.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 37 of file IsolationCloseByCorrectionTool.h.

Member Typedef Documentation

◆ caloDecorNames

using CP::IsolationCloseByCorrectionTool::caloDecorNames = std::array<std::string, 4>

Definition at line 45 of file IsolationCloseByCorrectionTool.h.

◆ IsoHelperMap

◆ PrimaryCollection

Helper struct to collect all relevant objects for the procedure.

Definition at line 84 of file IsolationCloseByCorrectionTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ TopoConeCorrectionModel

Constructor & Destructor Documentation

◆ IsolationCloseByCorrectionTool()

CP::IsolationCloseByCorrectionTool::IsolationCloseByCorrectionTool ( const std::string & name)

Definition at line 44 of file IsolationCloseByCorrectionTool.cxx.

44: asg::AsgTool(toolName) {}

Member Function Documentation

◆ acceptCorrected()

asg::AcceptData CP::IsolationCloseByCorrectionTool::acceptCorrected ( const xAOD::IParticle & x,
const xAOD::IParticleContainer & closePar ) const
overridevirtual

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 937 of file IsolationCloseByCorrectionTool.cxx.

938 {
939 if (!m_isInitialised) { ATH_MSG_WARNING("The IsolationCloseByCorrectionTool was not initialised!!!"); }
940 assert(!m_selectorTool.empty());
941 const IsoVector& iso_types = getIsolationTypes(&x);
942 if (iso_types.empty()) {
943 // TODO: figure out if this is actually a valid situation
944 // or if we should just fail at this point.
945 ATH_MSG_WARNING("Could not cast particle for acceptCorrected. Will return false.");
946 static const asg::AcceptInfo dummyAcceptInfo = []() {
947 asg::AcceptInfo info;
948 info.addCut("castCut", "whether we managed to cast to a known type");
949 return info;
950 }();
951 if (m_dec_isoselection) (*m_dec_isoselection)(x) = false;
952 return asg::AcceptData(&dummyAcceptInfo);
953 }
954
955 if (closePar.empty()) return m_selectorTool->accept(x);
956 strObj strPar;
957 strPar.isolationValues.resize(numIsolationTypes);
958 strPar.pt = x.pt();
959 strPar.eta = x.eta();
960 strPar.type = x.type();
961 std::vector<float> corrections;
962 if (getCloseByCorrection(corrections, x, iso_types, closePar) == CorrectionCode::Error) {
963 ATH_MSG_WARNING("Could not calculate the corrections. acceptCorrected(x) is done without the corrections.");
964 if (m_dec_isoselection) (*m_dec_isoselection)(x) = bool(m_selectorTool->accept(x));
965 return m_selectorTool->accept(x);
966 }
967 for (unsigned int i = 0; i < iso_types.size(); ++i) {
968 strPar.isolationValues.at(iso_types[i]) = corrections.at(i);
969 const SG::Accessor<float>* acc = xAOD::getIsolationAccessor(iso_types[i]);
970 if (acc)[[likely]]{
971 float old = (*acc)(x);
972 ATH_MSG_DEBUG("Correcting " << toString(iso_types[i]) << " from " << old << " to " << corrections[i]);
973 }
974 }
975 auto accept = m_selectorTool->accept(strPar);
976 if (m_dec_isoselection) (*m_dec_isoselection)(x) = bool(accept);
977 return accept;
978 }
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define x
@ Error
Some error happened during the object correction.
ToolHandle< CP::IIsolationSelectionTool > m_selectorTool
const IsoVector & getIsolationTypes(const xAOD::IParticle *particle) const
virtual CorrectionCode getCloseByCorrection(std::vector< float > &corrections, const xAOD::IParticle &par, const std::vector< xAOD::Iso::IsolationType > &types, const xAOD::IParticleContainer &closePar) const override
bool empty() const noexcept
Returns true if the collection is empty.
StatusCode accept(const xAOD::Muon *mu)
const SG::Accessor< float > * getIsolationAccessor(Iso::IsolationType type)
Get the Accessor object for a given isolation type.
std::string toString(const SG::AuxElement &obj)
static const SG::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
#define likely(x)

◆ associateCluster()

void CP::IsolationCloseByCorrectionTool::associateCluster ( const xAOD::IParticle * particle,
float & eta,
float & phi,
float & energy ) const
overridevirtual

Retrieve the associated clusters from the Particle and calculate the average eta/phi/energy.

Remove super low energy clusters

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 869 of file IsolationCloseByCorrectionTool.cxx.

869 {
870 phi = particle->phi();
871 eta = particle->eta();
872 energy = -1.;
873 if (particle->type() == xAOD::Type::ObjectType::Muon) {
874 const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(particle);
875 const xAOD::CaloCluster* cluster = mu->cluster();
876 if (!cluster) return;
877 energy = cluster->e();
878 // At the moment no cluster associated with muons is in the derivations
879 int nSample{0};
880 float etaT{0.f}, phiT{0.f}, dphiT{0.f};
881
882 for (unsigned int i = 0; i < CaloSampling::Unknown; ++i) {
884 if (cluster->hasSampling(s)) {
885 ATH_MSG_VERBOSE("Sampling: " << i << "eta-phi (" << cluster->etaSample(s) << ", " << cluster->phiSample(s) << ")");
886 etaT += cluster->etaSample(s);
887 if (!nSample)
888 phiT = cluster->phiSample(s);
889 else
890 dphiT += xAOD::P4Helpers::deltaPhi(cluster->phiSample(s), phiT);
891 ++nSample;
892 }
893 }
894 if (!nSample) return;
895 ATH_MSG_DEBUG("Eta, phi before sampling: " << eta << ", " << phi << " and after sampling: " << etaT / nSample << ", "
896 << phiT / nSample);
897 phi = xAOD::P4Helpers::deltaPhi(phiT + dphiT / nSample, 0);
898 eta = etaT / nSample;
899 ATH_MSG_VERBOSE("associateCluster: mu with pt: " << mu->pt() * MeVtoGeV << " GeV, eta: "
900 << mu->eta() << ", phi: " << mu->phi() << " energy, eta, phi " << energy << ", " << eta << ", " << phi
901 << ", et " << energy * mu->pt() / mu->e());
902 }
903 if (!isEgamma(particle)) return;
904 const xAOD::Egamma* egamm = static_cast<const xAOD::Egamma*>(particle);
905 eta = phi = energy = 0.;
906 for (unsigned int cl = 0; cl < egamm->nCaloClusters(); ++cl) {
907 const xAOD::CaloCluster* prim_cluster = egamm->caloCluster(cl);
908 if (!prim_cluster) {
909 ATH_MSG_DEBUG("Cluster " << cl << " is not defined " << egamm);
910 continue;
911 }
912 std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(prim_cluster);
913 for (const xAOD::CaloCluster* cluster : constituents) {
914 if (!cluster) continue;
915 const float clus_e = clusterEtMinusTile(cluster);
917 if (clus_e < MinClusterEnergy) continue;
918 eta += cluster->eta() * clus_e;
919 phi += cluster->phi() * clus_e;
920 energy += clus_e;
921 ATH_MSG_VERBOSE("associateCluster: eg add in clus with e: " << clus_e * MeVtoGeV << " clus et " << cluster->pt() * MeVtoGeV << " GeV, eta: "
922 << cluster->eta() << ", phi: " << cluster->phi());
923 }
924 }
925 if (energy >= MinClusterEnergy) {
926 phi = xAOD::P4Helpers::deltaPhi(phi / energy, 0.);
927 eta /= energy;
928 ATH_MSG_VERBOSE("associateCluster: eg with pt: " << egamm->pt() * MeVtoGeV << " GeV, eta: "
929 << egamm->eta() << ", phi: " << egamm->phi() << " energy, eta, phi " << energy << ", " << eta << ", " << phi );
930 } else {
931 ATH_MSG_DEBUG("Average energy from the clusters is too low " << energy << " copy particle properties");
932 eta = egamm->eta();
933 phi = egamm->phi();
934 energy = egamm->e();
935 }
936 }
Scalar eta() const
pseudorapidity method
#define ATH_MSG_VERBOSE(x,...)
static bool isEgamma(const xAOD::IParticle *particle)
static float clusterEtMinusTile(const xAOD::CaloCluster *C)
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters).
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition Egamma_v1.cxx:66
virtual double e() const override
The total energy of the particle.
Definition Egamma_v1.cxx:86
size_t nCaloClusters() const
Return the number of xAOD::CaloClusters that define the electron candidate.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition Egamma_v1.cxx:71
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
Definition Egamma_v1.cxx:76
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
constexpr float MeVtoGeV
constexpr float MinClusterEnergy
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
@ Muon
The object is a muon.
Definition ObjectType.h:48
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13

◆ associateFlowElement()

void CP::IsolationCloseByCorrectionTool::associateFlowElement ( const EventContext & ctx,
const xAOD::IParticle * particle,
float & eta,
float & phi,
float & energy ) const
overridevirtual

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 845 of file IsolationCloseByCorrectionTool.cxx.

846 {
847 phi = eta = energy = 0.;
848 PflowSet flowCollection = getAssocFlowElements(ctx, particle);
849 if (flowCollection.empty()) {
850 phi = particle->phi();
851 eta = particle->eta();
852 return;
853 }
854 for (const FlowElementPtr& ele : flowCollection) {
855 const float flow_energy = ele->e() * ele.weight;
856 if (flow_energy < MinClusterEnergy) continue;
857 phi += ele->phi() * flow_energy;
858 eta += ele->eta() * flow_energy;
859 energy += flow_energy;
860 }
861 if (energy < MinClusterEnergy) {
862 phi = particle->phi();
863 eta = particle->eta();
864 return;
865 }
866 phi = xAOD::P4Helpers::deltaPhi(phi / energy, 0.);
867 eta /= energy;
868 }
void getAssocFlowElements(const EventContext &ctx, ObjectCache &cache) const
Retrieve all Flow elements associated with the particles in the cache.

◆ caloDecors()

const caloDecorNames & CP::IsolationCloseByCorrectionTool::caloDecors ( )
static

Returns an array with the calo cluster decoration names [0]-> eta, [1]->phi, [2]->energy. [3]->isDecorated.

Definition at line 29 of file IsolationCloseByCorrectionTool.cxx.

29 {
30 static const caloDecorNames names =
31 {"IsoCloseByCorr_assocClustEta", "IsoCloseByCorr_assocClustPhi", "IsoCloseByCorr_assocClustEnergy",
32 "IsoCloseByCorr_assocClustDecor"};
33 return names;
34 }
static const SG::Accessor< std::vector< std::string > > names("thrNames")
Accessor for the names of the passed thresholds.

◆ clusterEtMinusTile()

float CP::IsolationCloseByCorrectionTool::clusterEtMinusTile ( const xAOD::CaloCluster * C)
static

Definition at line 1069 of file IsolationCloseByCorrectionTool.cxx.

1069 {
1070 float Et{0.f};
1071 if (cluster) {
1072 try {
1073 Et = cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Et();
1074 Et = Et - cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap3) /
1075 std::cosh(cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Eta());
1076 } catch (...) { Et = cluster->p4().Et(); }
1077 }
1078 return std::max(Et, 0.f);
1079 }

◆ coneSize()

float CP::IsolationCloseByCorrectionTool::coneSize ( const xAOD::IParticle * particle,
IsoType Cone ) const
private

Definition at line 995 of file IsolationCloseByCorrectionTool.cxx.

995 {
997 float ConeDR = coneSize(Cone);
999 const xAOD::IParticle* Reference = isoRefParticle(P);
1000 float MiniIso = m_ptvarconeRadius / unCalibPt(Reference);
1001 if (MiniIso < ConeDR) return MiniIso;
1002 }
1003 return ConeDR;
1004 }
static Double_t P(Double_t *tt, Double_t *par)
const xAOD::IParticle * isoRefParticle(const xAOD::IParticle *particle) const override
Retrieve the reference particle to define the cone axis in which the track particles contributing to ...
float unCalibPt(const xAOD::IParticle *particle) const
static bool isVarTrackIso(xAOD::Iso::IsolationType type)
static bool isVarTrackIsoTTVA(xAOD::Iso::IsolationType Iso)
float coneSize(const xAOD::IParticle *particle, IsoType Cone) const
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size

◆ copyIsoValuesForPartsNotSelected()

CorrectionCode CP::IsolationCloseByCorrectionTool::copyIsoValuesForPartsNotSelected ( const xAOD::IParticle * part) const
private

Definition at line 421 of file IsolationCloseByCorrectionTool.cxx.

421 {
422 const IsoVector& types = getIsolationTypes(part);
423
424 ATH_MSG_DEBUG("copyIsoValuesForPartsNotSelected " << part->type() << " " << part->pt() * MeVtoGeV << " GeV" << " eta: " << part->eta() << " phi: " << part->phi());
425
426 if (types.empty()) {
427 ATH_MSG_WARNING("No isolation types are defiend for " << particleName(part));
429 }
430 for (const IsolationType iso_type : types) {
431 float iso_variable{0.f};
432 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
433 if (m_isohelpers.at(iso_type)->getIsolation(part, iso_variable) == CorrectionCode::Error) {
434 ATH_MSG_ERROR("Cannot get value for " << toString(iso_type));
435 return CorrectionCode::Error;
436 }
437 ATH_MSG_DEBUG("copyIsoValuesForPartsNotSelected: Set pt, eta " << part->pt() << ", " << part->eta() << ", " << part->phi() << " for " << toString(iso_type) << " to " << iso_variable);
438 if (!std::isfinite(iso_variable)) {
439 ATH_MSG_WARNING("Copying non-finite " << toString(iso_type) << " = " << iso_variable << " of particle with pt: " << part->pt() * MeVtoGeV << " GeV eta: " << part->eta() << " phi: " << part->phi());
440 }
441 if (m_isohelpers.at(iso_type)->setIsolation(part, iso_variable, true) == CorrectionCode::Error) {
442 ATH_MSG_ERROR("Cannot set " << toString(iso_type) << " to " << iso_variable);
443 return CorrectionCode::Error;
444 }
445 }
446 return CorrectionCode::Ok;
447 }
#define ATH_MSG_ERROR(x,...)
static const std::vector< std::string > types
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
static std::string particleName(const xAOD::IParticle *C)
IsolationType
Overall enumeration for isolation types in xAOD files.

◆ declareDependency()

void CP::IsolationCloseByCorrectionTool::declareDependency ( const std::vector< std::string > & containers,
const IsoVector & types )
private

Helper function to declare the data dependencies.

Definition at line 127 of file IsolationCloseByCorrectionTool.cxx.

127 {
128 for (const std::string& cont : containers) {
129 for (const IsoType iso : types) {
130 // define read accessor iso variable keys
131 m_isoVarKeys.emplace_back(cont + "." + std::string(toString(iso)));
132 // define write decorator iso variable keys - needed for MT, but we do not use handles for writing the decorators in isoHelpers
133 m_isoWriteDecVarKeys.emplace_back(cont + "." + std::string(toString(iso) + (m_isoDecSuffix.empty() ? "" : "_") + m_isoDecSuffix));
134 }
137 for (const std::string& decor : pflowDecors()) m_isoVarKeys.emplace_back(cont + "." + decor);
138 }
140 for (const std::string& decor : caloDecors()) m_isoVarKeys.emplace_back(cont + "." + decor + m_caloDecSuffix);
141 }
142 }
143 }
bool m_hasPflowIso
Switch whether a pflow isolation working point is defined.
bool m_hasEtConeIso
Switch whether a topoetcone isolation working point is defined.
static const caloDecorNames & caloDecors()
Returns an array with the calo cluster decoration names [0]-> eta, [1]->phi, [2]->energy....
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_isoVarKeys
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_isoWriteDecVarKeys
Gaudi::Property< int > m_caloModel
EXPERT PROPERTIES.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ deltaR2()

float CP::IsolationCloseByCorrectionTool::deltaR2 ( const xAOD::IParticle * particle,
const xAOD::IParticle * particle1,
bool AvgCalo = false ) const

Definition at line 1039 of file IsolationCloseByCorrectionTool.cxx.

1039 {
1040 if (isSame(P, P1)) return 0.;
1041 // Check if one of the objects is a CaloCluster or the Averaging over the clusters is requested.
1042 if (AvgCalo || (P->type() != P1->type() &&
1044 float phi1{0.f}, eta1{0.f}, eta2{0.f}, phi2{0.f};
1045 getExtrapEtaPhi(P, eta1, phi1);
1046 getExtrapEtaPhi(P1, eta2, phi2);
1047 return xAOD::P4Helpers::deltaR2(eta1, phi1, eta2, phi2);
1048 }
1049 float dPhi = xAOD::P4Helpers::deltaPhi(P, P1);
1050 float dEta = P->eta() - P1->eta();
1051 return dEta * dEta + dPhi * dPhi;
1052 }
bool getExtrapEtaPhi(const EventContext &ctx, const xAOD::TrackParticle *tp, float &eta, float &phi) const
helper to get eta,phi of muon extrap
bool isSame(const xAOD::IParticle *particle, const xAOD::IParticle *particle1) const
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
setEt setPhi setE277 setWeta2 eta1

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAssocFlowElements() [1/2]

PflowSet CP::IsolationCloseByCorrectionTool::getAssocFlowElements ( const EventContext & ctx,
const xAOD::IParticle * particle ) const
private

Loads the pflow elements associated with the primary IParticle.

Definition at line 191 of file IsolationCloseByCorrectionTool.cxx.

191 {
193 cache.prim_parts = {particle};
194 loadAssociatedObjects(ctx, cache);
195 return cache.flows;
196 }
void loadAssociatedObjects(const EventContext &ctx, ObjectCache &cache) const
Load all associated tracks / clusters / flow elements into the cache.
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.

◆ getAssocFlowElements() [2/2]

void CP::IsolationCloseByCorrectionTool::getAssocFlowElements ( const EventContext & ctx,
ObjectCache & cache ) const
private

Retrieve all Flow elements associated with the particles in the cache.

Definition at line 198 of file IsolationCloseByCorrectionTool.cxx.

198 {
199 if (m_PflowKey.empty()) return;
200 SG::ReadHandle<xAOD::FlowElementContainer> readHandle{m_PflowKey, ctx};
201 if (!readHandle.isValid()) return;
202 std::set<const xAOD::IParticle*> tombola{};
203 for (const xAOD::IParticle* p : cache.prim_parts) tombola.insert(p);
204 for (const TrackPtr& p : cache.tracks) tombola.insert(p);
205 for (const CaloClusterPtr& p : cache.clusters) tombola.insert(p);
206
207 for (const xAOD::FlowElement* flow : *readHandle) {
208 if (!flow) continue;
209 for (size_t ch = 0; ch < flow->nChargedObjects(); ++ch) {
210 const xAOD::IParticle* obj = flow->chargedObject(ch);
211 if (tombola.count(obj)) {
212 const std::vector<float>& weights = flow->chargedObjectWeights();
213 cache.flows.emplace(flow, ch < weights.size() ? weights[ch] : 1.f);
214 }
215 }
216 for (size_t ne = 0; ne < flow->nOtherObjects(); ++ne) {
217 const xAOD::IParticle* obj = flow->otherObject(ne);
218 if (tombola.count(obj)) {
219 const std::vector<float>& weights = flow->otherObjectWeights();
220 cache.flows.emplace(flow, ne < weights.size() ? weights[ne] : 1.f);
221 ATH_MSG_VERBOSE("getAssocFlowElements: neflow " << ne << ", " << obj->type() << ", " << obj->pt() << ", " << obj->eta() << ", " << obj->phi() << ", " << flow->pt() << ", " << flow->eta() << ", " << flow->phi());
222 }
223 }
224 }
225 }
SG::ReadHandleKey< xAOD::FlowElementContainer > m_PflowKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
int flow(const T &p, int i)
Definition Flow.h:15
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16

◆ getAssociatedClusters()

ClusterSet CP::IsolationCloseByCorrectionTool::getAssociatedClusters ( const EventContext & ctx,
const xAOD::IParticle * particle,
ObjectCache & cache ) const
private

Loads the topo clusters associated with the primary IParticle.

Definition at line 548 of file IsolationCloseByCorrectionTool.cxx.

549 {
550 // Remember topoclusters which are associated to an egamma object, electron or photon
551 // This will be used to avoid associating the same object to a muon
553 if (isEgamma(P)) {
554 const xAOD::Egamma* egamm = static_cast<const xAOD::Egamma*>(P);
555 for (size_t calo = 0; calo < egamm->nCaloClusters(); ++calo) {
556 const xAOD::CaloCluster* clust = egamm->caloCluster(calo);
557 if (!clust) continue;
558 std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(clust);
559 for (const xAOD::CaloCluster* cluster : constituents) {
560 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy) {
561 clusters.emplace(cluster);
562 cache.eg_associated_clusters.insert(cluster); // set flag that this cluster is associated to an electron or photon
563 ATH_MSG_VERBOSE("getAssociatedClusters: " << P->type() << " has topo cluster with pt: " << cluster->pt() * MeVtoGeV << " GeV, eta: "
564 << cluster->eta() << ", phi: " << cluster->phi());
565 }
566 }
567 }
568 if (clusters.size()) return clusters;
569 }
570 if (m_CaloClusterKey.empty()) return clusters;
571 SG::ReadHandle<xAOD::CaloClusterContainer> topoClusters{m_CaloClusterKey, ctx};
572 if (!topoClusters.isValid()) return clusters;
573
574 if (P->type() == xAOD::Type::ObjectType::Muon) {
575 const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(P);
576 const xAOD::CaloCluster* cl = mu->cluster();
577 bool foundMuonTopo = false;
578 if (cl) {
579 ATH_MSG_VERBOSE("getAssociatedClusters: muon has cluster with pt: " << cl->pt() * MeVtoGeV << " GeV, eta: "
580 << cl->eta() << ", phi: " << cl->phi());
581 std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(cl);
582 for (const xAOD::CaloCluster* cluster : constituents) {
583 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy) {
584 // skip association if this cluster is already associated with an electron or photon - priority is given to egamma reco
585 if (!cache.eg_associated_clusters.contains(cluster)) {
586 clusters.emplace(cluster);
587 foundMuonTopo = true;
588 ATH_MSG_VERBOSE("getAssociatedClusters: muon has topo cluster with pt: " << cluster->pt() * MeVtoGeV << " GeV, eta: "
589 << cluster->eta() << ", phi: " << cluster->phi());
590 }
591 else {
592 ATH_MSG_VERBOSE("getAssociatedClusters: muon topo cluster already associated with an EG objet - cluster with pt: "
593 << cluster->pt() * MeVtoGeV << " GeV, eta: " << cluster->eta() << ", phi: " << cluster->phi());
594 }
595 }
596 }
597 }
598 if (!foundMuonTopo) {
599#ifndef XAOD_ANALYSIS
600 // extraploate muon to calo and look for matching topo cluster
601 const xAOD::TrackParticle* tp = mu->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
602 if (tp) {
603 ATH_MSG_VERBOSE("getAssociatedClusters: found mu tp " << " with pt: " << tp->pt() * MeVtoGeV << " GeV, eta: " << tp->eta() << ", phi: " << tp->phi());
604 float tpEtaAtCalo;
605 float tpPhiAtCalo;
606 if (getExtrapEtaPhi(ctx, tp, tpEtaAtCalo, tpPhiAtCalo)) {
607 ATH_MSG_VERBOSE("getAssociatedClusters: tp extrapolated - tpEtaAtCalo " << tpEtaAtCalo << ", tpPhiAtCalo " << tpPhiAtCalo);
608 for (const xAOD::CaloCluster* cluster : *topoClusters) {
609 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy &&
610 xAOD::P4Helpers::deltaR(tpEtaAtCalo, tpPhiAtCalo, cluster->eta(), cluster->phi()) < m_coreConeMu) {
611 clusters.emplace(cluster);
612 ATH_MSG_VERBOSE("getAssociatedClusters: for mu trkPart save clus " << " with pt: " << cluster->pt() * MeVtoGeV << " GeV, eta: " << cluster->eta() << ", phi: " << cluster->phi() << ", tpEtaAtCalo " << tpEtaAtCalo << ", tpPhiAtCalo " << tpPhiAtCalo);
613 }
614 }
615 }
616 }
617#endif
618 }
619 }
620
621 return clusters;
622 }
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_CaloClusterKey
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ getAssociatedTracks() [1/2]

TrackSet CP::IsolationCloseByCorrectionTool::getAssociatedTracks ( const xAOD::IParticle * P) const
private

Retrieve all Inner detector tracks associated with the primary particle.

Definition at line 509 of file IsolationCloseByCorrectionTool.cxx.

509 {
510 TrackSet to_return{};
511 if (P->type() == xAOD::Type::Muon) {
512 const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(P);
513 if (mu->muonType() != xAOD::Muon::MuonType::SiliconAssociatedForwardMuon)
514 to_return.emplace(mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle));
515 } else if (P->type() == xAOD::Type::TrackParticle) {
516 const xAOD::TrackParticle* trk = static_cast<const xAOD::TrackParticle*>(P);
517 to_return.emplace(trk);
518 } else if (isEgamma(P)) {
519 const xAOD::Egamma* EG = static_cast<const xAOD::Egamma*>(P);
520 std::set<const xAOD::TrackParticle*> trk_vec = xAOD::EgammaHelpers::getTrackParticles(EG, true, true);
521 for (const xAOD::TrackParticle* trk : trk_vec) {
522 ATH_MSG_VERBOSE("Adding egamma track with "
523 << trk->pt() * MeVtoGeV << " GeV, eta: " << trk->eta() << ", phi: " << trk->phi());
524 to_return.emplace(trk);
525 }
526 }
527 return to_return;
528 }
@ TrackParticle
The object is a charged track particle.
Definition ObjectType.h:43
std::set< const xAOD::TrackParticle * > getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.

◆ getAssociatedTracks() [2/2]

TrackSet CP::IsolationCloseByCorrectionTool::getAssociatedTracks ( const xAOD::IParticle * P,
const xAOD::Vertex * vtx ) const
private

Retrieve the subset of tracks passing the isolation selection.

Definition at line 529 of file IsolationCloseByCorrectionTool.cxx.

529 {
530 const TrackSet assoc_tracks = getAssociatedTracks(P);
531 TrackSet to_ret{};
532 for (const TrackPtr trk : assoc_tracks) {
533 if (passFirstStage(trk, vtx)) to_ret.insert(trk);
534 }
535 return to_ret;
536 }
bool passFirstStage(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx) const
The Track particle has to pass the Track selection tool and the TTVA selection.
TrackSet getAssociatedTracks(const xAOD::IParticle *P) const
Retrieve all Inner detector tracks associated with the primary particle.

◆ getCloseByCorrection()

CorrectionCode CP::IsolationCloseByCorrectionTool::getCloseByCorrection ( std::vector< float > & corrections,
const xAOD::IParticle & par,
const std::vector< xAOD::Iso::IsolationType > & types,
const xAOD::IParticleContainer & closePar ) const
overridevirtual

Check first if all isolation types are known to the tool

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 450 of file IsolationCloseByCorrectionTool.cxx.

452 {
453
454 if (!m_isInitialised) {
455 ATH_MSG_ERROR("The IsolationCloseByCorrectionTool was not initialised!!!");
457 }
459 {
460 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
461 for (const IsolationType& t : types) {
462 IsoHelperMap::const_iterator Itr = m_isohelpers.find(t);
463 if (Itr != m_isohelpers.end()) { continue; }
464 Itr = m_isohelpers.insert(std::make_pair(t, std::make_unique<IsoVariableHelper>(t, m_backup_prefix, m_isoDecSuffix))).first;
465 }
466 }
467 corrections.assign(types.size(), 0);
469 loadPrimaryParticles(&closePar, cache);
470 const EventContext& ctx = Gaudi::Hive::currentContext();
471 loadAssociatedObjects(ctx, cache);
472 std::vector<float>::iterator Cone = corrections.begin();
473 for (const IsolationType& iso_type : types) {
474 {
475 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
476 IsoHelperMap::const_iterator Itr = m_isohelpers.find(iso_type);
477 if (Itr->second->backupIsolation(&par) == CP::CorrectionCode::Error) {
478 ATH_MSG_ERROR("Failed to backup isolation");
480 }
481 }
482 if (isTrackIso(iso_type)) {
483 if (getCloseByCorrectionTrackIso(&par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
484 ATH_MSG_ERROR("Failed to apply track correction");
486
487 }
488 }
489 else if (isTopoEtIso(iso_type)) {
490 if (getCloseByCorrectionTopoIso(ctx, &par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
491 ATH_MSG_ERROR("Failed to apply topo cluster correction");
493 }
494 }
495 else if (isPFlowIso(iso_type)) {
496 if (getCloseByCorrectionPflowIso(ctx, &par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
497 ATH_MSG_ERROR("Failed to apply pflow correction");
499 }
500 }
501 ++Cone;
502 }
503 return CorrectionCode::Ok;
504 }
CorrectionCode getCloseByCorrectionTopoIso(const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, ObjectCache &cache, float &isoValue) const
CorrectionCode getCloseByCorrectionTrackIso(const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
static bool isTrackIso(xAOD::Iso::IsolationType type)
void loadPrimaryParticles(const xAOD::IParticleContainer *container, ObjectCache &cache) const
Filter all electrons/muons/photons from the collection which pass the selection decoration.
CorrectionCode getCloseByCorrectionPflowIso(const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
static bool isTopoEtIso(xAOD::Iso::IsolationType type)
static bool isPFlowIso(xAOD::Iso::IsolationType type)

◆ getCloseByCorrectionPflowIso()

CorrectionCode CP::IsolationCloseByCorrectionTool::getCloseByCorrectionPflowIso ( const EventContext & ctx,
const xAOD::IParticle * primary,
const IsoType type,
const ObjectCache & cache,
float & isoValue ) const
private

Disable the correction of already isolated objects

Find the pflow elements associated with this primary

Definition at line 672 of file IsolationCloseByCorrectionTool.cxx.

674 {
675 if (!isPFlowIso(type)) {
676 ATH_MSG_ERROR("getCloseByCorrectionPflowIso() -- The isolation type is not a Pflow variable " << toString(type));
678 }
679 if (m_isohelpers.at(type)->getOriginalIsolation(primary, isoValue) == CorrectionCode::Error) {
680 ATH_MSG_ERROR("getCloseByCorrectionPflowIso() -- Could not retrieve the isolation variable.");
682 }
684 if (isoValue <= 0.) {
685 ATH_MSG_DEBUG("Pflow varible is already sufficiently isolated ");
686 return CorrectionCode::Ok;
687 }
688 const float coneDR = coneSize(primary, type);
689 float ref_eta{0.f}, ref_phi{0.f};
690 getExtrapEtaPhi(primary, ref_eta, ref_phi);
693 ATH_MSG_VERBOSE("getCloseByCorrectionPflowIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
694 << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
695 << ", phi: " << primary->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. ");
696 PflowSet assoc_coll = getAssocFlowElements(ctx, primary);
697 for (const FlowElementPtr& flow : cache.flows) {
698 ATH_MSG_VERBOSE("Loop over pflow element: " << flow->pt() << " GeV, eta: " << flow->eta() << " phi: " << flow->phi());
699
700 const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi, flow->eta(),flow->phi());
702 ATH_MSG_VERBOSE("Flow element is in core cone");
703 continue;
704 }
705 if (assoc_coll.count(flow)) {
706 ATH_MSG_VERBOSE("Flow element is directly associated with the object");
707 continue;
708 }
709 if (dR < coneDR) {
710 ATH_MSG_VERBOSE("Found overlapping pflow element: " << flow->pt() << " GeV, eta: " << flow->eta()
711 << " phi: " << flow->phi() << " dR: " << dR);
712 isoValue -= flow->pt() * flow.weight;
713 }
714 }
715 ATH_MSG_VERBOSE("getCloseByCorrectionPflowIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
716 << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
717 << ", phi: " << primary->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV. ");
719 static const FloatAccessor acc_eta{pflowDecors()[0]};
720 static const FloatAccessor acc_phi{pflowDecors()[1]};
721 static const FloatAccessor acc_ene{pflowDecors()[2]};
722 static const CharAccessor acc_isDecor{pflowDecors()[3]};
723 for (const xAOD::IParticle* others : cache.prim_parts) {
724 if (others == primary) continue;
725 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
726 ATH_MSG_ERROR("The variable energy averaged pflow decorations are not available for "<<particleName(others)<<". Please check");
728 }
729 const float other_eta = acc_eta(*others);
730 const float other_phi = acc_phi(*others);
731 const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi,other_eta,other_phi);
732 if (dR > coneDR) continue;
733 if (dR< (primary->type() == xAOD::Type::ObjectType::Muon ? m_coreConeMu : m_coreConeEl)) continue;
734 isoValue -= acc_ene(*others);
735 }
736 } else {
737 ATH_MSG_ERROR("Unknown calo correction model "<<m_caloModel);
739 }
740 isoValue = std::max(0.f, isoValue);
741 return CorrectionCode::Ok;
742 }

◆ getCloseByCorrectionTopoIso()

CorrectionCode CP::IsolationCloseByCorrectionTool::getCloseByCorrectionTopoIso ( const EventContext & ctx,
const xAOD::IParticle * primary,
const IsoType type,
ObjectCache & cache,
float & isoValue ) const
private

Disable the correction of already isolated objects

Definition at line 744 of file IsolationCloseByCorrectionTool.cxx.

746 {
747 // check if the isolation can be loaded
748 if (!isTopoEtIso(type)) {
749 ATH_MSG_ERROR("getCloseByCorrectionTopoIso() -- The isolation type is not an et cone variable " << toString(type));
751 }
752 {
753 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
754 if (m_isohelpers.at(type)->getOriginalIsolation(primary, isoValue) == CorrectionCode::Error) {
755 ATH_MSG_WARNING("Could not retrieve the isolation variable.");
757 }
758 }
760 if (isoValue <= 0.) {
761 ATH_MSG_DEBUG("Topo et cone variable is already sufficiently isolated");
762 return CorrectionCode::Ok;
763 }
764 float ref_eta{0.f}, ref_phi{0.f};
765 getExtrapEtaPhi(primary, ref_eta, ref_phi);
766 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with ref eta: " << ref_eta << ", ref phi " << ref_phi);
767
768 float MaxDR = coneSize(primary, type) * (primary->type() != xAOD::Type::ObjectType::Muon ? 1. : m_ConeSizeVariation.value());
770 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
771 << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
772 << ", phi: " << primary->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. ");
773 ClusterSet assoc = getAssociatedClusters(ctx, primary, cache);
774 for (const CaloClusterPtr& calo : cache.clusters) {
775 const float dR = xAOD::P4Helpers::deltaR(ref_eta, ref_phi, calo->eta(), calo->phi());
776 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: Loop over cluster: " << calo->pt() * MeVtoGeV << " GeV, eta: " << calo->eta() << " phi: " << calo->phi() << " dR: " << dR);
777 if (dR > MaxDR) continue;
778 // REMOVED CORE CUT SINCE TOPOCLUSTERS SHOULD BE ASSOCIATED TO THE ELECTRONS AND MUONS AND WILL BE CUT BY ASSOC CUT BELOW
779 if (assoc.count(calo)) {
780 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: skip due to assoc " << assoc.count(calo));
781 continue;
782 }
783 float Polution = clusterEtMinusTile(calo) / (isoValue != 0 ? isoValue : 1.);
784 if (Polution < 0. || Polution > m_maxTopoPolution) {
785 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: skip due to polution " << Polution << ", clus noTile " << clusterEtMinusTile(calo) * MeVtoGeV << " GeV");
786 continue;
787 }
788 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: Found overlapping topocluster: " << calo->pt() * MeVtoGeV << " GeV, lessTile " << clusterEtMinusTile(calo) * MeVtoGeV << " GeV, eta: " << calo->eta()
789 << " phi: " << calo->phi() << " dR: " << dR);
790 isoValue -= clusterEtMinusTile(calo);
791 }
792 ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
793 << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
794 << ", phi: " << primary->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV. ");
796 const FloatAccessor acc_eta{caloDecors()[0] + m_caloDecSuffix};
797 const FloatAccessor acc_phi{caloDecors()[1] + m_caloDecSuffix};
798 const FloatAccessor acc_ene{caloDecors()[2] + m_caloDecSuffix};
799 const CharAccessor acc_isDecor{caloDecors()[3] + m_caloDecSuffix};
800 for (const xAOD::IParticle* others : cache.prim_parts) {
801 if (others == primary) continue;
802 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
803 ATH_MSG_ERROR("The averaged calo cluster decorations are not available for "<<particleName(others)<<". Please check");
805 }
806 const float other_eta = acc_eta(*others);
807 const float other_phi = acc_phi(*others);
808 const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi,other_eta,other_phi);
809 if (dR > MaxDR) continue;
810 if (dR< (primary->type() == xAOD::Type::ObjectType::Muon ? m_coreConeMu : m_coreConeEl)) continue;
811 isoValue -= acc_ene(*others);
812 }
813 }
814 isoValue = std::max(0.f, isoValue);
815 return CorrectionCode::Ok;
816 }
ClusterSet getAssociatedClusters(const EventContext &ctx, const xAOD::IParticle *particle, ObjectCache &cache) const
Loads the topo clusters associated with the primary IParticle.

◆ getCloseByCorrectionTrackIso()

CorrectionCode CP::IsolationCloseByCorrectionTool::getCloseByCorrectionTrackIso ( const xAOD::IParticle * primary,
const IsoType type,
const ObjectCache & cache,
float & isoValue ) const
private

Only check the TTVA working point again if the tool has non-TTVA working points

Definition at line 629 of file IsolationCloseByCorrectionTool.cxx.

630 {
631 if (!isTrackIso(type)) {
632 ATH_MSG_ERROR("Invalid isolation type " << toString(type));
634 }
635 {
636 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
637 IsoHelperMap::const_iterator Itr = m_isohelpers.find(type);
638 if (Itr == m_isohelpers.end() || Itr->second->getOriginalIsolation(par, isoValue) == CorrectionCode::Error) {
639 ATH_MSG_WARNING(__func__<<"() -- "<<__LINE__<<" Could not retrieve the isolation variable " << toString(type));
641 } else if (cache.tracks.empty())
642 return CorrectionCode::Ok;
643 }
644
645 float MaxDR = coneSize(par, type);
646 const TrackSet ToExclude = getAssociatedTracks(par);
647
648 const xAOD::IParticle* Ref = isoRefParticle(par);
649 ATH_MSG_VERBOSE(toString(type) << " of " << particleName(par) << " with pt: " << par->pt() * MeVtoGeV << " GeV, eta: " << par->eta()
650 << ", phi: " << par->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. "
651 << ToExclude.size() << " tracks will be excluded.");
652
653 for (const TrackPtr& poluting_trk : cache.tracks) {
654 // Checks for the Pile-up robust isolation WP's
655 if (poluting_trk->pt() < trackPtCut(type)) continue;
657 if (isTrackIsoTTVA(type) && m_has_nonTTVA && !m_ttvaTool->isCompatible(*poluting_trk, *cache.prim_vtx)) continue;
658
659 if (overlap(Ref, poluting_trk, MaxDR) && !ToExclude.count(poluting_trk)) {
660 ATH_MSG_VERBOSE("Subtract track with "
661 << poluting_trk->pt() * MeVtoGeV << " GeV, eta: " << poluting_trk->eta() << ", phi: " << poluting_trk->phi()
662 << " with dR: " << std::sqrt(deltaR2(Ref, poluting_trk)) << " from the isolation cone " << toString(type)
663 << " " << (isoValue * MeVtoGeV) << " GeV.");
664 isoValue -= poluting_trk->pt();
665 }
666 }
667 isoValue = std::max(0.f, isoValue);
668 ATH_MSG_VERBOSE(toString(type) << " of " << particleName(par) << " with pt: " << par->pt() * MeVtoGeV << " GeV, eta: " << par->eta()
669 << ", phi: " << par->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV");
670 return CorrectionCode::Ok;
671 }
bool m_has_nonTTVA
Switch whether a pile-up non robust TTVA working point is defined.
bool overlap(const xAOD::IParticle *particle, const xAOD::IParticle *particle1, float dR) const
ToolHandle< CP::ITrackVertexAssociationTool > m_ttvaTool
float deltaR2(const xAOD::IParticle *particle, const xAOD::IParticle *particle1, bool AvgCalo=false) const
static float trackPtCut(xAOD::Iso::IsolationType type)
static bool isTrackIsoTTVA(xAOD::Iso::IsolationType type)

◆ getCloseByIsoCorrection()

CorrectionCode CP::IsolationCloseByCorrectionTool::getCloseByIsoCorrection ( const EventContext & ctx,
const xAOD::ElectronContainer * Electrons,
const xAOD::MuonContainer * Muons,
const xAOD::PhotonContainer * Photons ) const
overridevirtual

Pick up first all objects that a considerable for the close-by correction

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 260 of file IsolationCloseByCorrectionTool.cxx.

264 {
265 if (!m_isInitialised) {
266 ATH_MSG_ERROR("The IsolationCloseByCorrectionTool was not initialised!!!");
268 }
271 loadPrimaryParticles(electrons, cache);
272 loadPrimaryParticles(muons, cache);
273 loadPrimaryParticles(photons, cache);
274
275 loadAssociatedObjects(ctx, cache);
276 CorrectionCode ret = performCloseByCorrection(ctx, cache);
280 return ret;
281 }
IsoVector m_electron_isoTypes
Isolation variables used by the electron working point.
IsoVector m_muon_isoTypes
Isolation variables used by the muon working point.
void lockDecorations(const xAOD::IParticleContainer *parts, const IsoVector &isoTypes) const
IsoVector m_photon_isoTypes
Isolation variables used by the photon working point.
CorrectionCode performCloseByCorrection(const EventContext &ctx, ObjectCache &cache) const

◆ getExtrapEtaPhi() [1/2]

bool CP::IsolationCloseByCorrectionTool::getExtrapEtaPhi ( const EventContext & ctx,
const xAOD::TrackParticle * tp,
float & eta,
float & phi ) const
private

helper to get eta,phi of muon extrap

try the extention in athena if it's not obtained from muon yet.

if still not got the updated eta & phi

Definition at line 228 of file IsolationCloseByCorrectionTool.cxx.

228 {
230 ATH_MSG_DEBUG("Geting calo extension caloExtension tool.");
231 // If we have an extension cache then it owns the extension, otherwise we own it
232 // Therefore we have to prepare both an owning and a non-owning pointer
233 std::unique_ptr<Trk::CaloExtension> caloExtension;
234 caloExtension = m_caloExtTool->caloExtension(ctx, *tp);
235 if(!caloExtension){
236 ATH_MSG_WARNING("Can not get caloExtension.");
237 return false;
238 };
239
240 const std::vector<Trk::CurvilinearParameters>& intersections = caloExtension->caloLayerIntersections();
241 if(!intersections.empty()){
242 Amg::Vector3D avePoint(0,0,0);
243 for (unsigned int i = 0; i < intersections.size(); ++i){
244 const Amg::Vector3D& point = intersections[i].position();
245 avePoint += point;
246 }
247 avePoint = (1./intersections.size())*avePoint;
248 eta = avePoint.eta();
249 phi = avePoint.phi();
250 return true;
251 } else {
252 ATH_MSG_WARNING("Muon Calo extension got no intersection!!!");
253 }
255 ATH_MSG_WARNING("Calo extension can not be obtained!!!");
256 return false;
257 }
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool
calo extension tool for muon track particle extrapolation to calo
Eigen::Matrix< double, 3, 1 > Vector3D

◆ getExtrapEtaPhi() [2/2]

void CP::IsolationCloseByCorrectionTool::getExtrapEtaPhi ( const xAOD::IParticle * particlear,
float & eta,
float & phi ) const

Definition at line 817 of file IsolationCloseByCorrectionTool.cxx.

817 {
820 const CharAccessor acc_isDecor{caloDecors()[3] + m_caloDecSuffix};
821 if (par->type() != xAOD::Type::ObjectType::Muon) {
822 const xAOD::Egamma* egam = dynamic_cast<const xAOD::Egamma*>(par);
823 if( egam ) {
824 eta = egam->caloCluster()->eta();
825 phi = egam->caloCluster()->phi();
826 }
827 else {
828 eta = par->eta();
829 phi = par->phi();
830 }
831 } else if (acc_isDecor.isAvailable(*par) && acc_isDecor(*par)) {
832 eta = acc_assocEta(*par);
833 phi = acc_assocPhi(*par);
834 } else {
835 float assoc_ene{0.f};
838 const CharDecorator dec_isDecor{caloDecors()[3] + m_caloDecSuffix};
839 associateCluster(par,eta, phi, assoc_ene);
840 dec_assocEta(*par) = eta;
841 dec_assocPhi(*par) = phi;
842 dec_isDecor(*par) = true;
843 }
844 }
void associateCluster(const xAOD::IParticle *particle, float &eta, float &phi, float &energy) const override
Retrieve the associated clusters from the Particle and calculate the average eta/phi/energy.

◆ getIsolationTypes()

const IsoVector & CP::IsolationCloseByCorrectionTool::getIsolationTypes ( const xAOD::IParticle * particle) const
private

Definition at line 373 of file IsolationCloseByCorrectionTool.cxx.

373 {
374 static const IsoVector dummy{};
375 if (!particle) return dummy;
377 return m_electron_isoTypes;
378 else if (particle->type() == xAOD::Type::ObjectType::Muon)
379 return m_muon_isoTypes;
380 else if (particle->type() == xAOD::Type::ObjectType::Photon)
381 return m_photon_isoTypes;
382 return dummy;
383 }
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Electron
The object is an electron.
Definition ObjectType.h:46

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::Event, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::Event, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getOriginalIsolation() [1/2]

float CP::IsolationCloseByCorrectionTool::getOriginalIsolation ( const xAOD::IParticle & P,
IsoType type ) const
overridevirtual

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 1066 of file IsolationCloseByCorrectionTool.cxx.

1066 {
1067 return getOriginalIsolation(&particle, type);
1068 }
virtual float getOriginalIsolation(const xAOD::IParticle &P, IsoType type) const override

◆ getOriginalIsolation() [2/2]

float CP::IsolationCloseByCorrectionTool::getOriginalIsolation ( const xAOD::IParticle * particle,
IsoType type ) const
overridevirtual

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 1056 of file IsolationCloseByCorrectionTool.cxx.

1056 {
1057 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
1058 IsoHelperMap::const_iterator itr = m_isohelpers.find(isoVariable);
1059 float isovalue = 0;
1060 if (itr == m_isohelpers.end() || itr->second->getOriginalIsolation(particle, isovalue) == CorrectionCode::Error) {
1061 ATH_MSG_ERROR("Failed to retrieve the original isolation cone ");
1062 isovalue = FLT_MAX;
1063 }
1064 return isovalue;
1065 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getTrackCandidates()

TrackSet CP::IsolationCloseByCorrectionTool::getTrackCandidates ( const EventContext & ctx,
const xAOD::IParticle * particle ) const
overridevirtual

Load all TrackParticles associated with the particles in the Container. The particles have to pass the selection decoration flag.

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 537 of file IsolationCloseByCorrectionTool.cxx.

537 {
539 }
const xAOD::Vertex * retrieveIDBestPrimaryVertex(const EventContext &ctx) const

◆ initialize()

StatusCode CP::IsolationCloseByCorrectionTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Retrieve the isolation tool and load the isolation cones

Setup the data dependency

Same holds for the TTVA selection tool

Reimplemented from asg::AsgTool.

Definition at line 46 of file IsolationCloseByCorrectionTool.cxx.

46 {
48 ATH_CHECK(m_selectorTool.retrieve());
52
56 if (!m_isoDecSuffix.empty()) ATH_MSG_INFO("IsoDecSuffix set to " << m_isoDecSuffix);
57 if (!m_quality_name.empty()) ATH_MSG_INFO("SelectionDecorator set to " << m_quality_name);
58
59
60#ifndef XAOD_ANALYSIS
65 ATH_CHECK(m_isoVarKeys.initialize());
66 ATH_CHECK(m_isoWriteDecVarKeys.initialize());
67 if (!m_caloExtTool.empty()) ATH_CHECK(m_caloExtTool.retrieve());
68 else {
69 ATH_MSG_WARNING("The ParticleCaloExtensionTool was not configured. Pleease include it!!!");
70 }
71#endif
72
73 ATH_CHECK(m_VtxKey.initialize());
76
77 // set default properties of track selection tool, if the user hasn't configured it
78 if (m_trkselTool.empty()) {
79 asg::AsgToolConfig config{"InDet::InDetTrackSelectionTool/TrackParticleSelectionTool"};
80 ATH_MSG_INFO("No TrackSelectionTool provided, so I will create and configure my own, called: " << config.name());
81 // The z0 cut is checked in any case either by the
82 // track to vertex association tool or by the tracking tool
83 ATH_CHECK(config.setProperty("maxZ0SinTheta", 3.));
84 // The minimum Pt requirement is lowered to 500 MeV because
85 // the Loose ttva cone variables accept very low-pt tracks
86 // https://gitlab.cern.ch/atlas/athena/blob/21.2/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py#L21
87 ATH_CHECK(config.setProperty("minPt", 500.));
88 ATH_CHECK(config.setProperty("CutLevel", "Loose"));
89 ATH_CHECK(config.makePrivateTool(m_trkselTool));
90 }
92 if (m_ttvaTool.empty()) {
93 asg::AsgToolConfig config{"CP::TrackVertexAssociationTool/ttva_selection_tool"};
94 ATH_CHECK(config.setProperty("WorkingPoint", "Nonprompt_All_MaxWeight"));
95 ATH_CHECK(config.makePrivateTool(m_ttvaTool));
96 }
97 ATH_CHECK(m_trkselTool.retrieve());
98 ATH_CHECK(m_ttvaTool.retrieve());
99
100 if (!m_quality_name.empty()) m_acc_quality = std::make_unique<CharAccessor>(m_quality_name);
101 if (!m_passOR_name.empty()) m_acc_passOR = std::make_unique<CharAccessor>(m_passOR_name);
102 if (!m_isoSelection_name.empty()) m_dec_isoselection = std::make_unique<CharDecorator>(m_isoSelection_name);
103 m_isInitialised = true;
104 return StatusCode::SUCCESS;
105 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x,...)
void declareDependency(const std::vector< std::string > &containers, const IsoVector &types)
Helper function to declare the data dependencies.
Gaudi::Property< std::vector< std::string > > m_elecKeys
Declare the data dependencies of the Input containers.
Gaudi::Property< std::vector< std::string > > m_photKeys
void isoTypesFromWP(const std::vector< std::unique_ptr< IsolationWP > > &WP, IsoVector &types)
Helper function to load all Isolation types from the iso working points.
void printIsolationCones(const IsoVector &types, xAOD::Type::ObjectType T) const
Gaudi::Property< std::string > m_isoSelection_name
Gaudi::Property< std::vector< std::string > > m_muonKeys
SG::ReadHandleKey< xAOD::VertexContainer > m_VtxKey
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkselTool

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isEgamma()

bool CP::IsolationCloseByCorrectionTool::isEgamma ( const xAOD::IParticle * particle)
static

Definition at line 540 of file IsolationCloseByCorrectionTool.cxx.

540 {
541 return P && (P->type() == xAOD::Type::ObjectType::Electron || P->type() == xAOD::Type::ObjectType::Photon);
542 }

◆ isFixedTrackIso()

bool CP::IsolationCloseByCorrectionTool::isFixedTrackIso ( xAOD::Iso::IsolationType type)
static

Definition at line 1089 of file IsolationCloseByCorrectionTool.cxx.

1089{ return IsolationFlavour::ptcone == isolationFlavour(type); }
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour

◆ isFixedTrackIsoTTVA()

bool CP::IsolationCloseByCorrectionTool::isFixedTrackIsoTTVA ( xAOD::Iso::IsolationType type)
static

Definition at line 1095 of file IsolationCloseByCorrectionTool.cxx.

1095 {
1096 IsolationFlavour flavour = isolationFlavour(type);
1097 static const std::set<IsolationFlavour> ttvaFlavours{IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVA_pt500,
1098 IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVA_pt1000,
1099 IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500,
1100 IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000};
1101 return ttvaFlavours.count(flavour);
1102 }
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.

◆ isoRefParticle()

const xAOD::IParticle * CP::IsolationCloseByCorrectionTool::isoRefParticle ( const xAOD::IParticle * particle) const
overridevirtual

Retrieve the reference particle to define the cone axis in which the track particles contributing to the isolation have to be.

Implements CP::IIsolationCloseByCorrectionTool.

Definition at line 1018 of file IsolationCloseByCorrectionTool.cxx.

1018 {
1019 if (!P) {
1020 ATH_MSG_ERROR("Nullptr given");
1021 return nullptr;
1022 }
1023 // Use for muons the associated ID track. Else the particle itself
1024 if (P->type() == xAOD::Type::ObjectType::Muon) {
1025 const xAOD::Muon* muon = static_cast<const xAOD::Muon*>(P);
1026 const xAOD::TrackParticle* idTrk = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
1027 return idTrk ? idTrk : muon->trackParticle(xAOD::Muon::TrackParticleType::Primary);
1028 }
1029 return P;
1030 }

◆ isoTypesFromWP()

void CP::IsolationCloseByCorrectionTool::isoTypesFromWP ( const std::vector< std::unique_ptr< IsolationWP > > & WP,
IsoVector & types )
private

Helper function to load all Isolation types from the iso working points.

Definition at line 106 of file IsolationCloseByCorrectionTool.cxx.

106 {
107 types.clear();
108 for (const std::unique_ptr<IsolationWP>& W : WPs) {
109 for (const std::unique_ptr<IsolationCondition>& C : W->conditions()) {
110 for (unsigned int t = 0; t < C->num_types(); ++t) {
111 const IsoType iso_type = C->type(t);
112 if (std::find(types.begin(), types.end(), iso_type) == types.end()) types.emplace_back(iso_type);
113 if (m_isohelpers.find(iso_type) == m_isohelpers.end()) {
114 m_isohelpers.insert(std::make_pair(iso_type, std::make_unique<IsoVariableHelper>(iso_type, m_backup_prefix, m_isoDecSuffix)));
115 }
116 }
117 }
118 }
119 m_has_nonTTVA |= std::find_if(types.begin(), types.end(),
120 [](const IsolationType& t) { return isTrackIso(t) && !isTrackIsoTTVA(t); }) != types.end();
121 m_hasPflowIso |= std::find_if(types.begin(), types.end(),
122 [](const IsolationType& t) { return isPFlowIso(t); }) != types.end();
123 m_hasEtConeIso |= std::find_if(types.begin(), types.end(),
124 [](const IsolationType& t) { return isTopoEtIso(t); }) != types.end();
125 }
struct color C
@ W
FillWPartonHistory.

◆ isPFlowIso()

bool CP::IsolationCloseByCorrectionTool::isPFlowIso ( xAOD::Iso::IsolationType type)
static

Definition at line 1126 of file IsolationCloseByCorrectionTool.cxx.

1126{ return isolationFlavour(type) == IsolationFlavour::neflowisol; }

◆ isSame()

bool CP::IsolationCloseByCorrectionTool::isSame ( const xAOD::IParticle * particle,
const xAOD::IParticle * particle1 ) const

Definition at line 1031 of file IsolationCloseByCorrectionTool.cxx.

1031 {
1032 if (!P || !P1) {
1033 ATH_MSG_WARNING("Nullptr were given");
1034 return true;
1035 }
1036 return (P == P1);
1037 }

◆ isTopoEtIso()

bool CP::IsolationCloseByCorrectionTool::isTopoEtIso ( xAOD::Iso::IsolationType type)
static

Definition at line 1094 of file IsolationCloseByCorrectionTool.cxx.

1094{ return IsolationFlavour::topoetcone == isolationFlavour(type); }

◆ isTrackIso()

bool CP::IsolationCloseByCorrectionTool::isTrackIso ( xAOD::Iso::IsolationType type)
static

Definition at line 1091 of file IsolationCloseByCorrectionTool.cxx.

1091 {
1092 return isVarTrackIso(type) || isFixedTrackIso(type) || isTrackIsoTTVA(type);
1093 }
static bool isFixedTrackIso(xAOD::Iso::IsolationType type)

◆ isTrackIsoTTVA()

bool CP::IsolationCloseByCorrectionTool::isTrackIsoTTVA ( xAOD::Iso::IsolationType type)
static

Definition at line 1111 of file IsolationCloseByCorrectionTool.cxx.

1111{ return isFixedTrackIsoTTVA(type) || isVarTrackIsoTTVA(type); }
static bool isFixedTrackIsoTTVA(xAOD::Iso::IsolationType type)

◆ isVarTrackIso()

bool CP::IsolationCloseByCorrectionTool::isVarTrackIso ( xAOD::Iso::IsolationType type)
static

Definition at line 1090 of file IsolationCloseByCorrectionTool.cxx.

1090{ return IsolationFlavour::ptvarcone == isolationFlavour(type); }

◆ isVarTrackIsoTTVA()

bool CP::IsolationCloseByCorrectionTool::isVarTrackIsoTTVA ( xAOD::Iso::IsolationType Iso)
static

Definition at line 1103 of file IsolationCloseByCorrectionTool.cxx.

1103 {
1104 IsolationFlavour flavour = isolationFlavour(type);
1105 static const std::set<IsolationFlavour> ttvaFlavours{IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt500,
1106 IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt1000,
1107 IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500,
1108 IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000};
1109 return ttvaFlavours.count(flavour);
1110 }

◆ loadAssociatedObjects()

void CP::IsolationCloseByCorrectionTool::loadAssociatedObjects ( const EventContext & ctx,
ObjectCache & cache ) const

Load all associated tracks / clusters / flow elements into the cache.

Definition at line 171 of file IsolationCloseByCorrectionTool.cxx.

171 {
172
173 // Use isLRT decoration for LLP particles to avoid looking for tracks from the primary vertex
174 static const CharAccessor isLRT("isLRT");
175
176 cache.prim_vtx = retrieveIDBestPrimaryVertex(ctx);
177 // egamma first, so that their topo clusters take priority over the muon ones in getAssociatedClusters
178 std::vector<const xAOD::IParticle*> ordered{cache.prim_parts.begin(), cache.prim_parts.end()};
179 std::stable_partition(ordered.begin(), ordered.end(), [](const xAOD::IParticle* p) { return isEgamma(p); });
180 for (const xAOD::IParticle* prim : ordered) {
181 // skip LRT leptons
182 if (!isLRT.isAvailable(*prim) || !isLRT(*prim) ) {
183 const TrackSet tracks = getAssociatedTracks(prim, cache.prim_vtx);
184 cache.tracks.insert(tracks.begin(), tracks.end());
185 }
186 const ClusterSet clusters = getAssociatedClusters(ctx, prim, cache);
187 cache.clusters.insert(clusters.begin(), clusters.end());
188 }
189 getAssocFlowElements(ctx, cache);
190 }
DataModel_detail::iterator< DVL > stable_partition(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of stable_partition for DataVector/List.

◆ loadPrimaryParticles()

void CP::IsolationCloseByCorrectionTool::loadPrimaryParticles ( const xAOD::IParticleContainer * container,
ObjectCache & cache ) const

Filter all electrons/muons/photons from the collection which pass the selection decoration.

Definition at line 145 of file IsolationCloseByCorrectionTool.cxx.

145 {
146 if (!container) return;
147 for (const xAOD::IParticle* particle : *container) {
148 if (m_dec_isoselection) (*m_dec_isoselection)(*particle) = true && m_selectorTool->accept(*particle);
149 const IsoVector& iso_types = getIsolationTypes(particle);
150 if (iso_types.empty()) { ATH_MSG_DEBUG("No isolation types have been defined for particle type " << particleName(particle)); }
151 for (const IsoType type : iso_types) {
152 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
153 IsoHelperMap::const_iterator Itr = m_isohelpers.find(type);
154 if (Itr == m_isohelpers.end() || Itr->second->backupIsolation(particle) == CorrectionCode::Error) {
155 ATH_MSG_WARNING("Failed to properly access the vanilla isolation variable "
156 << toString(type) << "for particle " << particleName(particle) << " with pT: "
157 << particle->pt() * MeVtoGeV << " GeV, eta: " << particle->eta() << ", phi: " << particle->phi());
158 }
159 }
160 // Save all particles to be sure to output the new iso decorated values
161 // They either pass or not the selection.
162 // The selected ones participate in the CloseBy and may have their isolation corrected.
163 if (!passSelectionQuality(particle)) {
164 cache.not_sel_parts.insert(particle);
165 }
166 else {
167 cache.prim_parts.insert(particle);
168 }
169 }
170 }
bool passSelectionQuality(const xAOD::IParticle *particle) const

◆ lockDecorations()

void CP::IsolationCloseByCorrectionTool::lockDecorations ( const xAOD::IParticleContainer * parts,
const IsoVector & isoTypes ) const
private

Definition at line 331 of file IsolationCloseByCorrectionTool.cxx.

332 {
333 if (!parts) return;
334
337 const CharDecorator dec_isDecor{caloDecors()[3] + m_caloDecSuffix};
338
339 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
340
341 if (parts->ownPolicy() == SG::VIEW_ELEMENTS) {
343 for (const xAOD::IParticle* part : *parts) {
344 const SG::AuxVectorData* c = part->container();
345 if (conts.insert(c).second) {
346 for (const IsoType t : isoTypes) {
347 auto it = m_isohelpers.find (t);
348 if (it != m_isohelpers.end())
349 it->second->lockDecorations(*part->container());
350 }
351 SG::AuxVectorData* c_nc ATLAS_THREAD_SAFE =
352 const_cast<SG::AuxVectorData*> (c);
353 c_nc->lockDecoration (dec_assocEta.auxid());
354 c_nc->lockDecoration (dec_assocPhi.auxid());
355 c_nc->lockDecoration (dec_isDecor.auxid());
356 }
357 }
358 }
359
360 else {
361 for (const IsoType t : isoTypes) {
362 auto it = m_isohelpers.find (t);
363 if (it != m_isohelpers.end())
364 it->second->lockDecorations(*parts);
365 }
366 SG::AuxVectorData* c_nc ATLAS_THREAD_SAFE =
367 const_cast<xAOD::IParticleContainer*> (parts);
368 c_nc->lockDecoration (dec_assocEta.auxid());
369 c_nc->lockDecoration (dec_assocPhi.auxid());
370 c_nc->lockDecoration (dec_isDecor.auxid());
371 }
372 }
std::unordered_set< const SG::AuxVectorData * > UnorderedContainerSet
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ overlap()

bool CP::IsolationCloseByCorrectionTool::overlap ( const xAOD::IParticle * particle,
const xAOD::IParticle * particle1,
float dR ) const

Definition at line 1053 of file IsolationCloseByCorrectionTool.cxx.

1053 {
1054 return (!isSame(P, P1) && deltaR2(P, P1) < (dR * dR));
1055 }

◆ particleName() [1/2]

std::string CP::IsolationCloseByCorrectionTool::particleName ( const xAOD::IParticle * C)
static

Definition at line 1080 of file IsolationCloseByCorrectionTool.cxx.

1080{ return particleName(C->type()); }

◆ particleName() [2/2]

std::string CP::IsolationCloseByCorrectionTool::particleName ( xAOD::Type::ObjectType T)
static

Definition at line 1081 of file IsolationCloseByCorrectionTool.cxx.

1081 {
1082 if (T == xAOD::Type::ObjectType::Electron) return "Electron";
1083 if (T == xAOD::Type::ObjectType::Photon) return "Photon";
1084 if (T == xAOD::Type::ObjectType::Muon) return "Muon";
1085 if (T == xAOD::Type::ObjectType::TrackParticle) return "Track";
1086 if (T == xAOD::Type::ObjectType::CaloCluster) return "Cluster";
1087 return "Unknown";
1088 }

◆ passFirstStage()

bool CP::IsolationCloseByCorrectionTool::passFirstStage ( const xAOD::TrackParticle * trk,
const xAOD::Vertex * vtx ) const
private

The Track particle has to pass the Track selection tool and the TTVA selection.

The latter only applies if there's no WP floating around using the legacy ptcone variables

Definition at line 506 of file IsolationCloseByCorrectionTool.cxx.

506 {
507 return trk && vtx && m_trkselTool->accept(*trk, vtx) && (!m_has_nonTTVA || m_ttvaTool->isCompatible(*trk, *vtx));
508 }

◆ passSelectionQuality()

bool CP::IsolationCloseByCorrectionTool::passSelectionQuality ( const xAOD::IParticle * particle) const
private

Definition at line 623 of file IsolationCloseByCorrectionTool.cxx.

623 {
624 if (!P) return false;
625 if (m_acc_quality && (!m_acc_quality->isAvailable(*P) || !(*m_acc_quality)(*P))) return false;
626 if (m_acc_passOR && (!m_acc_passOR->isAvailable(*P) || !(*m_acc_passOR)(*P))) return false;
627 return true;
628 }

◆ performCloseByCorrection()

CorrectionCode CP::IsolationCloseByCorrectionTool::performCloseByCorrection ( const EventContext & ctx,
ObjectCache & cache ) const
private

Definition at line 282 of file IsolationCloseByCorrectionTool.cxx.

282 {
283 if (cache.prim_vtx) {
284 // require a primary vertex for isolation correction - expect that if there is not primary vertex, then we only need to assure that the cache.not_sel_parts are treated correctly below
285 for (const xAOD::IParticle* particle : cache.prim_parts) {
286 ATH_MSG_DEBUG("Correct the isolation of particle "<<particleName(particle)<< " with pt: " << particle->pt() * MeVtoGeV << " GeV"
287 << " eta: " << particle->eta()
288 << " phi: " << particle->phi());
289
290 if (subtractCloseByContribution(ctx, particle, cache) == CorrectionCode::Error) {
291 ATH_MSG_ERROR("Failed to correct the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
292 << " eta: " << particle->eta()
293 << " phi: " << particle->phi());
295 }
296 if (m_dec_isoselection) (*m_dec_isoselection)(*particle) = bool(m_selectorTool->accept(*particle));
297 ATH_MSG_DEBUG("Corrected the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
298 << " eta: " << particle->eta()
299 << " phi: " << particle->phi());
300
301 }
302 }
303 else {
304 // Missing primary vertex - need to copy the uncorrected iso values
305 for (const xAOD::IParticle* particle : cache.prim_parts) {
306 ATH_MSG_DEBUG("Copy isolation values of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
307 << " eta: " << particle->eta()
308 << " phi: " << particle->phi());
310 ATH_MSG_ERROR("Failed to copy the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
311 << " eta: " << particle->eta()
312 << " phi: " << particle->phi());
314 }
315 }
316 }
317 // Only need to copy the uncorrected iso values
318 for (const xAOD::IParticle* particle : cache.not_sel_parts) {
319 ATH_MSG_DEBUG("Copy isolation values of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
320 << " eta: " << particle->eta()
321 << " phi: " << particle->phi());
323 ATH_MSG_ERROR("Failed to copy the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
324 << " eta: " << particle->eta()
325 << " phi: " << particle->phi());
327 }
328 }
329 return CorrectionCode::Ok;
330 }
CorrectionCode subtractCloseByContribution(const EventContext &ctx, const xAOD::IParticle *P, ObjectCache &cache) const
CorrectionCode copyIsoValuesForPartsNotSelected(const xAOD::IParticle *part) const
setBGCode setTAP setLVL2ErrorBits bool

◆ pflowDecors()

const caloDecorNames & CP::IsolationCloseByCorrectionTool::pflowDecors ( )
static

Definition at line 35 of file IsolationCloseByCorrectionTool.cxx.

35 {
36 static const caloDecorNames names =
37 {"IsoCloseByCorr_assocPflowEta", "IsoCloseByCorr_assocPflowPhi", "IsoCloseByCorr_assocPflowEnergy",
38 "IsoCloseByCorr_assocPflowDecor"};
39 return names;
40 }

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }

◆ printIsolationCones()

void CP::IsolationCloseByCorrectionTool::printIsolationCones ( const IsoVector & types,
xAOD::Type::ObjectType T ) const
private

Definition at line 1112 of file IsolationCloseByCorrectionTool.cxx.

1112 {
1113 ATH_MSG_INFO("The following isolation cones are considered for " << particleName(T));
1114 for (const IsoType& cone : types) { ATH_MSG_INFO(" --- " << toString(cone)); }
1115 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ retrieveIDBestPrimaryVertex()

const xAOD::Vertex * CP::IsolationCloseByCorrectionTool::retrieveIDBestPrimaryVertex ( const EventContext & ctx) const

Definition at line 979 of file IsolationCloseByCorrectionTool.cxx.

979 {
980 SG::ReadHandle<xAOD::VertexContainer> Verticies{m_VtxKey, ctx};
981 if (!Verticies.isValid() || !Verticies->size()) {
982 ATH_MSG_WARNING("Failed to load vertex collection " << m_VtxKey.key());
983 return nullptr;
984 }
985 for (const xAOD::Vertex* V : *Verticies) {
986 if (V->vertexType() == xAOD::VxType::VertexType::PriVtx) {
987 ATH_MSG_VERBOSE("retrieveIDBestPrimaryVertex: vertex found ");
988 return V;
989 }
990 }
991 ATH_MSG_VERBOSE("retrieveIDBestPrimaryVertex: no vertex found ");
992 return nullptr;
993 }
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ subtractCloseByContribution()

CorrectionCode CP::IsolationCloseByCorrectionTool::subtractCloseByContribution ( const EventContext & ctx,
const xAOD::IParticle * P,
ObjectCache & cache ) const
private

Definition at line 385 of file IsolationCloseByCorrectionTool.cxx.

387 {
388 const IsoVector& types = getIsolationTypes(par);
389 if (types.empty()) {
390 ATH_MSG_WARNING("No isolation types are defiend for " << particleName(par));
392 }
393 for (const IsolationType iso_type : types) {
394 float iso_variable{0.f};
395 if (isTrackIso(iso_type)) {
396 if (getCloseByCorrectionTrackIso(par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
397 ATH_MSG_ERROR("Failed to apply track correction");
399 }
400 } else if (isTopoEtIso(iso_type)) {
401 if (getCloseByCorrectionTopoIso(ctx, par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
402 ATH_MSG_ERROR("Failed to apply topo cluster correction");
404 }
405 } else if (isPFlowIso(iso_type)) {
406 if (getCloseByCorrectionPflowIso(ctx, par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
407 ATH_MSG_ERROR("Failed to apply pflow correction");
409 }
410 }
411 ATH_MSG_DEBUG("subtractCloseByContribution: Set pt, eta, phi " << par->pt() << ", " << par->eta() << ", " << par->phi() << " for " << toString(iso_type) << " to " << iso_variable);
412 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
413 if (m_isohelpers.at(iso_type)->setIsolation(par, iso_variable) == CorrectionCode::Error) {
414 ATH_MSG_ERROR("Cannot set " << toString(iso_type) << " to " << iso_variable);
415 return CorrectionCode::Error;
416 }
417 }
418 return CorrectionCode::Ok;
419 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ trackPtCut()

float CP::IsolationCloseByCorrectionTool::trackPtCut ( xAOD::Iso::IsolationType type)
static

Definition at line 1116 of file IsolationCloseByCorrectionTool.cxx.

1116 {
1117 if (!isTrackIso(type)) return -1;
1118 IsolationFlavour flavour = isolationFlavour(type);
1119 static const std::set<IsolationFlavour> Pt1000_Flavours{IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVA_pt1000,
1120 IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000,
1121 IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt1000,
1122 IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000};
1123 if (Pt1000_Flavours.count(flavour)) return 1000;
1124 return 500;
1125 }

◆ unCalibPt()

float CP::IsolationCloseByCorrectionTool::unCalibPt ( const xAOD::IParticle * particle) const
private

Definition at line 1005 of file IsolationCloseByCorrectionTool.cxx.

1005 {
1006 if (!P) {
1007 ATH_MSG_WARNING("No partcile given. Return stupidly big number. ");
1008 return 1.e25;
1009 }
1010 const xAOD::IParticle* OR = xAOD::getOriginalObject(*P);
1011 if (!OR) {
1012 ATH_MSG_VERBOSE("No reference from the shallow copy container of " << particleName(P) << " could be found");
1013 return P->pt();
1014 }
1015 return OR->pt();
1016 }
const IParticle * getOriginalObject(const IParticle &copy)
This function can be used to conveniently get a pointer back to the original object from which a copy...

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

std::mutex m_isoHelpersMutex CP::IsolationCloseByCorrectionTool::ATLAS_THREAD_SAFE
mutableprivate

Mutex to protect the map if the method with signature getCloseByCorrection(std::vector<float>& corrections, const xAOD::IParticle& par, const std::vector<xAOD::Iso::IsolationType>& types, const xAOD::IParticleContainer& closePar) is called.

Definition at line 312 of file IsolationCloseByCorrectionTool.h.

◆ ATLAS_THREAD_SAFE [2/2]

IsoHelperMap m_isohelpers CP::IsolationCloseByCorrectionTool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 307 of file IsolationCloseByCorrectionTool.h.

◆ m_acc_passOR

SelectionAccessor CP::IsolationCloseByCorrectionTool::m_acc_passOR {nullptr}
private

Definition at line 303 of file IsolationCloseByCorrectionTool.h.

303{nullptr};

◆ m_acc_quality

SelectionAccessor CP::IsolationCloseByCorrectionTool::m_acc_quality {nullptr}
private

Definition at line 302 of file IsolationCloseByCorrectionTool.h.

302{nullptr};

◆ m_backup_prefix

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_backup_prefix
private
Initial value:
{
this, "BackupPrefix", "", "Prefix in front of the isolation variables, if the original cone values need to be backuped"}

Definition at line 220 of file IsolationCloseByCorrectionTool.h.

220 {
221 this, "BackupPrefix", "", "Prefix in front of the isolation variables, if the original cone values need to be backuped"};

◆ m_CaloClusterKey

SG::ReadHandleKey<xAOD::CaloClusterContainer> CP::IsolationCloseByCorrectionTool::m_CaloClusterKey
private
Initial value:
{this, "CaloClusterContainer", "CaloCalTopoClusters",
"Name of the primary calo cluster container"}

Definition at line 282 of file IsolationCloseByCorrectionTool.h.

282 {this, "CaloClusterContainer", "CaloCalTopoClusters",
283 "Name of the primary calo cluster container"};

◆ m_caloDecSuffix

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_caloDecSuffix
private
Initial value:
{
this, "CaloDecSuffix", "", "Suffix added to output cluster variable names for close by corrections"}

Definition at line 225 of file IsolationCloseByCorrectionTool.h.

225 {
226 this, "CaloDecSuffix", "", "Suffix added to output cluster variable names for close by corrections"};

◆ m_caloExtTool

ToolHandle<Trk::IParticleCaloExtensionTool> CP::IsolationCloseByCorrectionTool::m_caloExtTool {this, "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"}
private

calo extension tool for muon track particle extrapolation to calo

Definition at line 274 of file IsolationCloseByCorrectionTool.h.

274{this, "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"};

◆ m_caloModel

Gaudi::Property<int> CP::IsolationCloseByCorrectionTool::m_caloModel {this, "CaloCorrectionModel", TopoConeCorrectionModel::SubtractObjectsDirectly}
private

EXPERT PROPERTIES.

Definition at line 229 of file IsolationCloseByCorrectionTool.h.

229{this, "CaloCorrectionModel", TopoConeCorrectionModel::SubtractObjectsDirectly};

◆ m_ConeSizeVariation

Gaudi::Property<float> CP::IsolationCloseByCorrectionTool::m_ConeSizeVariation
private
Initial value:
{
this, "ExtrapolationConeSize", 1.2,
"Constant factor to be multiplied on top of the topo-etcone size if the reference particle is not a calorimeter particle in "
"order to account for extrapolation effects"}

Definition at line 252 of file IsolationCloseByCorrectionTool.h.

252 {
253 this, "ExtrapolationConeSize", 1.2,
254 "Constant factor to be multiplied on top of the topo-etcone size if the reference particle is not a calorimeter particle in "
255 "order to account for extrapolation effects"}; // Extend - shrink the cone size to account for extrapolation effects

◆ m_coreConeEl

Gaudi::Property<float> CP::IsolationCloseByCorrectionTool::m_coreConeEl
private
Initial value:
{this, "CoreConeElectrons", 0.1,
"This is the size of the core cone for the topoetcone variables."}

Definition at line 232 of file IsolationCloseByCorrectionTool.h.

232 {this, "CoreConeElectrons", 0.1,
233 "This is the size of the core cone for the topoetcone variables."};

◆ m_coreConeMu

Gaudi::Property<float> CP::IsolationCloseByCorrectionTool::m_coreConeMu {this, "CoreConeMuons", 0.05, "This is the size of the core cone for the topoetcone variables."}
private

Definition at line 237 of file IsolationCloseByCorrectionTool.h.

237{this, "CoreConeMuons", 0.05, "This is the size of the core cone for the topoetcone variables."};

◆ m_dec_isoselection

SelectionDecorator CP::IsolationCloseByCorrectionTool::m_dec_isoselection {nullptr}
private

Definition at line 304 of file IsolationCloseByCorrectionTool.h.

304{nullptr};

◆ m_declareCaloDecors

Gaudi::Property<bool> CP::IsolationCloseByCorrectionTool::m_declareCaloDecors {this, "declareCaloDecors", false, "If set to true, the data dependency on the calo/pflow decors will be declared"}
private

Definition at line 257 of file IsolationCloseByCorrectionTool.h.

257{this, "declareCaloDecors", false, "If set to true, the data dependency on the calo/pflow decors will be declared"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_elecKeys

Gaudi::Property<std::vector<std::string> > CP::IsolationCloseByCorrectionTool::m_elecKeys
private
Initial value:
{
this, "EleContainers", {}, "Pipe the list of electron containers given later to the tool"}

Declare the data dependencies of the Input containers.

The isolation variables used in the working point calculation are declared to the avalanche scheduler. This is not needed for the AthAnalysis nor AnalysisBase releases.

Definition at line 262 of file IsolationCloseByCorrectionTool.h.

262 {
263 this, "EleContainers", {}, "Pipe the list of electron containers given later to the tool"};

◆ m_electron_isoTypes

IsoVector CP::IsolationCloseByCorrectionTool::m_electron_isoTypes {}
private

Isolation variables used by the electron working point.

Definition at line 289 of file IsolationCloseByCorrectionTool.h.

289{};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_has_nonTTVA

bool CP::IsolationCloseByCorrectionTool::m_has_nonTTVA {false}
private

Switch whether a pile-up non robust TTVA working point is defined.

Definition at line 293 of file IsolationCloseByCorrectionTool.h.

293{false};

◆ m_hasEtConeIso

bool CP::IsolationCloseByCorrectionTool::m_hasEtConeIso {false}
private

Switch whether a topoetcone isolation working point is defined.

Definition at line 297 of file IsolationCloseByCorrectionTool.h.

297{false};

◆ m_hasPflowIso

bool CP::IsolationCloseByCorrectionTool::m_hasPflowIso {false}
private

Switch whether a pflow isolation working point is defined.

Definition at line 295 of file IsolationCloseByCorrectionTool.h.

295{false};

◆ m_isInitialised

bool CP::IsolationCloseByCorrectionTool::m_isInitialised {false}
private

Definition at line 300 of file IsolationCloseByCorrectionTool.h.

300{false};

◆ m_isoDecSuffix

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_isoDecSuffix
private
Initial value:
{
this, "IsoDecSuffix", "", "Suffix added to output isolation variable names for close by corrections"}

Definition at line 223 of file IsolationCloseByCorrectionTool.h.

223 {
224 this, "IsoDecSuffix", "", "Suffix added to output isolation variable names for close by corrections"};

◆ m_isoSelection_name

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_isoSelection_name {this, "IsolationSelectionDecorator", "", "Name of the final isolation decorator."}
private

Definition at line 218 of file IsolationCloseByCorrectionTool.h.

218{this, "IsolationSelectionDecorator", "", "Name of the final isolation decorator."};

◆ m_isoVarKeys

SG::ReadDecorHandleKeyArray<xAOD::IParticleContainer> CP::IsolationCloseByCorrectionTool::m_isoVarKeys
private
Initial value:
{
this, "IsoVarKeys", {}, "The list is filled during the initialization"}

Definition at line 268 of file IsolationCloseByCorrectionTool.h.

268 {
269 this, "IsoVarKeys", {}, "The list is filled during the initialization"};

◆ m_isoWriteDecVarKeys

SG::WriteDecorHandleKeyArray<xAOD::IParticleContainer> CP::IsolationCloseByCorrectionTool::m_isoWriteDecVarKeys
private
Initial value:
{
this, "IsoWriteDecVarKeys", {}, "The list is filled during the initialization"}

Definition at line 270 of file IsolationCloseByCorrectionTool.h.

270 {
271 this, "IsoWriteDecVarKeys", {}, "The list is filled during the initialization"};

◆ m_maxTopoPolution

Gaudi::Property<float> CP::IsolationCloseByCorrectionTool::m_maxTopoPolution
private
Initial value:
{
this, "MaxClusterFrac", 1.1,
"Maximum energy fraction a single cluster can make up to be considered as contributed to the isolation"}

Definition at line 248 of file IsolationCloseByCorrectionTool.h.

248 {
249 this, "MaxClusterFrac", 1.1,
250 "Maximum energy fraction a single cluster can make up to be considered as contributed to the isolation"};

◆ m_muon_isoTypes

IsoVector CP::IsolationCloseByCorrectionTool::m_muon_isoTypes {}
private

Isolation variables used by the muon working point.

Definition at line 287 of file IsolationCloseByCorrectionTool.h.

287{};

◆ m_muonKeys

Gaudi::Property<std::vector<std::string> > CP::IsolationCloseByCorrectionTool::m_muonKeys
private
Initial value:
{
this, "MuoContainers", {}, "Pipe the list of muon containers given later to the tool"}

Definition at line 264 of file IsolationCloseByCorrectionTool.h.

264 {
265 this, "MuoContainers", {}, "Pipe the list of muon containers given later to the tool"};

◆ m_passOR_name

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_passOR_name
private
Initial value:
{this, "PassoverlapDecorator", "",
"Does the particle also need to pass the overlap removal?"}

Definition at line 216 of file IsolationCloseByCorrectionTool.h.

216 {this, "PassoverlapDecorator", "",
217 "Does the particle also need to pass the overlap removal?"};

◆ m_PflowKey

SG::ReadHandleKey<xAOD::FlowElementContainer> CP::IsolationCloseByCorrectionTool::m_PflowKey
private
Initial value:
{this, "PflowContainer", "CHSNeutralParticleFlowObjects",
"Name of the neutral pflow elements"}

Definition at line 284 of file IsolationCloseByCorrectionTool.h.

284 {this, "PflowContainer", "CHSNeutralParticleFlowObjects",
285 "Name of the neutral pflow elements"};

◆ m_photKeys

Gaudi::Property<std::vector<std::string> > CP::IsolationCloseByCorrectionTool::m_photKeys
private
Initial value:
{
this, "PhoContainers", {}, "Pipe the list of photon containers given later to the tool"}

Definition at line 266 of file IsolationCloseByCorrectionTool.h.

266 {
267 this, "PhoContainers", {}, "Pipe the list of photon containers given later to the tool"};

◆ m_photon_isoTypes

IsoVector CP::IsolationCloseByCorrectionTool::m_photon_isoTypes {}
private

Isolation variables used by the photon working point.

Definition at line 291 of file IsolationCloseByCorrectionTool.h.

291{};

◆ m_ptvarconeRadius

Gaudi::Property<float> CP::IsolationCloseByCorrectionTool::m_ptvarconeRadius {this, "PtvarconeRadius", 1.e4, "This is the kT parameter for the ptvarcone variables."}
private

Definition at line 241 of file IsolationCloseByCorrectionTool.h.

241{this, "PtvarconeRadius", 1.e4, "This is the kT parameter for the ptvarcone variables."};

◆ m_quality_name

Gaudi::Property<std::string> CP::IsolationCloseByCorrectionTool::m_quality_name
private
Initial value:
{
this, "SelectionDecorator", "",
"Name of the char auxdata defining whether the particle shall be considered for iso correction"}

Definition at line 213 of file IsolationCloseByCorrectionTool.h.

213 {
214 this, "SelectionDecorator", "",
215 "Name of the char auxdata defining whether the particle shall be considered for iso correction"};

◆ m_selectorTool

ToolHandle<CP::IIsolationSelectionTool> CP::IsolationCloseByCorrectionTool::m_selectorTool
private
Initial value:
{this, "IsolationSelectionTool", "",
"Please give me your configured IsolationSelectionTool!"}

Definition at line 208 of file IsolationCloseByCorrectionTool.h.

208 {this, "IsolationSelectionTool", "",
209 "Please give me your configured IsolationSelectionTool!"};

◆ m_trkselTool

ToolHandle<InDet::IInDetTrackSelectionTool> CP::IsolationCloseByCorrectionTool::m_trkselTool
private
Initial value:
{
this, "TrackSelectionTool", "", "TrackSelectionTool to select tracks which made it actually into the isolation"}

Definition at line 204 of file IsolationCloseByCorrectionTool.h.

204 {
205 this, "TrackSelectionTool", "", "TrackSelectionTool to select tracks which made it actually into the isolation"};

◆ m_ttvaTool

ToolHandle<CP::ITrackVertexAssociationTool> CP::IsolationCloseByCorrectionTool::m_ttvaTool
private
Initial value:
{this, "TTVASelectionTool", "",
"TTVASelectionTool to correct for the pile-up robust WPs"}

Definition at line 206 of file IsolationCloseByCorrectionTool.h.

206 {this, "TTVASelectionTool", "",
207 "TTVASelectionTool to correct for the pile-up robust WPs"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.

◆ m_VtxKey

SG::ReadHandleKey<xAOD::VertexContainer> CP::IsolationCloseByCorrectionTool::m_VtxKey
private
Initial value:
{this, "VertexContainer", "PrimaryVertices",
"Name of the primary vertex container"}

Definition at line 280 of file IsolationCloseByCorrectionTool.h.

280 {this, "VertexContainer", "PrimaryVertices",
281 "Name of the primary vertex container"};

The documentation for this class was generated from the following files: