From 8ab822fc839c8cdca34e9d8830c14f9b13c6c3a3 Mon Sep 17 00:00:00 2001
From: Scott Snyder <scott.snyder@cern.ch>
Date: Mon, 28 Sep 2020 08:50:42 +0000
Subject: [PATCH] GeneratorObjects: Enable thread-safety checking.

Enable thread-safety checking and fix identified issues.
---
 Generators/FlowAfterburner/src/AddFlowByShifting.cxx      | 1 -
 .../GeneratorObjects/ATLAS_CHECK_THREAD_SAFETY            | 1 +
 .../GeneratorObjects/GeneratorObjects/HijingEventParams.h | 8 ++++----
 .../GeneratorObjects/test/HepMcParticleLink_test.cxx      | 3 +++
 4 files changed, 8 insertions(+), 5 deletions(-)
 create mode 100644 Generators/GeneratorObjects/GeneratorObjects/ATLAS_CHECK_THREAD_SAFETY

diff --git a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx
index 2cad2e9bd5a..c24e4906c46 100644
--- a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx
+++ b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx
@@ -234,7 +234,6 @@ StatusCode AddFlowByShifting::execute() {
   m_psi_n[1]=hijing_pars->get_bphi()                   ;//the psi2 plane is aligned with the impact parameter
   m_psi_n[1]=std::atan2(std::sin(2*m_psi_n[1]),std::cos(2*m_psi_n[1]))/2.0;//ensure that Psi2 is within [-PI/2,PI/2]
   hijing_pars_nc->set_psi(2,m_psi_n[1]);
-  (*hijing_pars).set_psi(2,m_psi_n[1]);
   ATH_MSG_DEBUG(" Psi2 for event : "<<(*hijing_pars).get_psi(2));
 
 
diff --git a/Generators/GeneratorObjects/GeneratorObjects/ATLAS_CHECK_THREAD_SAFETY b/Generators/GeneratorObjects/GeneratorObjects/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 00000000000..21a0af44302
--- /dev/null
+++ b/Generators/GeneratorObjects/GeneratorObjects/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+Generators/GeneratorObjects
diff --git a/Generators/GeneratorObjects/GeneratorObjects/HijingEventParams.h b/Generators/GeneratorObjects/GeneratorObjects/HijingEventParams.h
index d9ee6248ba9..445fc5f8cf8 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/HijingEventParams.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/HijingEventParams.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef GENERATOROBJECTSHIJINGEVENTPARAMS_H
@@ -40,7 +40,7 @@ class HijingEventParams
 
 
   float get_psi(int n) const;
-  void  set_psi(int ihar,float psi) const;
+  void  set_psi(int ihar,float psi);
 
 
 private:
@@ -55,7 +55,7 @@ private:
   float m_b = 0;
   float m_bphi = 0; 
 
-  mutable float m_psi_1 = 0,m_psi_2 = 0,m_psi_3 = 0,m_psi_4 = 0,m_psi_5 = 0,m_psi_6 = 0;
+  float m_psi_1 = 0,m_psi_2 = 0,m_psi_3 = 0,m_psi_4 = 0,m_psi_5 = 0,m_psi_6 = 0;
 };
 
 inline
@@ -104,7 +104,7 @@ inline  float HijingEventParams::get_psi(int ihar) const
     return 0; 
 }
 
-inline  void HijingEventParams::set_psi(int ihar, float psi) const 
+inline  void HijingEventParams::set_psi(int ihar, float psi)
 { 
     if(ihar==1) m_psi_1=psi;
     if(ihar==2) m_psi_2=psi;
diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 3937568c8eb..65d4d97ca38 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -9,6 +9,9 @@
 
 #undef NDEBUG
 
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
+
 #include <iostream>
 #include <limits>
 #include <list>
-- 
GitLab