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
No related branches found
No related tags found
1 merge request!20779WIP: Migrate DataQualityTools to ToolHandles
......@@ -120,7 +120,10 @@
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
#include <mutex>
static std::once_flag warning1OnceFlag;
static std::once_flag warning2OnceFlag;
namespace CaloG4
{
......@@ -564,17 +567,13 @@ namespace CaloG4
}
// If we get here, the registry was never initialized for LAr.
// FIXME: thread-unsafe statics!!!
static G4bool errorDisplayed = false;
if ( ! errorDisplayed ) {
errorDisplayed = true;
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << 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;
}
std::call_once(warning1OnceFlag, [](){
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << 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;
}
else {
......@@ -588,17 +587,14 @@ namespace CaloG4
}
// If we get here, the registry was never initialized for LAr.
// FIXME: thread-unsafe statics!!!
static G4bool errorDisplayed1 = false;
if ( ! errorDisplayed1 ) {
errorDisplayed1 = true;
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
<<" WARNING! touchableHandle->GetVolume()==0 geometry problem ? and also" << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << 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;
}
std::call_once(warning2OnceFlag, [](){
G4cout << "SimulationEnergies::ProcessEscapedEnergy - " << G4endl
<<" WARNING! touchableHandle->GetVolume()==0 geometry problem ? and also" << G4endl
<< " WARNING! CaloG4::EscapedEnergyRegistry was never initialized for 'LArG4::'" << 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;
}
}
......
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