cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Event.cpp
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
#include <algorithm>
20
#include <cmath>
21
22
#include "
CepGen/Core/Exception.h
"
23
#include "
CepGen/Event/Event.h
"
24
#include "
CepGen/Physics/HeavyIon.h
"
25
#include "
CepGen/Physics/PDG.h
"
26
#include "
CepGen/Utils/String.h
"
27
28
namespace
cepgen
{
29
Event::Event
(
bool
compressed) : compressed_(compressed) {}
30
31
Event::Event
(
const
Event
& oth) { *
this
= oth; }
32
33
Event
&
Event::operator=
(
const
Event
& oth) {
34
clear
();
35
particles_ = oth.particles_;
36
evtcontent_ = oth.evtcontent_;
37
compressed_ = oth.compressed_;
38
metadata
= oth.
metadata
;
39
return
*
this
;
40
}
41
42
bool
Event::operator==
(
const
Event
& oth)
const
{
43
if
(compressed_ != oth.compressed_)
44
return
false
;
45
if
(
metadata
!= oth.
metadata
)
46
CG_WARNING
(
"Event:operator=="
) <<
"Comparison of two events with different metadata."
;
47
if
(particles_ != oth.particles_)
48
return
false
;
49
return
true
;
50
}
51
52
Event
Event::minimal
(
size_t
num_out_particles) {
53
auto
evt =
Event
();
54
// add the two incoming beam particles
55
auto
ib1 = evt.addParticle(
Particle::Role::IncomingBeam1
);
56
ib1.get().setStatus(
Particle::Status::PrimordialIncoming
);
57
auto
ib2 = evt.addParticle(
Particle::Role::IncomingBeam2
);
58
ib2.get().setStatus(
Particle::Status::PrimordialIncoming
);
59
60
// add the two incoming partons
61
auto
part1 = evt.addParticle(
Particle::Role::Parton1
);
62
part1.get().setStatus(
Particle::Status::Incoming
);
63
part1.get().addMother(ib1);
64
auto
part2 = evt.addParticle(
Particle::Role::Parton2
);
65
part2.get().setStatus(
Particle::Status::Incoming
);
66
part2.get().addMother(ib2);
67
// add the two-parton system
68
auto
twopart = evt.addParticle(
Particle::Role::Intermediate
);
69
twopart.get().setStatus(
Particle::Status::Propagator
);
70
twopart.get().addMother(part1);
71
twopart.get().addMother(part2);
72
73
// add the two outgoing beam particles
74
auto
ob1 = evt.addParticle(
Particle::Role::OutgoingBeam1
);
75
ob1.get().setStatus(
Particle::Status::FinalState
);
76
ob1.get().addMother(ib1);
77
auto
ob2 = evt.addParticle(
Particle::Role::OutgoingBeam2
);
78
ob2.get().setStatus(
Particle::Status::FinalState
);
79
ob2.get().addMother(ib2);
80
81
// finally add the central system
82
for
(
size_t
i = 0; i < num_out_particles; ++i) {
83
auto
cs = evt.addParticle(
Particle::Role::CentralSystem
);
84
cs.get().setStatus(
Particle::Status::FinalState
);
85
cs.get().addMother(twopart);
86
}
87
return
evt;
88
}
89
90
void
Event::clear
() {
91
particles_.clear();
92
metadata
.clear();
93
}
94
95
void
Event::freeze
() {
96
if
(particles_.count(
Particle::CentralSystem
) > 0)
97
evtcontent_.cs = particles_[
Particle::CentralSystem
].size();
98
if
(particles_.count(
Particle::OutgoingBeam1
) > 0)
99
evtcontent_.op1 = particles_[
Particle::OutgoingBeam1
].size();
100
if
(particles_.count(
Particle::OutgoingBeam2
) > 0)
101
evtcontent_.op2 = particles_[
Particle::OutgoingBeam2
].size();
102
}
103
104
void
Event::restore
() {
105
if
(particles_.count(
Particle::CentralSystem
) > 0)
106
particles_[
Particle::CentralSystem
].resize(evtcontent_.cs);
107
if
(particles_.count(
Particle::OutgoingBeam1
) > 0)
108
particles_[
Particle::OutgoingBeam1
].resize(evtcontent_.op1);
109
if
(particles_.count(
Particle::OutgoingBeam2
) > 0)
110
particles_[
Particle::OutgoingBeam2
].resize(evtcontent_.op2);
111
}
112
113
bool
Event::compressed
()
const
{
return
compressed_; }
114
115
Event
Event::compress
()
const
{
116
if
(compressed_)
117
return
*
this
;
118
Event
out(
/*compressed=*/
true
);
119
int
i = 0;
120
//--- add all necessary particles
121
for
(
const
auto
& role : {
Particle::IncomingBeam1
,
122
Particle::IncomingBeam2
,
123
Particle::OutgoingBeam1
,
124
Particle::OutgoingBeam2
,
125
Particle::Parton1
,
126
Particle::Parton2
,
127
Particle::CentralSystem
}) {
128
if
(particles_.count(role) == 0)
129
continue
;
130
for
(
const
auto
& old_part :
operator()
(role)) {
131
auto
& new_part = out.
addParticle
(role).get();
132
new_part = old_part;
// copy all attributes
133
new_part.setId(i++);
134
new_part.mothers().clear();
135
}
136
}
137
//--- fix parentage for outgoing beam particles
138
if
(out[
Particle::OutgoingBeam1
].
size
() > 1 || out[
Particle::OutgoingBeam2
].
size
() > 1)
139
CG_WARNING
(
"Event:compress"
) <<
"Event compression not designed for already fragmented beam remnants!\n\t"
140
<<
"Particles parentage is not guaranteed to be conserved."
;
141
if
(particles_.count(
Particle::OutgoingBeam1
) > 0)
142
for
(
auto
& part : out[
Particle::OutgoingBeam1
])
143
part.get().addMother(out[
Particle::IncomingBeam1
][0].get());
144
if
(particles_.count(
Particle::OutgoingBeam2
) > 0)
145
for
(
auto
& part : out[
Particle::OutgoingBeam2
])
146
part.get().addMother(out[
Particle::IncomingBeam2
][0].get());
147
//--- fix parentage for incoming partons
148
for
(
auto
& part : out[
Particle::Parton1
])
149
if
(particles_.count(
Particle::IncomingBeam1
) > 0)
150
part.get().addMother(out[
Particle::IncomingBeam1
][0].get());
151
if
(particles_.count(
Particle::IncomingBeam2
) > 0)
152
for
(
auto
& part : out[
Particle::Parton2
])
153
part.get().addMother(out[
Particle::IncomingBeam2
][0].get());
154
//--- fix parentage for central system
155
if
(particles_.count(
Particle::Parton1
) > 0 && particles_.count(
Particle::Parton2
) > 0)
156
for
(
auto
& part : out[
Particle::CentralSystem
]) {
157
part.get().addMother(out[
Particle::Parton1
][0]);
158
part.get().addMother(out[
Particle::Parton2
][0]);
159
}
160
return
out;
161
}
162
163
ParticlesRefs
Event::operator[]
(
Particle::Role
role) {
164
ParticlesRefs
out;
165
//--- retrieve all particles with a given role
166
for
(
auto
& part : particles_[role])
167
out.emplace_back(std::ref(part));
168
return
out;
169
}
170
171
const
Particles
&
Event::operator()
(
Particle::Role
role)
const
{
172
if
(particles_.count(role) == 0)
173
throw
CG_FATAL
(
"Event"
) <<
"Failed to retrieve a particle with "
<< role <<
" role."
;
174
//--- retrieve all particles with a given role
175
return
particles_.at(role);
176
}
177
178
ParticlesIds
Event::ids
(
Particle::Role
role)
const
{
179
ParticlesIds
out;
180
//--- retrieve all particles ids with a given role
181
if
(particles_.count(role) == 0)
182
return
out;
183
184
for
(
const
auto
& part : particles_.at(role))
185
out.insert(part.id());
186
187
return
out;
188
}
189
190
Particle
&
Event::oneWithRole
(
Particle::Role
role) {
191
//--- retrieve the first particle of a given role
192
auto
parts_by_role =
operator[]
(role);
193
if
(parts_by_role.empty())
194
throw
CG_FATAL
(
"Event"
) <<
"No particle retrieved with "
<< role <<
" role."
;
195
if
(parts_by_role.size() > 1)
196
throw
CG_FATAL
(
"Event"
) <<
"More than one particle with "
<< role <<
" role: "
<< parts_by_role.size()
197
<<
" particles."
;
198
return
parts_by_role.front().get();
199
}
200
201
const
Particle
&
Event::oneWithRole
(
Particle::Role
role)
const
{
202
//--- retrieve the first particle of a given role
203
const
Particles
& parts_by_role =
operator()
(role);
204
if
(parts_by_role.empty())
205
throw
CG_FATAL
(
"Event"
) <<
"No particle retrieved with "
<< role <<
" role."
;
206
if
(parts_by_role.size() > 1)
207
throw
CG_FATAL
(
"Event"
) <<
"More than one particle with "
<< role <<
" role: "
<< parts_by_role.size()
208
<<
" particles"
;
209
return
*parts_by_role.begin();
210
}
211
212
Particle
&
Event::operator[]
(
int
id
) {
213
for
(
auto
& role_part : particles_)
214
for
(
auto
& part : role_part.second)
215
if
(part.id() == id)
216
return
part;
217
218
throw
CG_FATAL
(
"Event"
) <<
"Failed to retrieve the particle with id="
<<
id
<<
"."
;
219
}
220
221
const
Particle
&
Event::operator()
(
int
id
)
const
{
222
for
(
const
auto
& role_part : particles_) {
223
auto
it = std::find_if(
224
role_part.second.begin(), role_part.second.end(), [&
id
](
const
auto
& part) { return part.id() == id; });
225
if
(it != role_part.second.end())
226
return
*it;
227
}
228
229
throw
CG_FATAL
(
"Event"
) <<
"Failed to retrieve the particle with id="
<<
id
<<
"."
;
230
}
231
232
ParticlesRefs
Event::operator[]
(
const
ParticlesIds
& ids) {
233
ParticlesRefs
out;
234
std::transform(
ids
.begin(),
ids
.end(), std::back_inserter(out), [
this
](
const
auto
&
id
) {
235
return std::ref(this->operator[](id));
236
});
237
return
out;
238
}
239
240
Particles
Event::operator()
(
const
ParticlesIds
& ids)
const
{
241
Particles
out;
242
std::transform(
243
ids
.begin(),
ids
.end(), std::back_inserter(out), [
this
](
const
auto
&
id
) { return this->operator()(id); });
244
return
out;
245
}
246
247
Particles
Event::mothers
(
const
Particle
& part)
const
{
return
operator()
(part.
mothers
()); }
248
249
ParticlesRefs
Event::mothers
(
const
Particle
& part) {
return
operator[]
(part.
mothers
()); }
250
251
void
Event::clearMothers
(
Particle
& part) {
252
for
(
const
auto
& mid : part.
mothers
())
253
operator
[](mid).daughters().erase(part.
id
());
254
part.
mothers
().clear();
255
}
256
257
Particles
Event::daughters
(
const
Particle
& part)
const
{
return
operator()
(part.
daughters
()); }
258
259
ParticlesRefs
Event::daughters
(
const
Particle
& part) {
return
operator[]
(part.
daughters
()); }
260
261
Particles
Event::stableDaughters
(
const
Particle
& part,
bool
recursive)
const
{
262
Particles
parts;
263
for
(
const
auto
& daugh :
operator()
(part.
daughters
())) {
264
if
(daugh.status() ==
Particle::Status::FinalState
)
265
parts.emplace_back(daugh);
266
else
if
(recursive) {
267
const
auto
daugh_daugh =
stableDaughters
(daugh, recursive);
268
parts.insert(
269
parts.end(), std::make_move_iterator(daugh_daugh.begin()), std::make_move_iterator(daugh_daugh.end()));
270
}
271
}
272
std::sort(parts.begin(), parts.end());
273
parts.erase(std::unique(parts.begin(), parts.end()), parts.end());
274
return
parts;
275
}
276
277
ParticlesRefs
Event::stableDaughters
(
const
Particle
& part,
bool
recursive) {
278
ParticlesRefs
parts;
279
for
(
const
auto
& daugh :
operator[]
(part.
daughters
())) {
280
if
(daugh.get().status() ==
Particle::Status::FinalState
)
281
parts.emplace_back(daugh);
282
else
if
(recursive) {
283
const
auto
daugh_daugh =
stableDaughters
(daugh, recursive);
284
parts.insert(
285
parts.end(), std::make_move_iterator(daugh_daugh.begin()), std::make_move_iterator(daugh_daugh.end()));
286
}
287
}
288
std::sort(
289
parts.begin(), parts.end(), [](
const
auto
& lhs,
const
auto
& rhs) { return lhs.get().id() < rhs.get().id(); });
290
parts.erase(
291
std::unique(
292
parts.begin(), parts.end(), [](
const
auto
& lhs,
const
auto
& rhs) { return lhs.get() == rhs.get(); }),
293
parts.end());
294
return
parts;
295
}
296
297
void
Event::clearDaughters
(
Particle
& part) {
298
for
(
const
auto
& did : part.
daughters
())
299
operator
[](did).mothers().erase(part.
id
());
300
part.
daughters
().clear();
301
}
302
303
ParticleRoles
Event::roles
()
const
{
304
ParticleRoles
out;
305
std::transform(
306
particles_.begin(), particles_.end(), std::back_inserter(out), [](
const
auto
& pr) { return pr.first; });
307
return
out;
308
}
309
310
void
Event::updateRoles
() {
311
for
(
auto
& parts_vs_role : particles_)
// 1st loop to copy particles to correct role container
312
for
(
const
auto
& part : parts_vs_role.second)
313
if
(part.role() != parts_vs_role.first)
314
particles_[part.role()].emplace_back(part);
315
for
(
auto
& parts_vs_role : particles_)
// 2nd loop to remove wrongly-assigned particles
316
parts_vs_role.second.erase(
317
std::remove_if(parts_vs_role.second.begin(),
318
parts_vs_role.second.end(),
319
[&parts_vs_role](
const
auto
& part) { return part.role() != parts_vs_role.first; }),
320
parts_vs_role.second.end());
321
}
322
323
ParticleRef
Event::addParticle
(
Particle
& part,
bool
replace) {
324
CG_DEBUG_LOOP
(
"Event"
) <<
"Particle with PDGid = "
<< part.
integerPdgId
() <<
" has role "
<< part.
role
();
325
if
(part.
role
() <= 0)
326
throw
CG_FATAL
(
"Event"
) <<
"Trying to add a particle with role="
<< (int)part.
role
() <<
"."
;
327
328
auto
& part_with_same_role = particles_[part.
role
()];
// list of particles with the same role
329
if
(part.
id
() < 0)
330
part.
setId
(part_with_same_role.empty() || !replace
331
?
size
()
// set the id if previously invalid/non-existent
332
: part_with_same_role[0].id());
// set the previous id if replacing a particle
333
if
(replace)
334
part_with_same_role = {part};
335
else
336
part_with_same_role.emplace_back(part);
337
return
std::ref(part_with_same_role.back());
338
}
339
340
ParticleRef
Event::addParticle
(
Particle::Role
role,
bool
replace) {
341
Particle
np(role,
PDG::invalid
);
342
return
addParticle
(np, replace);
343
}
344
345
size_t
Event::size
()
const
{
346
return
std::accumulate(particles_.begin(), particles_.end(), 0, [](
size_t
size
,
const
auto
& role_part) {
347
return size + role_part.second.size();
348
});
349
}
350
351
bool
Event::empty
()
const
{
return
particles_.empty(); }
352
353
Particles
Event::particles
()
const
{
354
Particles
out;
355
for
(
const
auto
& role_part : particles_)
356
out.insert(out.end(), role_part.second.begin(), role_part.second.end());
357
358
std::sort(out.begin(), out.end());
359
return
out;
360
}
361
362
Particles
Event::stableParticles
()
const
{
363
Particles
out;
364
for
(
const
auto
& role_part : particles_)
365
std::copy_if(role_part.second.begin(), role_part.second.end(), std::back_inserter(out), [](
const
auto
& part) {
366
return
(
short
)part.status() > 0;
367
});
368
369
std::sort(out.begin(), out.end());
370
return
out;
371
}
372
373
Particles
Event::stableParticlesWithRole
(
Particle::Role
role)
const
{
374
Particles
out;
375
const
auto
& parts_role = particles_.at(role);
376
std::copy_if(parts_role.begin(), parts_role.end(), std::back_inserter(out), [](
const
auto
& part) {
377
return (short)part.status() > 0;
378
});
379
std::sort(out.begin(), out.end());
380
out.erase(std::unique(out.begin(), out.end()), out.end());
381
return
out;
382
}
383
384
Momentum
Event::missingMomentum
()
const
{
385
Momentum
me;
386
for
(
const
auto
& cp :
operator()
(
Particle::Role::CentralSystem
))
387
if
(cp.status() ==
Particle::Status::FinalState
) {
388
const
auto
pdg
= cp.integerPdgId();
389
if
(
pdg
== 12 ||
pdg
== 14 ||
pdg
== 16)
// neutrinos
390
me += cp.momentum();
391
if
(
pdg
== 1000022 ||
pdg
== 1000023 ||
pdg
== 1000025 ||
pdg
== 1000035)
// neutralinos
392
me += cp.momentum();
393
}
394
return
me;
395
}
396
397
void
Event::checkKinematics()
const
{
398
// check the kinematics through parentage
399
for
(
const
auto
& part :
particles
()) {
400
ParticlesIds
daughters
= part.daughters();
401
if
(
daughters
.empty())
402
continue
;
403
Momentum
ptot;
404
for
(
const
auto
& daughter :
daughters
) {
405
const
auto
& d =
operator()
(daughter);
406
const
auto
mothers
= d.mothers();
407
ptot += d.momentum();
408
if
(
mothers
.size() < 2)
409
continue
;
410
for
(
const
auto
& moth :
mothers
)
411
if (moth != part.id())
412
ptot -= operator()(moth).momentum();
413
}
414
const
double
mass_diff = (ptot - part.momentum()).mass();
415
if
(fabs(mass_diff) > MIN_PRECISION) {
416
dump
();
417
throw
CG_FATAL
(
"Event"
) <<
"Error in momentum balance for particle "
<< part.id() <<
": mdiff = "
<< mass_diff
418
<<
"."
;
419
}
420
}
421
}
422
423
void
Event::dump
()
const
{
CG_INFO
(
"Event"
) << *
this
; }
424
425
double
Event::cmEnergy
()
const
{
426
return
(
oneWithRole
(
Particle::Role::IncomingBeam1
).momentum() +
427
oneWithRole
(
Particle::Role::IncomingBeam2
).momentum())
428
.mass();
429
}
430
431
std::ostream&
operator<<
(std::ostream& out,
const
Event
& ev) {
432
const
auto
parts = ev.
particles
();
433
std::ostringstream os;
434
435
Momentum
p_total;
436
for
(
const
auto
& part : parts) {
437
const
ParticlesIds
mothers = part.mothers();
438
{
439
std::ostringstream oss_pdg;
440
if
(part.pdgId() ==
PDG::invalid
&& !mothers.empty()) {
441
//--- if particles compound
442
std::string delim;
443
for
(
size_t
i = 0; i < mothers.size(); ++i)
444
try
{
445
oss_pdg << delim << (
PDG::Id
)ev(*std::next(mothers.begin(), i)).pdgId(), delim =
"/"
;
446
}
catch
(
const
Exception
&) {
447
oss_pdg << delim << ev(*std::next(mothers.begin(), i)).pdgId(), delim =
"/"
;
448
}
449
os <<
utils::format
(
"\n %2d\t\t %-7s"
, part.id(), oss_pdg.str().c_str());
450
}
else
{
451
//--- if single particle/HI
452
if
(
HeavyIon::isHI
(part.pdgId()))
453
oss_pdg <<
HeavyIon::fromPdgId
(part.pdgId());
454
else
455
try
{
456
oss_pdg << (
PDG::Id
)part.pdgId();
457
}
catch
(
const
Exception
&) {
458
oss_pdg <<
"?"
;
459
}
460
os <<
utils::format
(
"\n %2d\t%-+10d %-7s"
, part.id(), part.integerPdgId(), oss_pdg.str().c_str());
461
}
462
}
463
os <<
"\t"
;
464
if
(part.charge() != (
int
)part.charge()) {
465
if
(part.charge() * 2 == (
int
)(part.charge() * 2))
466
os <<
utils::format
(
"%-d/2"
, (
int
)(part.charge() * 2));
467
else
if
(part.charge() * 3 == (
int
)(part.charge() * 3))
468
os <<
utils::format
(
"%-d/3"
, (
int
)(part.charge() * 3));
469
else
470
os <<
utils::format
(
"%-.2f"
, part.charge());
471
}
else
472
os <<
utils::format
(
"%-g"
, part.charge());
473
os <<
"\t"
;
474
{
475
std::ostringstream oss;
476
oss << part.role();
477
os <<
utils::format
(
"%-8s %6d\t"
, oss.str().c_str(), part.status());
478
}
479
if
(!mothers.empty()) {
480
std::ostringstream oss;
481
unsigned
short
i = 0;
482
for
(
const
auto
& moth : mothers) {
483
oss << (i > 0 ?
"+"
:
""
) << moth;
484
++i;
485
}
486
os <<
utils::format
(
"%6s "
, oss.str().c_str());
487
}
else
488
os <<
" "
;
489
const
auto
& mom = part.momentum();
490
os <<
utils::format
(
491
"% 9.6e % 9.6e % 9.6e % 9.6e % 12.5f"
, mom.px(), mom.py(), mom.pz(), mom.energy(), mom.mass());
492
493
// discard non-primary, decayed particles
494
if
(part.status() >=
Particle::Status::Undefined
) {
495
const
int
sign = (part.status() ==
Particle::Status::Undefined
) ? -1 : +1;
496
p_total += sign * mom;
497
}
498
}
499
//--- set a threshold to the computation precision
500
p_total.
truncate
();
501
//
502
return
out <<
utils::format
(
503
"Event content:\n"
504
" Id\tPDG id\t Name\t\tCharge\tRole\t Status\tMother\tpx py pz E "
505
" "
506
" \t M \n"
507
" --\t------\t ----\t\t------\t----\t ------\t------\t----GeV/c--- ----GeV/c--- ----GeV/c--- "
508
"----GeV/c---\t --GeV/c²--"
509
"%s\n"
510
" ----------------------------------------------------------------------------------------------------"
511
"--"
512
"----------------------------\n"
513
"\t\t\t\t\t\t\tBalance% 9.6e % 9.6e % 9.6e % 9.6e"
,
514
os.str().c_str(),
515
p_total.
px
(),
516
p_total.
py
(),
517
p_total.
pz
(),
518
p_total.
energy
());
519
}
520
521
Event::EventMetadata::EventMetadata
()
522
: std::unordered_map<std::string, float>{{
"time:generation"
, -1.f},
523
{
"time:total"
, -1.f},
524
{
"weight"
, 1.f},
525
{
"alphaEM"
, (float)
constants::ALPHA_EM
},
526
{
"alphaS"
, (float)
constants::ALPHA_QCD
}} {}
527
}
// namespace cepgen
Event.h
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
HeavyIon.h
CG_WARNING
#define CG_WARNING(mod)
Definition
Message.h:228
CG_DEBUG_LOOP
#define CG_DEBUG_LOOP(mod)
Definition
Message.h:224
CG_INFO
#define CG_INFO(mod)
Definition
Message.h:216
PDG.h
String.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::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::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::Event
Event(bool compressed=false)
Build an empty event.
Definition
Event.cpp:29
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::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::Exception
Definition
Exception.h:25
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::Momentum::pz
double pz() const
Longitudinal momentum (in GeV)
Definition
Momentum.h:120
cepgen::Momentum::px
double px() const
Momentum along the -axis (in GeV)
Definition
Momentum.h:112
cepgen::Momentum::py
double py() const
Momentum along the -axis (in GeV)
Definition
Momentum.h:116
cepgen::Momentum::truncate
Momentum & truncate(double tolerance=1.e-10)
Apply a threshold to all values with a given tolerance.
Definition
Momentum.cpp:197
cepgen::Momentum::energy
double energy() const
Energy (in GeV)
Definition
Momentum.h:136
cepgen::PDG::Id
A class-in-the-middle PDG identifier for printout operations.
Definition
PDG.h:55
cepgen::PDG::invalid
@ invalid
Definition
PDG.h:34
cepgen::Particle
Kinematic information for one particle.
Definition
Particle.h:33
cepgen::Particle::daughters
ParticlesIds daughters() const
Identifiers list of all daughter particles.
Definition
Particle.h:147
cepgen::Particle::integerPdgId
long integerPdgId() const
Retrieve the integer value of the PDG identifier.
Definition
Particle.cpp:102
cepgen::Particle::Status::PrimordialIncoming
@ PrimordialIncoming
Incoming beam particle.
cepgen::Particle::Status::Incoming
@ Incoming
Incoming parton.
cepgen::Particle::Status::FinalState
@ FinalState
Stable, final state particle.
cepgen::Particle::Status::Propagator
@ Propagator
Generic propagator.
cepgen::Particle::Status::Undefined
@ Undefined
Undefined particle.
cepgen::Particle::id
int id() const
Unique identifier (in a Event object context) Set the particle unique identifier in an event.
Definition
Particle.h:76
cepgen::Particle::mothers
ParticlesIds mothers() const
Identifier to the mother particles.
Definition
Particle.h:144
cepgen::Particle::Role
Role
Definition
Particle.h:50
cepgen::Particle::IncomingBeam2
@ IncomingBeam2
incoming beam particle
Definition
Particle.h:53
cepgen::Particle::Parton2
@ Parton2
beam incoming parton
Definition
Particle.h:59
cepgen::Particle::OutgoingBeam1
@ OutgoingBeam1
outgoing beam state/particle
Definition
Particle.h:54
cepgen::Particle::IncomingBeam1
@ IncomingBeam1
incoming beam particle
Definition
Particle.h:52
cepgen::Particle::OutgoingBeam2
@ OutgoingBeam2
outgoing beam state/particle
Definition
Particle.h:55
cepgen::Particle::Parton1
@ Parton1
beam incoming parton
Definition
Particle.h:58
cepgen::Particle::CentralSystem
@ CentralSystem
Central particles system.
Definition
Particle.h:56
cepgen::Particle::Intermediate
@ Intermediate
Intermediate two-parton system.
Definition
Particle.h:57
cepgen::Particle::setId
Particle & setId(int id)
Definition
Particle.h:78
cepgen::Particle::role
Role role() const
Role in the considered process Set the particle role in the process.
Definition
Particle.h:88
cepgen::constants::ALPHA_QCD
constexpr double ALPHA_QCD
Strong coupling constant .
Definition
Constants.h:34
cepgen::constants::ALPHA_EM
constexpr double ALPHA_EM
Electromagnetic coupling constant .
Definition
Constants.h:28
cepgen::utils::format
std::string format(const std::string &fmt, Args... args)
Format a string using a printf style format descriptor.
Definition
String.h:61
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::operator<<
std::ostream & operator<<(std::ostream &os, const Exception::Type &type)
Definition
Exception.cpp:59
cepgen::Particles
std::vector< Particle > Particles
List of Particle objects.
Definition
Particle.h:169
pdg
Definition
MCDFileParser.cpp:28
cepgen::Event::EventMetadata::EventMetadata
EventMetadata()
Definition
Event.cpp:521
cepgen::HeavyIon::fromPdgId
static HeavyIon fromPdgId(pdgid_t)
Build from a custom PDG id.
Definition
HeavyIon.cpp:34
cepgen::HeavyIon::isHI
static bool isHI(const spdgid_t &)
Check if the PDG id is compatible with a HI.
Definition
HeavyIon.cpp:54
CepGen
Event
Event.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7