From 9db7b51299b63fa20aa3aeb752c4b5ecb2b4ea13 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Tue, 19 Jul 2022 17:51:16 +0200
Subject: [PATCH] GammaORTools: remove const_cast and enable thread-checker

---
 .../GammaORTools/GammaORTools/ATLAS_CHECK_THREAD_SAFETY     | 1 +
 .../GammaORTools/Root/VGammaORTool.cxx                      | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
 create mode 100644 PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/GammaORTools/ATLAS_CHECK_THREAD_SAFETY

diff --git a/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/GammaORTools/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/GammaORTools/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 000000000000..bcb7dd9acd8f
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/GammaORTools/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/Root/VGammaORTool.cxx b/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/Root/VGammaORTool.cxx
index 02e534d64d9b..8f2d1a3be44a 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/Root/VGammaORTool.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools/Root/VGammaORTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "GammaORTools/VGammaORTool.h"
@@ -295,7 +295,7 @@ std::vector<TLorentzVector> VGammaORTool::getLeptonP4s(const xAOD::TruthParticle
   std::vector<TLorentzVector> lepton_p4s;
   std::vector<int> lepton_origins;
   for (const auto& p : lepton_candidates) {
-    auto res = const_cast<asg::AnaToolHandle<MCTruthClassifier>*>(&m_truthClassifier)->get()->particleTruthClassifier(p);
+    auto res = m_truthClassifier->particleTruthClassifier(p);
     lepton_origins.push_back(res.second);
     lepton_p4s.push_back(p->p4());
   }
@@ -317,7 +317,7 @@ std::vector<TLorentzVector> VGammaORTool::getPhotonP4s(const xAOD::TruthParticle
       continue;
     }
     // determine photon origin
-    auto res = const_cast<asg::AnaToolHandle<MCTruthClassifier>*>(&m_truthClassifier)->get()->particleTruthClassifier(p);
+    auto res = m_truthClassifier->particleTruthClassifier(p);
     photon_origins.push_back(res.second);
     photon_p4s.push_back(p->p4());
   }
-- 
GitLab