Skip to content
Snippets Groups Projects
Commit 62274946 authored by scott snyder's avatar scott snyder Committed by scott snyder
Browse files

ParticleJetTools: Use Accessor, etc instead of auxdata().

Replace auxdata, etc. with Accessor classes.
Moving to deprecate these usages in the Athena build.
parent e0f636e4
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
// author: jie.yu@cern.ch
#include "ParticleJetTools/JetParticleCenterOfMassAssociation.h"
#include "AsgMessaging/Check.h"
#include "AthContainers/ConstAccessor.h"
#include "TLorentzVector.h"
using namespace std;
......@@ -35,17 +36,18 @@ JetParticleCenterOfMassAssociation::match(const JetContainer& jets, const xAOD::
const IParticle& part = **part_itr;
static const SG::ConstAccessor< ElementLink< JetContainer > > ParentAcc ("Parent");
double deltaAngleMatch = 999.;
int matchjetidx = -1;
for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
const Jet& jet = *jets[iJet];
bool foundEL = jet.isAvailable< ElementLink< JetContainer > >("Parent");
bool foundEL = ParentAcc.isAvailable (jet);
if ( ! foundEL ){
ATH_MSG_WARNING("PARTICLE to JET center-of-mass Associator: PARENT jet not available.");
continue;
}
ElementLink< JetContainer > assoParentJet = jet.auxdata< ElementLink< JetContainer > >("Parent");
ElementLink< JetContainer > assoParentJet = ParentAcc (jet);
if ( ! assoParentJet.isValid()){
ATH_MSG_WARNING("PARTICLE to JET center-of-mass Associator: Unable to get parent link Null ptr is returned.");
continue;
......
/*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "ParticleJetTools/JetTruthLabelingTool.h"
......@@ -8,6 +8,7 @@
#include "AsgDataHandles/ReadDecorHandle.h"
#include "AsgDataHandles/WriteDecorHandle.h"
#include "AsgTools/CurrentContext.h"
#include "AthContainers/ConstAccessor.h"
JetTruthLabelingTool::JetTruthLabelingTool(const std::string& name) :
asg::AsgTool(name)
......@@ -326,12 +327,13 @@ StatusCode JetTruthLabelingTool::labelRecoJets(DecorHandles& dh,
truthGroomedJets = SG::makeHandle(m_truthGroomedJetCollectionName, ctx);
}
const SG::AuxElement::Accessor<int> nbAcc (m_truthLabelName + "_NB");
static const SG::ConstAccessor< ElementLink< xAOD::JetContainer > > ParentAcc ("Parent");
for(const xAOD::Jet *jet : jets) {
/// Get parent ungroomed reco jet for matching
const xAOD::Jet* parent = nullptr;
if ( m_matchUngroomedParent ){
ElementLink<xAOD::JetContainer> element_link = jet->auxdata<ElementLink<xAOD::JetContainer> >("Parent");
ElementLink<xAOD::JetContainer> element_link = ParentAcc (*jet);
if ( element_link.isValid() ) {
parent = *element_link;
}
......@@ -405,7 +407,7 @@ StatusCode JetTruthLabelingTool::labelRecoJets(DecorHandles& dh,
if ( m_getTruthGroomedJetValues ) {
if ( matchTruthJet ) {
for ( const xAOD::Jet* truthGroomedJet : *truthGroomedJets ) {
ElementLink<xAOD::JetContainer> element_link = truthGroomedJet->auxdata<ElementLink<xAOD::JetContainer> >("Parent");
ElementLink<xAOD::JetContainer> element_link = ParentAcc (*truthGroomedJet);
if ( !element_link.isValid() ) { continue; }
if ( matchTruthJet == *element_link ) {
matchTruthGroomedJet = truthGroomedJet;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment