Version: SMASH-1.8
quantumnumbers.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright (c) 2015-2018
4
* SMASH Team
5
*
6
* GNU General Public License (GPLv3 or later)
7
*
8
*/
9
10
#include "
smash/quantumnumbers.h
"
11
12
#include <sstream>
13
14
#include "
smash/numerics.h
"
15
16
namespace
smash
{
17
18
std::string
QuantumNumbers::report_deviations
(
const
QuantumNumbers
& rhs)
const
{
19
if
(rhs == *
this
) {
20
return
""
;
21
}
22
std::stringstream error_msg;
23
error_msg <<
"Conservation law violations detected (old vs. new)\n"
;
24
if
(
momentum_
!= rhs.
momentum_
) {
25
error_msg <<
"Deviation in Four-Momentum:\n"
<< std::scientific;
26
}
27
/* programmer's note: here, I'd like to simultaneously loop over an
28
* integer (for the output; so that we know which component is
29
* faulty) and both the current and rhs's momentum four-vector. If
30
* there is a better way to do this, feel free to implement.
31
*
32
* I chose mu < 4 as the breaking condition out of the vague feeling
33
* that comparing integers may be faster than accessing the
34
* iterators. */
35
int
mu = 0;
36
for
(
auto
here_iter =
momentum_
.
cbegin
(), rhs_iter = rhs.
momentum_
.
cbegin
();
37
mu < 4; ++here_iter, ++rhs_iter, ++mu) {
38
if
(!
almost_equal_physics
(*here_iter, *rhs_iter)) {
39
error_msg <<
" P_"
<< mu <<
": "
<< *here_iter <<
" vs. "
<< *rhs_iter
40
<<
"; Δ = "
<< (*here_iter - *rhs_iter) <<
"\n"
;
41
}
42
}
43
if
(
charge_
!= rhs.
charge_
) {
44
error_msg <<
"Deviation in Charge:\n "
<<
charge_
<<
" vs. "
<< rhs.
charge_
45
<<
"\n"
;
46
}
47
if
(
isospin3_
!= rhs.
isospin3_
) {
48
error_msg <<
"Deviation in Isospin 3:\n "
<<
isospin3_
<<
" vs. "
49
<< rhs.
isospin3_
<<
"\n"
;
50
}
51
if
(
strangeness_
!= rhs.
strangeness_
) {
52
error_msg <<
"Deviation in Strangeness:\n "
<<
strangeness_
<<
" vs. "
53
<< rhs.
strangeness_
<<
"\n"
;
54
}
55
if
(
charmness_
!= rhs.
charmness_
) {
56
error_msg <<
"Deviation in Charmness:\n "
<<
charmness_
<<
" vs. "
57
<< rhs.
charmness_
<<
"\n"
;
58
}
59
if
(
bottomness_
!= rhs.
bottomness_
) {
60
error_msg <<
"Deviation in Bottomness:\n "
<<
bottomness_
<<
" vs. "
61
<< rhs.
bottomness_
<<
"\n"
;
62
}
63
if
(
baryon_number_
!= rhs.
baryon_number_
) {
64
error_msg <<
"Deviation in Baryon Number:\n "
<<
baryon_number_
<<
" vs. "
65
<< rhs.
baryon_number_
<<
"\n"
;
66
}
67
return
error_msg.str();
68
}
69
70
}
// namespace smash
smash
Definition:
action.h:24
quantumnumbers.h
smash::QuantumNumbers::charmness_
int charmness_
Total charm.
Definition:
quantumnumbers.h:304
smash::QuantumNumbers::bottomness_
int bottomness_
Total bottom.
Definition:
quantumnumbers.h:310
smash::QuantumNumbers::isospin3_
int isospin3_
Total isospin-3.
Definition:
quantumnumbers.h:292
smash::QuantumNumbers::strangeness_
int strangeness_
Total strangeness.
Definition:
quantumnumbers.h:298
smash::QuantumNumbers::charge_
int charge_
Total charge.
Definition:
quantumnumbers.h:286
smash::QuantumNumbers::report_deviations
std::string report_deviations(const Particles &particles) const
Checks if the current particle list has still the same values and reports about differences.
Definition:
quantumnumbers.h:248
smash::almost_equal_physics
bool almost_equal_physics(const N x, const N y)
Same as smash::almost_equal, but for physical checks like energy-momentum conservation small_number i...
Definition:
numerics.h:62
numerics.h
smash::QuantumNumbers::baryon_number_
int baryon_number_
Total baryon number.
Definition:
quantumnumbers.h:316
smash::FourVector::cbegin
const_iterator cbegin() const
Definition:
fourvector.h:292
smash::QuantumNumbers::momentum_
FourVector momentum_
Total momentum four-vector [GeV].
Definition:
quantumnumbers.h:279
smash::QuantumNumbers
Definition:
quantumnumbers.h:53
src
quantumnumbers.cc
Impressum
Data privacy protection
Generated on Tue Apr 7 2020 13:50:12 for SMASH by
Doxygen
1.8.16