cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic 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-2023 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 Particle(const Particle&);
71 inline ~Particle() = default;
72 Particle& operator=(const Particle&) = default;
73 bool operator<(const Particle& rhs) const;
74
75 // --- general particle properties
76
77 inline int id() const { return id_; }
79 inline Particle& setId(int id) {
80 id_ = id;
81 return *this;
82 }
83 float charge() const;
85 inline Particle& setAntiparticle(bool anti) {
86 antiparticle_ = anti;
87 return *this;
88 }
89 inline Role role() const { return role_; }
91 inline Particle& setRole(const Role& role) {
92 role_ = role;
93 return *this;
94 }
95 inline Status status() const { return (Status)status_; }
98 status_ = (int)status;
99 return *this;
100 }
102 inline Particle& setStatus(int status) {
103 status_ = status;
104 return *this;
105 }
106
110 Particle& setPdgId(pdgid_t pdg, short ch = 0);
111 pdgid_t pdgId() const;
114 Particle& setIntegerPdgId(long pdg_id);
115 long integerPdgId() const;
116
117 inline float helicity() const { return helicity_; }
119 inline Particle& setHelicity(float heli) {
120 helicity_ = heli;
121 return *this;
122 }
123
124 inline Momentum& momentum() { return momentum_; }
126 inline const Momentum& momentum() const { return momentum_; }
129 Particle& setMomentum(const Momentum&, bool offshell = false);
135 Particle& setMomentum(double px, double py, double pz, double e = -1.);
138 inline Particle& setMomentum(double p[4]) { return setMomentum(p[0], p[1], p[2], p[3]); }
139 bool valid();
140
141 // --- particle relations
142
143 inline bool primary() const { return mothers_.empty(); }
145 Particle& addMother(Particle& part);
146 inline ParticlesIds mothers() const { return mothers_; }
149 inline size_t numDaughters() const { return daughters_.size(); };
150 inline ParticlesIds daughters() const { return daughters_; }
151
152 // --- global particle information extraction
153
154 friend std::ostream& operator<<(std::ostream&, const Particle&);
155
156 protected:
157 int id_{-1};
158 bool antiparticle_{false};
160 float helicity_{0.};
167 };
168
169 // --- particle containers
170
171 typedef std::reference_wrapper<Particle> ParticleRef;
172 typedef std::vector<Particle> Particles;
173 typedef std::vector<ParticleRef> ParticlesRefs;
174 typedef std::vector<Particle::Role> ParticleRoles;
175
177 class ParticlesMap : public std::unordered_map<Particle::Role, Particles, utils::EnumHash<Particle::Role> > {
178 public:
179 ParticlesMap() = default;
180 ParticlesMap(const ParticlesMap&);
182 };
183} // namespace cepgen
184
185#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:124
pdgid_t pdgId() const
Retrieve the objectified PDG identifier Set the PDG identifier (along with the particle's electric ch...
Definition Particle.cpp:118
Particle & addDaughter(Particle &part)
Add a decay product.
Definition Particle.cpp:83
Momentum momentum_
Momentum properties handler.
Definition Particle.h:159
friend std::ostream & operator<<(std::ostream &os, const Status &)
Human-readable particle's status Role of the particle in the process.
Definition Particle.cpp:160
Particle & clearMothers()
Clear the particle parentage.
Definition Particle.cpp:59
float helicity_
Helicity.
Definition Particle.h:160
bool valid()
Is this particle a valid particle which can be used for kinematic computations?
Definition Particle.cpp:49
Particle & setStatus(int status)
Set the particle decay/stability status.
Definition Particle.h:102
Role role_
Role in the process.
Definition Particle.h:161
float helicity() const
Particle's helicity Set the helicity of the particle.
Definition Particle.h:117
ParticlesIds daughters() const
Number of daughter particles.
Definition Particle.h:150
~Particle()=default
int status_
Decay/stability status.
Definition Particle.h:162
long integerPdgId() const
Retrieve the integer value of the PDG identifier.
Definition Particle.cpp:132
bool operator<(const Particle &rhs) const
Comparison operator (from unique identifier)
Definition Particle.cpp:47
Particle & setMomentum(const Momentum &, bool offshell=false)
Associate a momentum object to this particle.
Definition Particle.cpp:104
Particle & addMother(Particle &part)
Set the mother particle.
Definition Particle.cpp:64
const Momentum & momentum() const
Definition Particle.h:126
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:77
ParticlesIds mothers() const
Identifier to the mother particles.
Definition Particle.h:146
Particle & setIntegerPdgId(long pdg_id)
Definition Particle.cpp:122
size_t numDaughters() const
Definition Particle.h:149
Particle & setAntiparticle(bool anti)
Definition Particle.h:85
Particle & clearDaughters()
Remove the decay products linking.
Definition Particle.cpp:78
Particle & setRole(const Role &role)
Definition Particle.h:91
float charge() const
Electric charge (given as a float number, for the quarks and bound states) Set whether we are coping ...
Definition Particle.cpp:57
bool primary() const
Is this particle a primary particle?
Definition Particle.h:143
bool antiparticle_
Are we dealing with the particle or antiparticle?
Definition Particle.h:158
Particle & setHelicity(float heli)
Definition Particle.h:119
int id_
Unique identifier in an event.
Definition Particle.h:157
Particle & setMomentum(double p[4])
Set the 4-momentum associated to the particle.
Definition Particle.h:138
ParticleProperties phys_prop_
Collection of standard, bare-level physical properties.
Definition Particle.h:166
@ 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:163
Particle & operator=(const Particle &)=default
Assignment operator.
Status status() const
Particle status Set the particle decay/stability status.
Definition Particle.h:95
pdgid_t pdg_id_
PDG id.
Definition Particle.h:165
Particle & setId(int id)
Definition Particle.h:79
Role role() const
Role in the considered process Set the particle role in the process.
Definition Particle.h:89
Particle & setStatus(Status status)
Definition Particle.h:97
Particle & setPdgId(pdgid_t pdg, short ch=0)
Set the PDG identifier (along with the particle's electric charge)
Definition Particle.cpp:120
ParticlesIds daughters_
List of daughter particles.
Definition Particle.h:164
Map between a particle's role and its associated Particle object.
Definition Particle.h:177
ParticlesMap & operator=(const ParticlesMap &)
Definition Particle.cpp:215
Common namespace for this Monte Carlo generator.
std::vector< Particle::Role > ParticleRoles
List of particles' roles.
Definition Particle.h:174
std::reference_wrapper< Particle > ParticleRef
Reference to a Particle object.
Definition Particle.h:171
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:173
std::vector< Particle > Particles
List of Particle objects.
Definition Particle.h:172
A collection of physics constants associated to a single particle.