-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathParticle.h
More file actions
93 lines (81 loc) · 2.63 KB
/
Particle.h
File metadata and controls
93 lines (81 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// cHNLdecay -- calculate decay widths of Heavy Neutral Leptons
// Copyright (C) 2018 - Fabian A.J. Thiele, <fabian.thiele@posteo.de>
//
// This file is part of cHNLdecay.
//
// cHNLdecay is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// cHNLdecay is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef PARTICLE_H
#define PARTICLE_H
#include "TString.h"
#include <map>
class Particle {
public:
Particle() {
pdgid = 0;
name = pdgIdToLaTeX(0);
mass = 0;
}
Particle(Int_t p, Double_t m) {
pdgid = p;
name = pdgIdToLaTeX(p);
mass = m;
}
Particle(const Particle &obj) {
pdgid = obj.getPdgId();
name = obj.getName();
mass = obj.getMass();
}
Double_t getMass() const { return mass; }
TString getName() const { return name; }
Int_t getPdgId() const { return pdgid; }
bool operator==(const Particle &a) const {
return pdgid == a.getPdgId(); // true if they have the same pdg IDs
}
Particle &operator=(const Particle &obj) {
pdgid = obj.getPdgId();
name = obj.getName();
mass = obj.getMass();
return *this;
}
protected:
TString pdgIdToLaTeX(Int_t p) const {
std::map<Int_t, TString> label = {
{1, "d"}, {2, "u"}, {3, "s"}, {4, "c"}, {5, "b"}, {6, "t"},
{11, "e^-"}, {12, "\\nu_e"}, {13, "\\mu^-"},
{14, "\\nu_\\mu"}, {15, "\\tau^-"}, {16, "\\nu_\\tau"},
{211, "\\pi^+"}, {321, "K^+"}, {411, "D^+"},
{431, "D_s^+"}, {521, "B^+"}, {541, "B_c^+"},
{111, "\\pi^0"}, {221, "\\eta"}, {331, "\\eta'"},
{441, "\\eta_c"}, {213, "\\rho^+"}, {413, "D^{\\ast+}"},
{431, "D^{\\ast+}_s"}, {113, "\\rho^0"}, {223, "\\omega"},
{333, "\\phi"}, {443, "J/\\Psi"}};
if (p > 0)
return label.at(p);
else if (p < 0) {
TString ret = label.at(-p);
if (ret.Contains("+"))
ret.ReplaceAll("+", "-");
else if (ret.Contains("-"))
ret.ReplaceAll("-", "+");
else
ret = TString("\\bar{" + ret + "}");
return ret;
}
return TString("");
}
Int_t pdgid;
TString name;
Double_t mass;
};
#endif