LDMX Software
simcore::lhe::LHEParticle Class Reference

Single particle record in an LHE event. More...

#include <LHEParticle.h>

Public Member Functions

 LHEParticle (std::string &data)
 Class constructor.
 
int getPdgId () const
 Get the PDG code (IDUP).
 
int getStatus () const
 Get the status code (ISTUP).
 
int getMother (int) const
 Get a mother particle index (MOTHUP) by index_.
 
int getColor (int) const
 Get the particle color (ICOLUP) by index_.
 
double getMomentum (int) const
 Get a momentum component (PUP) by index_.
 
double getLifetime () const
 Get the proper lifetime (VTIMUP).
 
double getSpin () const
 Get the particle's spin (SPINUP).
 
void setMother (int i, LHEParticle *particle)
 Set a mother particle by index_.
 
LHEParticle * getMotherParticle (int) const
 Get a mother particle by index_.
 
void print () const
 Print particle information to an output stream.
 

Private Attributes

LHEParticle * mothers_ [2]
 The mother particles.
 
int pdg_id_
 The PDG code.
 
int status_
 The status code.
 
int mother_ [2]
 The mother particle indices.
 
int color_ [2]
 The particle color.
 
double momentum_ [5]
 The momentum components.
 
double lifetime_
 The proper time.
 
int spin_
 The particle's spin.
 

Friends

std::ostream & operator<< (std::ostream &stream, const LHEParticle &particle)
 Overloaded stream operator.
 

Detailed Description

Single particle record in an LHE event.

Definition at line 28 of file LHEParticle.h.

Constructor & Destructor Documentation

◆ LHEParticle()

simcore::lhe::LHEParticle::LHEParticle ( std::string & data)

Class constructor.

Parameters
dataThe particle record as a space-delimited string.

Definition at line 11 of file LHEParticle.cxx.

11 {
12 std::istringstream iss(line);
13 std::vector<std::string> tokens;
14 do {
15 std::string elem;
16 iss >> elem;
17 if (elem.size() != 0) {
18 tokens.push_back(elem);
19 }
20 } while (iss);
21
22 if (tokens.size() != 13) {
23 EXCEPTION_RAISE("TokenNum",
24 "Wrong number of tokens in LHE particle record.");
25 }
26
27 pdg_id_ = atof(tokens[0].c_str());
28 status_ = atoi(tokens[1].c_str());
29 mother_[0] = atoi(tokens[2].c_str());
30 mother_[1] = atoi(tokens[3].c_str());
31 color_[0] = atoi(tokens[4].c_str());
32 color_[1] = atoi(tokens[5].c_str());
33 momentum_[0] = atof(tokens[6].c_str());
34 momentum_[1] = atof(tokens[7].c_str());
35 momentum_[2] = atof(tokens[8].c_str());
36 momentum_[3] = atof(tokens[9].c_str());
37 momentum_[4] = atof(tokens[10].c_str());
38 lifetime_ = atof(tokens[11].c_str());
39 spin_ = atof(tokens[12].c_str());
40
41 mothers_[0] = nullptr;
42 mothers_[1] = nullptr;
43}
double lifetime_
The proper time.
int spin_
The particle's spin.
int color_[2]
The particle color.
LHEParticle * mothers_[2]
The mother particles.
double momentum_[5]
The momentum components.
int pdg_id_
The PDG code.
int status_
The status code.
int mother_[2]
The mother particle indices.

References color_, lifetime_, momentum_, mother_, mothers_, pdg_id_, spin_, and status_.

Member Function Documentation

◆ getColor()

int simcore::lhe::LHEParticle::getColor ( int i) const

Get the particle color (ICOLUP) by index_.

Returns
The particle color by index_.

Definition at line 51 of file LHEParticle.cxx.

51{ return color_[i]; }

References color_.

Referenced by print().

◆ getLifetime()

double simcore::lhe::LHEParticle::getLifetime ( ) const

Get the proper lifetime (VTIMUP).

Returns
The particle's proper lifetime.

Definition at line 55 of file LHEParticle.cxx.

55{ return lifetime_; }

References lifetime_.

Referenced by print().

◆ getMomentum()

double simcore::lhe::LHEParticle::getMomentum ( int i) const

Get a momentum component (PUP) by index_.

Defined in order: E/C, Px, Py, Pz, mass

Returns
The momentum component by index_.

Definition at line 53 of file LHEParticle.cxx.

53{ return momentum_[i]; }

References momentum_.

Referenced by print().

◆ getMother()

int simcore::lhe::LHEParticle::getMother ( int i) const

Get a mother particle index (MOTHUP) by index_.

Returns
The mother particle by index_.

Definition at line 49 of file LHEParticle.cxx.

49{ return mother_[i]; }

