LDMX Software
LHEParticle.cxx
2
3namespace simcore {
4namespace lhe {
5
6LHEParticle::LHEParticle(std::string& line) {
7 std::istringstream iss(line);
8 std::vector<std::string> tokens;
9 do {
10 std::string elem;
11 iss >> elem;
12 if (elem.size() != 0) {
13 tokens.push_back(elem);
14 }
15 } while (iss);
16
17 if (tokens.size() != 13) {
18 EXCEPTION_RAISE("TokenNum",
19 "Wrong number of tokens in LHE particle record.");
20 }
21
22 pdg_id_ = atof(tokens[0].c_str());
23 status_ = atoi(tokens[1].c_str());
24 mother_[0] = atoi(tokens[2].c_str());
25 mother_[1] = atoi(tokens[3].c_str());
26 color_[0] = atoi(tokens[4].c_str());
27 color_[1] = atoi(tokens[5].c_str());
28 momentum_[0] = atof(tokens[6].c_str());
29 momentum_[1] = atof(tokens[7].c_str());
30 momentum_[2] = atof(tokens[8].c_str());
31 momentum_[3] = atof(tokens[9].c_str());
32 momentum_[4] = atof(tokens[10].c_str());
33 lifetime_ = atof(tokens[11].c_str());
34 spin_ = atof(tokens[12].c_str());
35
36 mothers_[0] = nullptr;
37 mothers_[1] = nullptr;
38}
39
40int LHEParticle::getPdgId() const { return pdg_id_; }
41
42int LHEParticle::getStatus() const { return status_; }
43
44int LHEParticle::getMother(int i) const { return mother_[i]; }
45
46int LHEParticle::getColor(int i) const { return color_[i]; }
47
48double LHEParticle::getMomentum(int i) const { return momentum_[i]; }
49
50double LHEParticle::getLifetime() const { return lifetime_; }
51
52double LHEParticle::getSpin() const { return spin_; }
53
54void LHEParticle::setMother(int i, LHEParticle* mother) {
55 mothers_[i] = mother;
56}
57
59
60void LHEParticle::print() const {
61 std::cout << "LHEParticle { " << "PDG ID: " << getPdgId()
62 << ", Status: " << getStatus() << ", Mother[0]: " << getMother(0)
63 << ", Mother[1]: " << getMother(1) << ", Color[0]: " << getColor(0)
64 << ", Color[1]: " << getColor(1)
65 << ", Momentum[0]: " << getMomentum(0)
66 << ", Momentum[1]: " << getMomentum(1)
67 << ", Momentum[2]: " << getMomentum(2)
68 << ", Momentum[3]: " << getMomentum(3)
69 << ", Momentum[4]: " << getMomentum(4)
70 << ", Time: " << getLifetime() << ", Spin: " << getSpin() << " }"
71 << std::endl;
72}
73
74} // namespace lhe
75} // namespace simcore
Class defining a single particle record in an LHE event.
Single particle record in an LHE event.
Definition LHEParticle.h:32
double lifetime_
The proper time.
int getColor(int) const
Get the particle color (ICOLUP) by index_.
int spin_
The particle's spin.
int getMother(int) const
Get a mother particle index (MOTHUP) by index_.
double getSpin() const
Get the particle's spin (SPINUP).
LHEParticle(std::string &data)
Class constructor.
void setMother(int i, LHEParticle *particle)
Set a mother particle by index_.
int color_[2]
The particle color.
LHEParticle * mothers_[2]
The mother particles.
void print() const
Print particle information to an output stream.
double momentum_[5]
The momentum components.
double getLifetime() const
Get the proper lifetime (VTIMUP).
LHEParticle * getMotherParticle(int) const
Get a mother particle by index_.
double getMomentum(int) const
Get a momentum component (PUP) by index_.
int getPdgId() const
Get the PDG code (IDUP).
int pdg_id_
The PDG code.
int getStatus() const
Get the status code (ISTUP).
int status_
The status code.
int mother_[2]
The mother particle indices.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...