ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Utilities
G4RunManagement
src
AtlasG4SyncEventUserInfo.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
G4RunManagement/AtlasG4SyncEventUserInfo.h
"
6
7
#include <memory>
8
#include <mutex>
9
10
//---------------------------------------------------------------------------
11
// AtlasG4SyncEventUserInfo
12
//---------------------------------------------------------------------------
13
14
AtlasG4SyncEventUserInfo::AtlasG4SyncEventUserInfo
(CLHEP::HepRandomEngine* rng_engine,
15
AtlasG4SyncEventUserInfo::EventFactoryFunction
&& event_factory,
16
const
EventContext& ctx)
17
:
AtlasG4EventUserInfo
(ctx)
18
,
m_rng_engine
(rng_engine)
19
,
m_event_factory
(
std
::move(event_factory))
20
,
m_sync_interface
(
std
::make_shared<
G4EventSynchronizationInterface
>())
21
{
22
}
23
24
//---------------------------------------------------------------------------
25
// G4EventSynchronizationInterface
26
//---------------------------------------------------------------------------
27
28
auto
G4EventSynchronizationInterface::Status
()
const
->
EventStatus
29
{
30
std::scoped_lock lk(
m_mutex
);
31
return
m_status
;
32
}
33
34
void
G4EventSynchronizationInterface::SetStatus
(
const
EventStatus
& status)
35
{
36
{
37
std::scoped_lock lk(
m_mutex
);
38
m_status
=status;
39
}
40
m_cv
.notify_all();
41
}
42
43
void
G4EventSynchronizationInterface::WaitStatus
(
const
EventStatus
& status)
44
{
45
std::unique_lock lk(
m_mutex
);
46
m_cv
.wait(lk, [
this
,status]{
return
m_status
==status; });
47
}
AtlasG4SyncEventUserInfo.h
AtlasG4EventUserInfo::AtlasG4EventUserInfo
AtlasG4EventUserInfo(const EventContext &ctx)
Definition
AtlasG4EventUserInfo.h:28
AtlasG4SyncEventUserInfo::EventFactoryFunction
std::function< StatusCode(G4Event &, std::unique_ptr< AtlasG4SyncEventUserInfo >)> EventFactoryFunction
Definition
AtlasG4SyncEventUserInfo.h:55
AtlasG4SyncEventUserInfo::AtlasG4SyncEventUserInfo
AtlasG4SyncEventUserInfo(CLHEP::HepRandomEngine *, EventFactoryFunction &&, const EventContext &)
Definition
AtlasG4SyncEventUserInfo.cxx:14
AtlasG4SyncEventUserInfo::m_event_factory
EventFactoryFunction m_event_factory
Definition
AtlasG4SyncEventUserInfo.h:80
AtlasG4SyncEventUserInfo::m_rng_engine
CLHEP::HepRandomEngine * m_rng_engine
Definition
AtlasG4SyncEventUserInfo.h:78
AtlasG4SyncEventUserInfo::m_sync_interface
SPSyncInterface m_sync_interface
Definition
AtlasG4SyncEventUserInfo.h:83
G4EventSynchronizationInterface
Definition
AtlasG4SyncEventUserInfo.h:28
G4EventSynchronizationInterface::EventStatus
EventStatus
Definition
AtlasG4SyncEventUserInfo.h:29
G4EventSynchronizationInterface::m_cv
std::condition_variable m_cv
Definition
AtlasG4SyncEventUserInfo.h:48
G4EventSynchronizationInterface::Status
EventStatus Status() const
Definition
AtlasG4SyncEventUserInfo.cxx:28
G4EventSynchronizationInterface::m_mutex
std::mutex m_mutex
Definition
AtlasG4SyncEventUserInfo.h:47
G4EventSynchronizationInterface::SetStatus
void SetStatus(const EventStatus &)
Definition
AtlasG4SyncEventUserInfo.cxx:34
G4EventSynchronizationInterface::WaitStatus
void WaitStatus(const EventStatus &)
Definition
AtlasG4SyncEventUserInfo.cxx:43
G4EventSynchronizationInterface::m_status
EventStatus m_status
Definition
AtlasG4SyncEventUserInfo.h:46
const
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0