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_.
 
LHEParticlegetMotherParticle (int) const
 Get a mother particle by index_.
 
void print () const
 Print particle information to an output stream.
 

Private Attributes

LHEParticlemothers_ [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 32 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 6 of file LHEParticle.cxx.

6 {
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}
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 46 of file LHEParticle.cxx.

46{ 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 50 of file LHEParticle.cxx.

50{ 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 48 of file LHEParticle.cxx.

48{ 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 44 of file LHEParticle.cxx.

44{ 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 58 of file LHEParticle.cxx.

58{ return mothers_[i]; }

References mothers_.

◆ getPdgId()

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

Get the PDG code (IDUP).

Returns
The PDG code.

Definition at line 40 of file LHEParticle.cxx.

40{ 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 52 of file LHEParticle.cxx.

52{ 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 42 of file LHEParticle.cxx.

42{ return status_; }

References status_.

Referenced by print().

◆ print()

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

Print particle information to an output stream.

Definition at line 60 of file LHEParticle.cxx.

60 {
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}
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 54 of file LHEParticle.cxx.

54 {
55 mothers_[i] = mother;
56}

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 133 of file LHEParticle.h.

Referenced by getColor(), and LHEParticle().

◆ lifetime_

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

The proper time.

Definition at line 143 of file LHEParticle.h.

Referenced by getLifetime(), and LHEParticle().

◆ momentum_

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

The momentum components.

Definition at line 138 of file LHEParticle.h.

Referenced by getMomentum(), and LHEParticle().

◆ mother_

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

The mother particle indices.

Definition at line 128 of file LHEParticle.h.

Referenced by getMother(), and LHEParticle().

◆ mothers_

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

The mother particles.

Definition at line 113 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 118 of file LHEParticle.h.

Referenced by getPdgId(), and LHEParticle().

◆ spin_

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

The particle's spin.

Definition at line 148 of file LHEParticle.h.

Referenced by getSpin(), and LHEParticle().

◆ status_

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

The status code.

Definition at line 123 of file LHEParticle.h.

Referenced by getStatus(), and LHEParticle().


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