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
SimParticle.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file SimParticle.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 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
#pragma once
10
11
#include "
ActsExamples/Utilities/GroupBy.hpp
"
12
#include "
ActsFatras/EventData/Particle.hpp
"
13
14
#include <boost/container/flat_set.hpp>
15
16
namespace
ActsExamples {
17
namespace
detail {
18
struct
CompareParticleId
{
19
using
is_transparent
= void;
20
constexpr
bool
operator()
(
const
ActsFatras::Particle
&
lhs
,
21
const
ActsFatras::Particle
&
rhs
)
const
{
22
return
lhs.
particleId
() < rhs.
particleId
();
23
}
24
constexpr
bool
operator()
(
ActsFatras::Barcode
lhs
,
25
const
ActsFatras::Particle
&
rhs
)
const
{
26
return
lhs < rhs.
particleId
();
27
}
28
constexpr
bool
operator()
(
const
ActsFatras::Particle
&
lhs
,
29
ActsFatras::Barcode
rhs
)
const
{
30
return
lhs.
particleId
() <
rhs
;
31
}
32
};
33
struct
PrimaryVertexIdGetter
{
34
constexpr
ActsFatras::Barcode
operator()
(
35
const
ActsFatras::Particle
&
particle
)
const
{
36
return
ActsFatras::Barcode
(0
u
).
setVertexPrimary
(
37
particle.
particleId
().
vertexPrimary
());
38
}
39
};
40
struct
SecondaryVertexIdGetter
{
41
constexpr
ActsFatras::Barcode
operator()
(
42
const
ActsFatras::Particle
&
particle
)
const
{
43
return
ActsFatras::Barcode
(0
u
)
44
.
setVertexPrimary
(particle.
particleId
().
vertexPrimary
())
45
.setVertexSecondary(particle.
particleId
().
vertexSecondary
());
46
}
47
};
48
}
// namespace detail
49
50
using
SimParticle
=
::ActsFatras::Particle
;
52
using
SimParticleContainer
=
53
::boost::container::flat_set<SimParticle, detail::CompareParticleId>;
54
56
inline
GroupBy
<SimParticleContainer::const_iterator,
57
detail::PrimaryVertexIdGetter
>
58
groupByPrimaryVertex
(
const
SimParticleContainer
&
container
) {
59
return
makeGroupBy
(container,
detail::PrimaryVertexIdGetter
());
60
}
61
67
inline
GroupBy<SimParticleContainer::const_iterator,
68
detail::SecondaryVertexIdGetter>
69
groupBySecondaryVertex
(
const
SimParticleContainer
&
container
) {
70
return
makeGroupBy
(container,
detail::SecondaryVertexIdGetter
());
71
}
72
73
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Framework
include
ActsExamples
EventData
SimParticle.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration