ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <memory>
8#include <mutex>
9
10//---------------------------------------------------------------------------
11// AtlasG4SyncEventUserInfo
12//---------------------------------------------------------------------------
13
14AtlasG4SyncEventUserInfo::AtlasG4SyncEventUserInfo(CLHEP::HepRandomEngine* rng_engine,
16 const EventContext& ctx)
18 , m_rng_engine(rng_engine)
19 , m_event_factory(std::move(event_factory))
21{
22}
23
24//---------------------------------------------------------------------------
25// G4EventSynchronizationInterface
26//---------------------------------------------------------------------------
27
29{
30 std::scoped_lock lk(m_mutex);
31 return m_status;
32}
33
35{
36 {
37 std::scoped_lock lk(m_mutex);
38 m_status=status;
39 }
40 m_cv.notify_all();
41}
42
44{
45 std::unique_lock lk(m_mutex);
46 m_cv.wait(lk, [this,status]{ return m_status==status; });
47}
AtlasG4EventUserInfo(const EventContext &ctx)
std::function< StatusCode(G4Event &, std::unique_ptr< AtlasG4SyncEventUserInfo >)> EventFactoryFunction
AtlasG4SyncEventUserInfo(CLHEP::HepRandomEngine *, EventFactoryFunction &&, const EventContext &)
EventFactoryFunction m_event_factory
CLHEP::HepRandomEngine * m_rng_engine
STL namespace.