ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Sim
MCTruth
MCTruth
AtlasG4EventUserInfo.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef MCTRUTH_ATLASG4EVENTUSERINFO_H
6
#define MCTRUTH_ATLASG4EVENTUSERINFO_H
7
8
9
#include <GaudiKernel/EventContext.h>
10
#include "
AthenaKernel/ExtendedEventContext.h
"
11
#include "
AthenaKernel/IProxyDict.h
"
12
#include "
AtlasHepMC/GenEvent_fwd.h
"
13
#include "
HitManagement/HitCollectionMap.h
"
14
15
#include <G4EventManager.hh>
16
#include "G4VUserEventInformation.hh"
17
18
#include <memory>
26
class
AtlasG4EventUserInfo
:
public
G4VUserEventInformation {
27
public
:
28
AtlasG4EventUserInfo
(
const
EventContext& ctx)
29
: G4VUserEventInformation()
30
,
m_eventContext
(ctx)
31
,
m_eventStore
(
Atlas
::getExtendedEventContext(ctx).proxy())
32
{}
33
38
HepMC::GenEvent
*
GetHepMCEvent
() ;
43
void
SetHepMCEvent
(
HepMC::GenEvent
*);
44
52
int
GetLastProcessedTrackID
()
const
{
return
m_lastProcessedTrackID
; }
59
void
SetLastProcessedTrackID
(
int
trackID) {
m_lastProcessedTrackID
= trackID; }
60
69
int
GetLastProcessedStep
()
const
{
return
m_lastProcessedStep
; }
76
void
SetLastProcessedStep
(
int
stepNumber) {
m_lastProcessedStep
= stepNumber; }
77
82
std::shared_ptr<HitCollectionMap>
GetHitCollectionMap
()
const
{
return
m_hitCollectionMap
; }
83
87
void
SetHitCollectionMap
(std::shared_ptr<HitCollectionMap> hitCollections) {
m_hitCollectionMap
= hitCollections; }
88
89
const
EventContext&
GetEventContext
()
const
{
return
m_eventContext
; }
90
91
IProxyDict
*
GetEventStore
() {
return
m_eventStore
; }
92
93
void
Print
()
const
{}
94
95
// Static helper method to get the AtlasG4EventUserInfo from G4EventManager
96
static
AtlasG4EventUserInfo
*
GetEventUserInfo
()
97
{
98
// Event manager may be null in unit tests.
99
G4EventManager* eventManager = G4EventManager::GetEventManager();
100
if
(!eventManager) {
101
return
nullptr
;
102
}
103
// User info may be null
104
return
static_cast<
AtlasG4EventUserInfo
*
>
(eventManager->GetUserInformation());
105
}
106
107
108
private
:
109
const
EventContext&
m_eventContext
;
110
IProxyDict
*
m_eventStore
{};
111
HepMC::GenEvent
*
m_theEvent
{};
112
113
std::shared_ptr<HitCollectionMap>
m_hitCollectionMap
{std::make_shared<HitCollectionMap>()};
114
115
// These next two variables are used by the CaloCalibrationHit
116
// recording code as event-level flags They correspond to the Track
117
// ID and step number of the last G4Step processed by a
118
// CaloCalibrationHit SD Both are needed, because a particle might
119
// have only one step
120
int
m_lastProcessedTrackID
{0};
121
int
m_lastProcessedStep
{0};
122
};
123
124
#endif
// MCTRUTH_ATLASG4EVENTUSERINFO_H
IProxyDict.h
ExtendedEventContext.h
GenEvent_fwd.h
HitCollectionMap.h
AtlasG4EventUserInfo::SetHepMCEvent
void SetHepMCEvent(HepMC::GenEvent *)
set m_theEvent, the pointer to the HepMC::GenEvent used to create the G4Event.
Definition
AtlasG4EventUserInfo.cxx:13
AtlasG4EventUserInfo::SetLastProcessedStep
void SetLastProcessedStep(int stepNumber)
record value of the G4Track::GetCurrentStepNumber() for the current G4Step.
Definition
AtlasG4EventUserInfo.h:76
AtlasG4EventUserInfo::m_hitCollectionMap
std::shared_ptr< HitCollectionMap > m_hitCollectionMap
Definition
AtlasG4EventUserInfo.h:113
AtlasG4EventUserInfo::m_eventStore
IProxyDict * m_eventStore
Definition
AtlasG4EventUserInfo.h:110
AtlasG4EventUserInfo::GetHitCollectionMap
std::shared_ptr< HitCollectionMap > GetHitCollectionMap() const
Get the HitCollectionMap object with shared ownership.
Definition
AtlasG4EventUserInfo.h:82
AtlasG4EventUserInfo::GetEventUserInfo
static AtlasG4EventUserInfo * GetEventUserInfo()
Definition
AtlasG4EventUserInfo.h:96
AtlasG4EventUserInfo::GetLastProcessedTrackID
int GetLastProcessedTrackID() const
return the value of G4Track::GetTrackID() for the last G4Step processed by a CaloCalibrationHit Sensi...
Definition
AtlasG4EventUserInfo.h:52
AtlasG4EventUserInfo::GetLastProcessedStep
int GetLastProcessedStep() const
return the value of the G4Track::GetCurrentStepNumber() for the last G4Step processed by a CaloCalibr...
Definition
AtlasG4EventUserInfo.h:69
AtlasG4EventUserInfo::GetEventStore
IProxyDict * GetEventStore()
Definition
AtlasG4EventUserInfo.h:91
AtlasG4EventUserInfo::m_theEvent
HepMC::GenEvent * m_theEvent
Definition
AtlasG4EventUserInfo.h:111
AtlasG4EventUserInfo::Print
void Print() const
Definition
AtlasG4EventUserInfo.h:93
AtlasG4EventUserInfo::AtlasG4EventUserInfo
AtlasG4EventUserInfo(const EventContext &ctx)
Definition
AtlasG4EventUserInfo.h:28
AtlasG4EventUserInfo::SetHitCollectionMap
void SetHitCollectionMap(std::shared_ptr< HitCollectionMap > hitCollections)
Set the HitCollectionMap object.
Definition
AtlasG4EventUserInfo.h:87
AtlasG4EventUserInfo::m_lastProcessedTrackID
int m_lastProcessedTrackID
Definition
AtlasG4EventUserInfo.h:120
AtlasG4EventUserInfo::m_eventContext
const EventContext & m_eventContext
Definition
AtlasG4EventUserInfo.h:109
AtlasG4EventUserInfo::m_lastProcessedStep
int m_lastProcessedStep
Definition
AtlasG4EventUserInfo.h:121
AtlasG4EventUserInfo::GetHepMCEvent
HepMC::GenEvent * GetHepMCEvent()
return a pointer to the HepMC::GenEvent used to create the G4Event.
Definition
AtlasG4EventUserInfo.cxx:8
AtlasG4EventUserInfo::SetLastProcessedTrackID
void SetLastProcessedTrackID(int trackID)
record the value of G4Track::GetTrackID() for the current G4Step.
Definition
AtlasG4EventUserInfo.h:59
AtlasG4EventUserInfo::GetEventContext
const EventContext & GetEventContext() const
Definition
AtlasG4EventUserInfo.h:89
IProxyDict
A proxy dictionary.
Definition
AthenaKernel/AthenaKernel/IProxyDict.h:47
Atlas
Definition
ExtendedEventContext.h:21
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
Generated on
for ATLAS Offline Software by
1.17.0