ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasAlg.cxx File Reference
#include "G4AtlasAlg.h"
#include "G4AtlasFluxRecorder.h"
#include "G4AtlasTools/G4AtlasActionInitialization.h"
#include "AthenaKernel/RNGWrapper.h"
#include "CxxUtils/checker_macros.h"
#include "G4AtlasAlg/G4AtlasMTRunManager.h"
#include "G4AtlasAlg/G4AtlasRunManager.h"
#include "G4AtlasAlg/G4AtlasUserWorkerThreadInitialization.h"
#include "G4AtlasAlg/G4AtlasWorkerRunManager.h"
#include <G4Event.hh>
#include "G4EventManager.hh"
#include "G4GDMLParser.hh"
#include "G4Navigator.hh"
#include "G4ParallelWorldPhysics.hh"
#include "G4PropagatorInField.hh"
#include "G4RunManagerKernel.hh"
#include "G4ScoringManager.hh"
#include "G4StackManager.hh"
#include "G4StateManager.hh"
#include "G4TrackingManager.hh"
#include "G4TransportationManager.hh"
#include "G4UImanager.hh"
#include "G4VModularPhysicsList.hh"
#include "G4VUserPhysicsList.hh"
#include "CLHEP/Random/RandomEngine.h"
#include "GaudiKernel/IThreadInitTool.h"
#include "GeneratorObjects/HepMcParticleLink.h"
#include "GeoModelInterfaces/IGeoModelSvc.h"
#include "HitManagement/HitCollectionMap.h"
#include "MCTruth/AtlasG4EventUserInfo.h"
#include "PathResolver/PathResolver.h"
#include "StoreGate/ReadHandle.h"
#include "StoreGate/WriteHandle.h"
#include <memory>
#include <mutex>

Go to the source code of this file.

Functions

StatusCode G4AtlasAlg::initialize ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options.

Variables

static std::once_flag initializeOnceFlag
static std::once_flag finalizeOnceFlag
static std::once_flag releaseGeoModelOnceFlag

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode G4AtlasAlg::initialize ATLAS_NOT_THREAD_SAFE ( )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Definition at line 70 of file G4AtlasAlg.cxx.

71{
72 ATH_MSG_DEBUG("Start of initialize()");
73
74 // Read the simplified geometry for FastCaloSim track transportation if requested
75 if(!m_simplifiedGeoPath.empty()) {
76 std::string geoFile = PathResolverFindCalibFile(m_simplifiedGeoPath);
77
78 if (geoFile.empty()) {
79 ATH_MSG_FATAL("Could not find simplified geometry file: " << m_simplifiedGeoPath);
80 return StatusCode::FAILURE;
81 }
82
83 G4GDMLParser parser;
84 parser.Read(geoFile, false);
85 }
86
87 // Create the scoring manager if requested
88 if (m_recordFlux) G4ScoringManager::GetScoringManager();
89
90 ATH_CHECK( m_userActionSvc.retrieve() );
91 // One-time initialization
92 try {
93 std::call_once(initializeOnceFlag, &G4AtlasAlg::initializeOnce, this);
94 }
95 catch(const std::exception& e) {
96 ATH_MSG_ERROR("Failure in G4AtlasAlg::initializeOnce: " << e.what());
97 return StatusCode::FAILURE;
98 }
99
100 ATH_CHECK( m_rndmGenSvc.retrieve() );
101 ATH_CHECK(m_actionTools.retrieve());
102
103 ATH_CHECK(m_senDetTool.retrieve());
104 ATH_CHECK(m_fastSimTool.retrieve());
105
106 // Truth
107 ATH_CHECK( m_truthRecordSvc.retrieve() );
108 ATH_MSG_INFO( "- Using ISF TruthRecordSvc : " << m_truthRecordSvc.typeAndName() );
109
110 // I/O
111 ATH_CHECK( m_inputTruthCollectionKey.initialize());
112 ATH_CHECK( m_outputTruthCollectionKey.initialize());
113 ATH_CHECK( m_eventInfoKey.initialize() );
114
115 ATH_CHECK(m_inputConverter.retrieve());
116 if ( not m_truthPreselectionTool.empty() ) {
117 ATH_CHECK(m_truthPreselectionTool.retrieve());
118 }
119
120 if ( not m_qspatcher.empty() ) {
121 ATH_CHECK( m_qspatcher.retrieve() );
122 }
123
124 ATH_MSG_DEBUG("End of initialize()");
125 return StatusCode::SUCCESS;
126}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
static std::once_flag initializeOnceFlag
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
void initializeOnce()
G4 initialization called only by the first alg instance.

Variable Documentation

◆ finalizeOnceFlag

std::once_flag finalizeOnceFlag
static

Definition at line 54 of file G4AtlasAlg.cxx.

◆ initializeOnceFlag

std::once_flag initializeOnceFlag
static

Definition at line 53 of file G4AtlasAlg.cxx.

◆ releaseGeoModelOnceFlag

std::once_flag releaseGeoModelOnceFlag
static

Definition at line 55 of file G4AtlasAlg.cxx.