Skip to content
Snippets Groups Projects
Commit c8bdb6d8 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'SimulationEnergiesThreadSafetyPt1_master' into 'master'

Sweep !9651 from '21.0' to 'master': Replace static bool variables with std::call_once (ATLASSIM-3568)

See merge request atlas/athena!10016
parents e9836f9a 19990582
1 merge request!20779WIP: Migrate DataQualityTools to ToolHandles
...@@ -120,7 +120,10 @@ ...@@ -120,7 +120,10 @@
#include "G4TouchableHistory.hh" #include "G4TouchableHistory.hh"
#include "G4ios.hh" #include "G4ios.hh"
#include <mutex>
static std::once_flag warning1OnceFlag;
static std::once_flag warning2OnceFlag;
namespace CaloG4 namespace CaloG4
{ {
...@@ -564,17 +567,13 @@ namespace CaloG4 ...@@ -564,17 +567,13 @@ namespace CaloG4
} }
// If we get here, the registry was never initialized for LAr. // If we get here, the registry was never initialized for LAr.
// FIXME: thread-unsafe statics!!! std::call_once(warning1OnceFlag, [](){
static G4bool errorDisplayed = false; G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
if ( ! errorDisplayed ) { << " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << G4endl
errorDisplayed = true; << " and LArG4Sim is the package with the code that handles CalibrationHits" << G4endl
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl << " in non-sensitive volumes. Not all energies deposited in this simulation" << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << G4endl << " will be recorded." << G4endl;
<< " and LArG4Sim is the package with the code that handles CalibrationHits" << G4endl });
<< " in non-sensitive volumes. Not all energies deposited in this simulation" << G4endl
<< " will be recorded." << G4endl;
}
return false; return false;
} }
else { else {
...@@ -588,17 +587,14 @@ namespace CaloG4 ...@@ -588,17 +587,14 @@ namespace CaloG4
} }
// If we get here, the registry was never initialized for LAr. // If we get here, the registry was never initialized for LAr.
// FIXME: thread-unsafe statics!!! std::call_once(warning2OnceFlag, [](){
static G4bool errorDisplayed1 = false; G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
if ( ! errorDisplayed1 ) { <<" WARNING! touchableHandle->GetVolume()==0 geometry problem ? and also" << G4endl
errorDisplayed1 = true; << " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << G4endl
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl << " and LArG4Sim is the package with the code that handles CalibrationHits" << G4endl
<<" WARNING! touchableHandle->GetVolume()==0 geometry problem ? and also" << G4endl << " in non-sensitive volumes. Not all energies deposited in this simulation" << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << G4endl << " will be recorded." << G4endl;
<< " and LArG4Sim is the package with the code that handles CalibrationHits" << G4endl });
<< " in non-sensitive volumes. Not all energies deposited in this simulation" << G4endl
<< " will be recorded." << G4endl;
}
return false; return false;
} }
} }
......
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