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
Generators
GeneratorsPythia8
MaterialMapping
include
src
GeantinoRecording.cpp
MaterialMapping.cpp
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
GeantinoRecording.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file GeantinoRecording.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/MaterialMapping/GeantinoRecording.hpp
"
10
11
#include <
FTFP_BERT.hh
>
12
#include <iostream>
13
#include <stdexcept>
14
15
#include "
ACTFW/Framework/WhiteBoard.hpp
"
16
#include "
ACTFW/Plugins/Geant4/MMDetectorConstruction.hpp
"
17
#include "
ACTFW/Plugins/Geant4/MMEventAction.hpp
"
18
#include "
ACTFW/Plugins/Geant4/MMPrimaryGeneratorAction.hpp
"
19
#include "
ACTFW/Plugins/Geant4/MMRunAction.hpp
"
20
#include "
ACTFW/Plugins/Geant4/MMSteppingAction.hpp
"
21
22
FW::GeantinoRecording::GeantinoRecording
(
23
const
FW::GeantinoRecording::Config
& cnf,
Acts::Logging::Level
level)
24
: FW::
BareAlgorithm
(
"GeantinoRecording"
, level),
25
m_cfg(cnf),
26
m_runManager(std::
make_unique
<
G4RunManager
>()) {
28
if
(
m_cfg
.
geant4Service
) {
29
m_runManager
->SetUserInitialization(
m_cfg
.
geant4Service
->geant4Geometry());
30
}
else
if
(!
m_cfg
.
gdmlFile
.empty()) {
32
ACTS_INFO
(
33
"received Geant4 geometry from GDML file: "
<<
m_cfg
.
gdmlFile
.c_str());
34
FW::Geant4::MMDetectorConstruction
* detConstruction =
35
new
FW::Geant4::MMDetectorConstruction
();
36
detConstruction->setGdmlInput(
m_cfg
.
gdmlFile
.c_str());
37
m_runManager
->SetUserInitialization(
38
detConstruction);
// constructs detector (calls Construct in
39
// Geant4DetectorConstruction)
40
}
else
{
41
throw
std::invalid_argument(
"Missing geometry input for Geant4"
);
42
}
43
45
m_runManager
->SetUserInitialization(
new
FTFP_BERT
);
46
m_runManager
->SetUserAction(
new
FW::Geant4::MMPrimaryGeneratorAction
(
47
"geantino"
, 1000.,
m_cfg
.
seed1
,
m_cfg
.
seed2
));
48
FW::Geant4::MMRunAction
* runaction =
new
FW::Geant4::MMRunAction
();
49
m_runManager
->SetUserAction(runaction);
50
m_runManager
->SetUserAction(
new
FW::Geant4::MMEventAction
());
51
m_runManager
->SetUserAction(
new
FW::Geant4::MMSteppingAction
());
52
m_runManager
->Initialize();
53
}
54
55
FW::ProcessCode
FW::GeantinoRecording::execute
(
56
const
FW::AlgorithmContext
&
context
)
const
{
57
// Begin with the simulation
58
m_runManager->BeamOn(m_cfg.tracksPerEvent);
59
// Retrieve the track material tracks from Geant4
60
auto
recordedMaterial =
61
FW::Geant4::MMEventAction::Instance
()->
MaterialTracks
();
62
ACTS_INFO
(
"Received "
<< recordedMaterial.size()
63
<<
" MaterialTracks. Writing them now onto file..."
);
64
65
// Write the recorded material to the event store
66
context.
eventStore
.
add
(m_cfg.geantMaterialCollection,
67
std::move(recordedMaterial));
68
69
// // Retrieve the sim hit track steps from Geant4
70
// auto trackSteps = FW::Geant4::MMEventAction::Instance()->TrackSteps();
71
// ACTS_INFO("Received " << trackSteps.size()
72
// << " steps per track. Writing them now into
73
// file...");
74
//
75
// // Write the sim hit track steps info to the event store
76
// context.eventStore.add(m_cfg.geantTrackStepCollection,
77
// std::move(trackSteps));
78
return
FW::ProcessCode::SUCCESS
;
79
}
acts
blob
master
Examples
Algorithms
MaterialMapping
src
GeantinoRecording.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:23
using
1.8.2 with
ECCE GitHub integration