cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Particle.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_Particle_h
20#define CepGen_Event_Particle_h
21
22#include <set>
23
27#include "CepGen/Utils/Hasher.h"
28
29namespace cepgen {
30 typedef std::set<int> ParticlesIds;
31
33 class Particle {
34 public:
36 enum class Status {
38 DebugResonance = -5,
39 Resonance = -4,
40 Fragmented = -3,
41 Propagator = -2,
42 Incoming = -1,
43 Undefined = 0,
44 FinalState = 1,
45 Undecayed = 2,
46 Unfragmented = 3
47 };
48 friend std::ostream& operator<<(std::ostream& os, const Status&);
50 enum Role {
58 Parton1 = 41,
59 Parton2 = 42
60 };
61 friend std::ostream& operator<<(std::ostream& os, const Role&);
62
63 //----- static getters
64
70
71 bool operator<(const Particle&) const;
72 bool operator==(const Particle&) const;
73
74 // --- general particle properties
75
76 inline int id() const { return id_; }
78 inline Particle& setId(int id) {
79 id_ = id;
80 return *this;
81 }
82 float charge() const;
84 inline Particle& setAntiparticle(bool anti) {
85 antiparticle_ = anti;
86 return *this;
87 }
88 inline Role role() const { return role_; }
90 inline Particle& setRole(const Role& role) {
91 role_ = role;
92 return *this;
93 }
94 inline Status status() const { return (Status)status_; }
97 status_ = (int)status;
98 return *this;
99 }
101 inline Particle& setStatus(int status) {
102 status_ = status;
103 return *this;
104 }
105
109 Particle& setPdgId(pdgid_t pdg, short ch = 0);
110 pdgid_t pdgId() const;
113 Particle& setIntegerPdgId(long pdg_id);
114 long integerPdgId() const;
115
116 inline float helicity() const { return helicity_; }
118 inline Particle& setHelicity(float heli) {
119 helicity_ = heli;
120 return *this;
121 }
122
123 inline Momentum& momentum() { return momentum_; }
125 inline const Momentum& momentum() const { return momentum_; }
128 Particle& setMomentum(const Momentum&, bool offshell = false);
134 Particle& setMomentum(double px, double py, double pz, double e = -1.);
137 inline Particle& setMomentum(double p[4]) { return setMomentum(p[0], p[1], p[2], p[3]); }
138 bool valid();
139
140 // --- particle relations
141
142 inline bool primary() const { return mothers_.empty(); }
143 Particle& addMother(Particle& part);
144 inline ParticlesIds mothers() const { return mothers_; }
145 inline ParticlesIds& mothers() { return mothers_; }
147 inline ParticlesIds daughters() const { return daughters_; }
148 inline ParticlesIds& daughters() { return daughters_; }
149
150 // --- global particle information extraction
151
152 friend std::ostream& operator<<(std::ostream&, const Particle&);
153
154 protected:
155 int id_{-1};
156 bool antiparticle_{false};
158 float helicity_{0.};
164 };
165
166 // --- particle containers
167
168 typedef std::reference_wrapper<Particle> ParticleRef;
169 typedef std::vector<Particle> Particles;
170 typedef std::vector<ParticleRef> ParticlesRefs;
171 typedef std::vector<Particle::Role> ParticleRoles;
172
174 class ParticlesMap : public std::unordered_map<Particle::Role, Particles, utils::EnumHash<Particle::Role> > {
175 public:
176 ParticlesMap() = default;
177 ParticlesMap(const ParticlesMap&);
179 };
180} // namespace cepgen
181
182#endif
Container for a particle's 4-momentum, along with useful methods to ease the development of any matri...
Definition Momentum.h:33
Kinematic information for one particle.
Definition Particle.h:33
Momentum & momentum()
Retrieve the momentum object associated with this particle Retrieve the momentum object associated wi...
Definition Particle.h:123
pdgid_t pdgId() const
Retrieve the objectified PDG identifier Set the PDG identifier (along with the particle's electric ch...
Definition Particle.cpp:91
Particle & addDaughter(Particle &part)
Add a decay product.
Definition Particle.cpp:59
Momentum momentum_
Momentum properties handler.
Definition Particle.h:157
friend std::ostream & operator<<(std::ostream &os, const Status &)
Human-readable particle's status Role of the particle in the process.
Definition Particle.cpp:130
float helicity_
Helicity.
Definition Particle.h:158
bool valid()
Is this particle a valid particle which can be used for kinematic computations?
Definition Particle.cpp:37
ParticlesIds & mothers()
Identifier to the mother particles.
Definition Particle.h:145
bool operator<(const Particle &) const
Comparison operator (from unique identifier)
Definition Particle.cpp:30
Particle & setStatus(int status)
Set the particle decay/stability status.
Definition Particle.h:101
Role role_
Role in the process.
Definition Particle.h:159
float helicity() const
Particle's helicity Set the helicity of the particle.
Definition Particle.h:116
ParticlesIds daughters() const
Identifiers list of all daughter particles.
Definition Particle.h:147
int status_
Decay/stability status.
Definition Particle.h:160
long integerPdgId() const
Retrieve the integer value of the PDG identifier.
Definition Particle.cpp:102
Particle & setMomentum(const Momentum &, bool offshell=false)
Associate a momentum object to this particle.
Definition Particle.cpp:77
Particle & addMother(Particle &part)
Set the mother particle.
Definition Particle.cpp:47
const Momentum & momentum() const
Definition Particle.h:125
Status
Internal status code for a particle.
Definition Particle.h:36
@ Undecayed
Particle to be decayed externally.
@ Fragmented
Already fragmented outgoing beam.
@ PrimordialIncoming
Incoming beam particle.
@ Incoming
Incoming parton.
@ FinalState
Stable, final state particle.
@ Resonance
Already decayed intermediate resonance.
@ Unfragmented
Particle to be hadronised externally.
@ Propagator
Generic propagator.
@ DebugResonance
Intermediate resonance (for processes developers)
@ Undefined
Undefined particle.
int id() const
Unique identifier (in a Event object context) Set the particle unique identifier in an event.
Definition Particle.h:76
ParticlesIds mothers() const
Identifier to the mother particles.
Definition Particle.h:144
Particle & setIntegerPdgId(long pdg_id)
Definition Particle.cpp:95
Particle & setAntiparticle(bool anti)
Definition Particle.h:84
Particle & setRole(const Role &role)
Definition Particle.h:90
float charge() const
Electric charge (given as a float number, for the quarks and bound states) Set whether we are coping ...
Definition Particle.cpp:45
bool operator==(const Particle &) const
Equality operator.
Definition Particle.cpp:32
bool primary() const
Is this particle a primary particle?
Definition Particle.h:142
bool antiparticle_
Are we dealing with the particle or antiparticle?
Definition Particle.h:156
Particle & setHelicity(float heli)
Definition Particle.h:118
int id_
Unique identifier in an event.
Definition Particle.h:155
Particle & setMomentum(double p[4])
Set the 4-momentum associated to the particle.
Definition Particle.h:137
@ IncomingBeam2
incoming beam particle
Definition Particle.h:53
@ Parton2
beam incoming parton
Definition Particle.h:59
@ OutgoingBeam1
outgoing beam state/particle
Definition Particle.h:54
@ UnknownRole
Undefined role.
Definition Particle.h:51
@ IncomingBeam1
incoming beam particle
Definition Particle.h:52
@ OutgoingBeam2
outgoing beam state/particle
Definition Particle.h:55
@ Parton1
beam incoming parton
Definition Particle.h:58
@ CentralSystem
Central particles system.
Definition Particle.h:56
@ Intermediate
Intermediate two-parton system.
Definition Particle.h:57
ParticlesIds mothers_
List of mother particles.
Definition Particle.h:161
Status status() const
Particle status Set the particle decay/stability status.
Definition Particle.h:94
pdgid_t pdg_id_
PDG id.
Definition Particle.h:163
Particle & setId(int id)
Definition Particle.h:78
ParticlesIds & daughters()
Identifiers list of all daughter particles.
Definition Particle.h:148
Role role() const
Role in the considered process Set the particle role in the process.
Definition Particle.h:88
Particle & setStatus(Status status)
Definition Particle.h:96
Particle & setPdgId(pdgid_t pdg, short ch=0)
Set the PDG identifier (along with the particle's electric charge)
Definition Particle.cpp:93
ParticlesIds daughters_
List of daughter particles.
Definition Particle.h:162
Map between a particle's role and its associated Particle object.
Definition Particle.h:174
ParticlesMap & operator=(const ParticlesMap &)
Definition Particle.cpp:185
Common namespace for this Monte Carlo generator.
std::vector< Particle::Role > ParticleRoles
List of particles' roles.
Definition Particle.h:171
std::reference_wrapper< Particle > ParticleRef
Reference to a Particle object.
Definition Particle.h:168
std::set< int > ParticlesIds
A set of integer-type particle identifiers.
Definition Particle.h:30
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
std::vector< ParticleRef > ParticlesRefs
List of references to Particle objects.
Definition Particle.h:170
std::vector< Particle > Particles
List of Particle objects.
Definition Particle.h:169