ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
master
CI
Core
doc
Examples
Algorithms
DD4hepG4
Digitization
Fatras
Fitting
Geant4
include
src
MMDetectorConstruction.cpp
MMEventAction.cpp
MMPrimaryGeneratorAction.cpp
MMRunAction.cpp
MMSteppingAction.cpp
Generators
GeneratorsPythia8
MaterialMapping
Printers
Propagation
TruthTracking
Vertexing
Detectors
Framework
Io
Run
Scripts
Fatras
Plugins
Tests
thirdparty
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MMEventAction.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MMEventAction.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
ACTFW/Plugins/Geant4/MMEventAction.hpp
"
10
11
#include <stdexcept>
12
13
#include "
ACTFW/Plugins/Geant4/MMPrimaryGeneratorAction.hpp
"
14
#include "
ACTFW/Plugins/Geant4/MMSteppingAction.hpp
"
15
#include "
G4Event.hh
"
16
#include "
G4RunManager.hh
"
17
18
FW::Geant4::MMEventAction
*
FW::Geant4::MMEventAction::fgInstance
=
nullptr
;
19
20
FW::Geant4::MMEventAction
*
FW::Geant4::MMEventAction::Instance
() {
21
// Static acces function via G4RunManager
22
return
fgInstance
;
23
}
24
25
FW::Geant4::MMEventAction::MMEventAction
() :
G4UserEventAction
() {
26
if
(
fgInstance
) {
27
throw
std::logic_error(
"Attempted to duplicate a singleton"
);
28
}
else
{
29
fgInstance
=
this
;
30
}
31
}
32
33
FW::Geant4::MMEventAction::~MMEventAction
() {
34
fgInstance =
nullptr
;
35
}
36
37
void
FW::Geant4::MMEventAction::BeginOfEventAction
(
const
G4Event
*) {
38
// reset the collection of material steps
39
MMSteppingAction::Instance
()->
Reset
();
40
}
41
42
void
FW::Geant4::MMEventAction::EndOfEventAction
(
const
G4Event
* event) {
43
const
auto
* rawPos =
event
->GetPrimaryVertex();
44
// access the initial direction of the track
45
G4ThreeVector
rawDir =
MMPrimaryGeneratorAction::Instance
()->
direction
();
46
// create the RecordedMaterialTrack
47
Acts::RecordedMaterialTrack
mtrecord;
48
mtrecord.first.first =
49
Acts::Vector3D
(rawPos->GetX0(), rawPos->GetY0(), rawPos->GetZ0());
50
mtrecord.first.second =
Acts::Vector3D
(rawDir.
x
(), rawDir.
y
(), rawDir.
z
());
51
mtrecord.second.materialInteractions =
52
MMSteppingAction::Instance
()->
materialSteps
();
53
54
// write out the RecordedMaterialTrack of one event
55
m_records.push_back(mtrecord);
56
57
// write out the steps of one track in an event
58
m_tracksteps.adopt_sequence(
MMSteppingAction::Instance
()->trackSteps());
59
}
60
61
void
FW::Geant4::MMEventAction::Reset
() {}
acts
blob
master
Examples
Algorithms
Geant4
src
MMEventAction.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:23
using
1.8.2 with
ECCE GitHub integration