References mother_.

Referenced by print().

◆ getMotherParticle()

LHEParticle * simcore::lhe::LHEParticle::getMotherParticle ( int i) const

Get a mother particle by index_.

Returns
The mother particle at the index_.

Definition at line 63 of file LHEParticle.cxx.

63{ return mothers_[i]; }

References mothers_.

◆ getPdgId()

int simcore::lhe::LHEParticle::getPdgId ( ) const

Get the PDG code (IDUP).

Returns
The PDG code.

Definition at line 45 of file LHEParticle.cxx.

45{ return pdg_id_; }

References pdg_id_.

Referenced by print().

◆ getSpin()

double simcore::lhe::LHEParticle::getSpin ( ) const

Get the particle's spin (SPINUP).

Returns
The particle's spin.

Definition at line 57 of file LHEParticle.cxx.

57{ return spin_; }

References spin_.

Referenced by print().

◆ getStatus()

int simcore::lhe::LHEParticle::getStatus ( ) const

Get the status code (ISTUP).

Returns
The status code.

Definition at line 47 of file LHEParticle.cxx.

47{ return status_; }

References status_.

Referenced by print().

◆ print()

void simcore::lhe::LHEParticle::print ( ) const

Print particle information to an output stream.

Definition at line 65 of file LHEParticle.cxx.

65 {
66 std::cout << "LHEParticle { " << "PDG ID: " << getPdgId()
67 << ", Status: " << getStatus() << ", Mother[0]: " << getMother(0)
68 << ", Mother[1]: " << getMother(1) << ", Color[0]: " << getColor(0)
69 << ", Color[1]: " << getColor(1)
70 << ", Momentum[0]: " << getMomentum(0)
71 << ", Momentum[1]: " << getMomentum(1)
72 << ", Momentum[2]: " << getMomentum(2)
73 << ", Momentum[3]: " << getMomentum(3)
74 << ", Momentum[4]: " << getMomentum(4)
75 << ", Time: " << getLifetime() << ", Spin: " << getSpin() << " }"
76 << std::endl;
77}
int getColor(int) const
Get the particle color (ICOLUP) by index_.
int getMother(int) const
Get a mother particle index (MOTHUP) by index_.
double getSpin() const
Get the particle's spin (SPINUP).
double getLifetime() const
Get the proper lifetime (VTIMUP).
double getMomentum(int) const
Get a momentum component (PUP) by index_.
int getPdgId() const
Get the PDG code (IDUP).
int getStatus() const
Get the status code (ISTUP).

References getColor(), getLifetime(), getMomentum(), getMother(), getPdgId(), getSpin(), and getStatus().

◆ setMother()

void simcore::lhe::LHEParticle::setMother ( int i,
LHEParticle * particle )

Set a mother particle by index_.

Parameters
iThe mother index_.
particleThe mother particle.

Definition at line 59 of file LHEParticle.cxx.

59 {
60 mothers_[i] = mother;
61}

References mothers_.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const LHEParticle & particle )
friend

Overloaded stream operator.

Parameters
streamThe output stream.
particleThe particle to print.

Member Data Documentation

◆ color_

int simcore::lhe::LHEParticle::color_[2]
private

The particle color.

Definition at line 129 of file LHEParticle.h.

Referenced by getColor(), and LHEParticle().

◆ lifetime_

double simcore::lhe::LHEParticle::lifetime_
private

The proper time.

Definition at line 139 of file LHEParticle.h.

Referenced by getLifetime(), and LHEParticle().

◆ momentum_

double simcore::lhe::LHEParticle::momentum_[5]
private

The momentum components.

Definition at line 134 of file LHEParticle.h.

Referenced by getMomentum(), and LHEParticle().

◆ mother_

int simcore::lhe::LHEParticle::mother_[2]
private

The mother particle indices.

Definition at line 124 of file LHEParticle.h.

Referenced by getMother(), and LHEParticle().

◆ mothers_

LHEParticle* simcore::lhe::LHEParticle::mothers_[2]
private

The mother particles.

Definition at line 109 of file LHEParticle.h.

Referenced by getMotherParticle(), LHEParticle(), and setMother().

◆ pdg_id_

int simcore::lhe::LHEParticle::pdg_id_
private

The PDG code.

Definition at line 114 of file LHEParticle.h.

Referenced by getPdgId(), and LHEParticle().

◆ spin_

int simcore::lhe::LHEParticle::spin_
private

The particle's spin.

Definition at line 144 of file LHEParticle.h.

Referenced by getSpin(), and LHEParticle().

◆ status_

int simcore::lhe::LHEParticle::status_
private

The status code.

Definition at line 119 of file LHEParticle.h.

Referenced by getStatus(), and LHEParticle().


The documentation for this class was generated from the following files: