Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ParticlesPrinter.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ParticlesPrinter.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 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 "
ParticlesPrinter.hpp
"
10
11
#include "
Acts/Definitions/Units.hpp
"
12
#include "
Acts/Utilities/Logger.hpp
"
13
#include "
ActsExamples/EventData/SimParticle.hpp
"
14
#include "
ActsExamples/Framework/AlgorithmContext.hpp
"
15
#include "
ActsFatras/EventData/Particle.hpp
"
16
#include "
ActsFatras/EventData/ProcessType.hpp
"
17
18
#include <ostream>
19
#include <stdexcept>
20
#include <utility>
21
22
ActsExamples::ParticlesPrinter::ParticlesPrinter
(
const
Config
&
cfg
,
23
Acts::Logging::Level
lvl)
24
:
IAlgorithm
(
"ParticlesPrinter"
, lvl),
m_cfg
(cfg) {
25
if
(
m_cfg
.
inputParticles
.empty()) {
26
throw
std::invalid_argument(
"Input particles collection is not configured"
);
27
}
28
29
m_inputParticles
.
initialize
(
m_cfg
.
inputParticles
);
30
}
31
32
ActsExamples::ProcessCode
ActsExamples::ParticlesPrinter::execute
(
33
const
ActsExamples::AlgorithmContext
& ctx)
const
{
34
using namespace
Acts::UnitLiterals;
35
36
const
auto
&
particles
= m_inputParticles(ctx);
37
38
ACTS_INFO
(
"event "
<< ctx.
eventNumber
<<
" collection '"
39
<<
m_cfg
.inputParticles <<
"' contains "
40
<<
particles
.size() <<
" particles"
);
41
for
(
const
auto
&
particle
:
particles
) {
42
ACTS_INFO
(
" particle "
<<
particle
);
43
ACTS_INFO
(
" process_type: "
<<
particle
.process())
44
ACTS_INFO
(
" position: "
<<
particle
.position().transpose() / 1_mm
45
<<
" mm"
);
46
ACTS_INFO
(
" direction: "
<<
particle
.direction().transpose());
47
ACTS_INFO
(
" time: "
<<
particle
.time() / 1_ns <<
" ns"
);
48
ACTS_INFO
(
" |p|: "
<<
particle
.absoluteMomentum() / 1_GeV
49
<<
" GeV"
);
50
}
51
return
ProcessCode::SUCCESS
;
52
}
acts
blob
sPHENIX
Examples
Algorithms
Printers
ActsExamples
Printers
ParticlesPrinter.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration