cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2024 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef CepGen_Event_Event_h
20
#define CepGen_Event_Event_h
21
22
#include <memory>
23
24
#include "
CepGen/Event/Particle.h
"
25
26
namespace
cepgen
{
28
class
Event
{
29
public
:
30
explicit
Event
(
bool
compressed
=
false
);
31
Event
(
const
Event
&);
32
33
Event
&
operator=
(
const
Event
&);
34
bool
operator==
(
const
Event
&)
const
;
35
38
static
Event
minimal
(
size_t
num_out_particles = 1);
39
40
void
clear
();
41
void
freeze
();
42
void
restore
();
43
bool
compressed
()
const
;
44
Event
compress
()
const
;
45
void
updateRoles
();
46
48
friend
std::ostream&
operator<<
(std::ostream&,
const
Event
&);
50
void
dump
()
const
;
52
double
cmEnergy
()
const
;
53
54
//----- particles adders
55
59
ParticleRef
addParticle
(
Particle
& part,
bool
replace =
false
);
63
ParticleRef
addParticle
(
Particle::Role
role,
bool
replace =
false
);
64
65
//----- particles retrievers
66
67
size_t
size
()
const
;
68
bool
empty
()
const
;
69
Particles
particles
()
const
;
70
Particles
stableParticles
()
const
;
71
Particles
stableParticlesWithRole
(
Particle::Role
)
const
;
72
ParticlesMap
&
map
() {
return
particles_; }
73
76
ParticlesRefs
operator[]
(
Particle::Role
role);
78
const
Particles
&
operator()
(
Particle::Role
role)
const
;
80
ParticlesIds
ids
(
Particle::Role
role)
const
;
82
inline
bool
hasRole
(
Particle::Role
role)
const
{
return
particles_.count(role) != 0; }
85
Particle
&
oneWithRole
(
Particle::Role
role);
87
const
Particle
&
oneWithRole
(
Particle::Role
role)
const
;
90
Particle
&
operator[]
(
int
id
);
93
const
Particle
&
operator()
(
int
id
)
const
;
96
ParticlesRefs
operator[]
(
const
ParticlesIds
&
ids
);
99
Particles
operator()
(
const
ParticlesIds
&
ids
)
const
;
100
102
Momentum
missingMomentum
()
const
;
103
104
//----- general particles information retriever
105
108
Particles
mothers
(
const
Particle
& part)
const
;
111
ParticlesRefs
mothers
(
const
Particle
& part);
113
void
clearMothers
(
Particle
& part);
116
Particles
daughters
(
const
Particle
& part)
const
;
119
ParticlesRefs
daughters
(
const
Particle
& part);
121
Particles
stableDaughters
(
const
Particle
& part,
bool
recursive =
false
)
const
;
123
ParticlesRefs
stableDaughters
(
const
Particle
& part,
bool
recursive =
false
);
125
void
clearDaughters
(
Particle
& part);
127
ParticleRoles
roles
()
const
;
128
130
struct
EventMetadata
: std::unordered_map<std::string, float> {
131
EventMetadata
();
133
float
operator()
(
const
std::string& key)
const
{
return
count(key) > 0 ? at(key) : -1.; }
134
};
136
EventMetadata
metadata
;
137
138
private
:
139
static
constexpr
double
MIN_PRECISION = 1.e-10;
140
void
checkKinematics()
const
;
141
ParticlesMap
particles_;
143
struct
NumParticles {
144
size_t
cs{0};
145
size_t
op1{0};
146
size_t
op2{0};
147
} evtcontent_{};
148
bool
compressed_{
false
};
149
};
150
}
// namespace cepgen
151
152
#endif
Particle.h
cepgen::Event
Container for the information on the in- and outgoing particles' kinematics.
Definition
Event.h:28
cepgen::Event::stableParticles
Particles stableParticles() const
Vector of all stable particles in the event.
Definition
Event.cpp:362
cepgen::Event::compress
Event compress() const
Compress the event record.
Definition
Event.cpp:115
cepgen::Event::map
ParticlesMap & map()
Internal particles map retrieval operator.
Definition
Event.h:72
cepgen::Event::operator()
const Particles & operator()(Particle::Role role) const
Get a list of constant Particle objects corresponding to a certain role in the process kinematics.
Definition
Event.cpp:171
cepgen::Event::stableParticlesWithRole
Particles stableParticlesWithRole(Particle::Role) const
Vector of all stable particles of a given role.
Definition
Event.cpp:373
cepgen::Event::updateRoles
void updateRoles()
Update the table of particles roles.
Definition
Event.cpp:310
cepgen::Event::oneWithRole
Particle & oneWithRole(Particle::Role role)
First Particle object with a given role in the event.
Definition
Event.cpp:190
cepgen::Event::operator<<
friend std::ostream & operator<<(std::ostream &, const Event &)
Human-readable version of the event content.
Definition
Event.cpp:431
cepgen::Event::size
size_t size() const
Number of particles in the event.
Definition
Event.cpp:345
cepgen::Event::cmEnergy
double cmEnergy() const
Incoming beams centre-of-mass energy, in GeV.
Definition
Event.cpp:425
cepgen::Event::roles
ParticleRoles roles() const
List of roles defined for the given event (really process-dependant for the central system)
Definition
Event.cpp:303
cepgen::Event::ids
ParticlesIds ids(Particle::Role role) const
Get a list of particle identifiers in Event corresponding to a certain role in the process kinematics...
Definition
Event.cpp:178
cepgen::Event::clearMothers
void clearMothers(Particle &part)
Remove all mothers from a given particle (also affects the mothers' filiation)
Definition
Event.cpp:251
cepgen::Event::empty
bool empty() const
Is the particles map empty?
Definition
Event.cpp:351
cepgen::Event::clearDaughters
void clearDaughters(Particle &part)
Remove all daughters from a given particle (also affects the daughters' parentage)
Definition
Event.cpp:297
cepgen::Event::missingMomentum
Momentum missingMomentum() const
Compute the missing momentum for central particles in this event.
Definition
Event.cpp:384
cepgen::Event::daughters
Particles daughters(const Particle &part) const
List of all the daughters from a particle.
Definition
Event.cpp:257
cepgen::Event::addParticle
ParticleRef addParticle(Particle &part, bool replace=false)
Set the information on one particle in the process.
Definition
Event.cpp:323
cepgen::Event::particles
Particles particles() const
Vector of all particles in the event.
Definition
Event.cpp:353
cepgen::Event::operator==
bool operator==(const Event &) const
Equality operator.
Definition
Event.cpp:42
cepgen::Event::metadata
EventMetadata metadata
List of auxiliary information.
Definition
Event.h:136
cepgen::Event::compressed
bool compressed() const
Is the event already without intermediate-channel information?
Definition
Event.cpp:113
cepgen::Event::stableDaughters
Particles stableDaughters(const Particle &part, bool recursive=false) const
List all the stable daughters of a particle in this event.
Definition
Event.cpp:261
cepgen::Event::hasRole
bool hasRole(Particle::Role role) const
Check whether a particle role is represented in this event.
Definition
Event.h:82
cepgen::Event::freeze
void freeze()
Store a snapshot of the primordial event block.
Definition
Event.cpp:95
cepgen::Event::mothers
Particles mothers(const Particle &part) const
List of all parent Particle object for this given particle.
Definition
Event.cpp:247
cepgen::Event::clear
void clear()
Empty the whole event content.
Definition
Event.cpp:90
cepgen::Event::operator[]
ParticlesRefs operator[](Particle::Role role)
List of references to Particle objects corresponding to a certain role in the process kinematics.
Definition
Event.cpp:163
cepgen::Event::operator=
Event & operator=(const Event &)
Assignment operator.
Definition
Event.cpp:33
cepgen::Event::dump
void dump() const
Dump all the known information on every Particle object contained in this Event container in the outp...
Definition
Event.cpp:423
cepgen::Event::minimal
static Event minimal(size_t num_out_particles=1)
Build a trivial event with the minimal information.
Definition
Event.cpp:52
cepgen::Event::restore
void restore()
Restore the event to its "empty" state.
Definition
Event.cpp:104
cepgen::Momentum
Container for a particle's 4-momentum, along with useful methods to ease the development of any matri...
Definition
Momentum.h:33
cepgen::Particle
Kinematic information for one particle.
Definition
Particle.h:33
cepgen::Particle::Role
Role
Definition
Particle.h:50
cepgen::ParticlesMap
Map between a particle's role and its associated Particle object.
Definition
Particle.h:174
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
cepgen::ParticleRoles
std::vector< Particle::Role > ParticleRoles
List of particles' roles.
Definition
Particle.h:171
cepgen::ParticleRef
std::reference_wrapper< Particle > ParticleRef
Reference to a Particle object.
Definition
Particle.h:168
cepgen::ParticlesIds
std::set< int > ParticlesIds
A set of integer-type particle identifiers.
Definition
Particle.h:30
cepgen::ParticlesRefs
std::vector< ParticleRef > ParticlesRefs
List of references to Particle objects.
Definition
Particle.h:170
cepgen::Particles
std::vector< Particle > Particles
List of Particle objects.
Definition
Particle.h:169
cepgen::Event::EventMetadata
Collection of key -> value pairs storing event metadata.
Definition
Event.h:130
cepgen::Event::EventMetadata::operator()
float operator()(const std::string &key) const
Retrieve the metadata value associated to a key.
Definition
Event.h:133
cepgen::Event::EventMetadata::EventMetadata
EventMetadata()
Definition
Event.cpp:521
CepGen
Event
Event.h
Generated on Mon Jul 29 2024 for CepGen by
1.9.7