JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
MELAParticle Class Reference

#include <MELAParticle.h>

Inheritance diagram for MELAParticle:

Public Member Functions

 MELAParticle ()
 
 MELAParticle (int id_)
 
 MELAParticle (int id_, TLorentzVector p4_)
 
 MELAParticle (const MELAParticle &particle_)
 
MELAParticleoperator= (const MELAParticle &particle_)
 
virtual ~MELAParticle ()
 
void swap (MELAParticle &particle_)
 
void setSelected (bool isSelected=true)
 
void setGenStatus (int status_)
 
void setLifetime (double life_)
 
void addMother (MELAParticle *myParticle)
 
void addDaughter (MELAParticle *myParticle)
 
int getNMothers () const
 
int getNDaughters () const
 
virtual std::vector< int > getDaughterIds () const
 
MELAParticlegetMother (int index) const
 
MELAParticlegetDaughter (int index) const
 
virtual void getRelatedParticles (std::vector< MELAParticle * > &particles) const
 
virtual void getDaughterParticles (std::vector< MELAParticle * > &particles) const
 
std::vector< MELAParticle * > & getMothers ()
 
std::vector< MELAParticle * > & getDaughters ()
 
const std::vector< MELAParticle * > & getMothers () const
 
const std::vector< MELAParticle * > & getDaughters () const
 
bool hasMother (MELAParticle const *part) const
 
bool hasDaughter (MELAParticle const *part) const
 
double charge () const
 
double m () const
 
double x () const
 
double y () const
 
double z () const
 
double t () const
 
double p () const
 
double pt () const
 
double eta () const
 
double phi () const
 
double rapidity () const
 
double dot (const TLorentzVector &v) const
 
double dot (const MELAParticle &part) const
 
double dot (const MELAParticle *part) const
 
double euclidean_dot (const TLorentzVector &v) const
 
double euclidean_dot (const MELAParticle &part) const
 
double euclidean_dot (const MELAParticle *part) const
 
double deltaR (const TLorentzVector &v) const
 
double deltaR (const MELAParticle &part) const
 
double deltaR (const MELAParticle *part) const
 
void boost (const TVector3 &vec, bool boostAll=false)
 
TVector3 vect () const
 
TVector3 calculateTotalDisplacement () const
 
MELAParticleoperator+= (MELAParticle *part)
 
MELAParticleoperator+= (const TLorentzVector &mom)
 

Static Public Member Functions

static bool checkParticleExists (MELAParticle const *myParticle, std::vector< MELAParticle * > const &particleArray)
 
static bool checkDeepDaughtership (MELAParticle const *part1, MELAParticle const *part2)
 

Public Attributes

int id
 
TLorentzVector p4
 
bool passSelection
 
int genStatus
 
double lifetime
 

Protected Attributes

std::vector< MELAParticle * > mothers
 
std::vector< MELAParticle * > daughters
 

Detailed Description

Definition at line 13 of file MELAParticle.h.

Constructor & Destructor Documentation

◆ MELAParticle() [1/4]

MELAParticle::MELAParticle ( )

Definition at line 16 of file MELAParticle.cc.

16  :
17 id(-9000),
18 p4(0, 0, 0, 0),
19 passSelection(true),
20 genStatus(-2),
21 lifetime(0)
22 {}

◆ MELAParticle() [2/4]

MELAParticle::MELAParticle ( int  id_)

Definition at line 23 of file MELAParticle.cc.

23  :
24 id(id_),
25 p4(0, 0, 0, 0),
26 passSelection(true),
27 genStatus(-2),
28 lifetime(0)
29 {}

◆ MELAParticle() [3/4]

MELAParticle::MELAParticle ( int  id_,
TLorentzVector  p4_ 
)

Definition at line 30 of file MELAParticle.cc.

30  :
31 id(id_),
32 p4(p4_),
33 passSelection(true),
34 genStatus(-2),
35 lifetime(0)
36 {}

◆ MELAParticle() [4/4]

MELAParticle::MELAParticle ( const MELAParticle particle_)

Definition at line 37 of file MELAParticle.cc.

37  :
38 id(particle_.id),
39 p4(particle_.p4),
40 passSelection(particle_.passSelection),
41 genStatus(particle_.genStatus),
42 lifetime(particle_.lifetime),
43 mothers(particle_.mothers),
44 daughters(particle_.daughters)
45 {}

◆ ~MELAParticle()

virtual MELAParticle::~MELAParticle ( )
inlinevirtual

Definition at line 37 of file MELAParticle.h.

37 {};

Member Function Documentation

◆ addDaughter()

void MELAParticle::addDaughter ( MELAParticle myParticle)

Definition at line 63 of file MELAParticle.cc.

63 { if (!checkParticleExists(myParticle, daughters)) daughters.push_back(myParticle); }

◆ addMother()

void MELAParticle::addMother ( MELAParticle myParticle)

Definition at line 62 of file MELAParticle.cc.

62 { if (!checkParticleExists(myParticle, mothers)) mothers.push_back(myParticle); }

◆ boost()

void MELAParticle::boost ( const TVector3 &  vec,
bool  boostAll = false 
)

Definition at line 100 of file MELAParticle.cc.

100  {
101  if (vec.Mag2()<1.){
102  if (boostAll){
103  std::vector<MELAParticle*> particles;
104  this->getRelatedParticles(particles);
105  for (std::vector<MELAParticle*>::iterator it = particles.begin(); it<particles.end(); it++) (*it)->boost(vec, false);
106  }
107  else p4.Boost(vec);
108  }
109  else MELAerr
110  << "MELAParticle::boost: "
111  << "|v|**2 = " << vec.Mag2() << " >=1 cannot be used to boost. "
112  << "v = ( " << vec.X() << " , " << vec.Y() << " , " << vec.Z() << " )"
113  << std::endl;
114 }

◆ calculateTotalDisplacement()

TVector3 MELAParticle::calculateTotalDisplacement ( ) const

Definition at line 127 of file MELAParticle.cc.

127  {
128  TVector3 res;
129  double const part_mass = this->m();
130  TVector3 const part_vec = this->vect();
131 
132  // Calculate displacement
133  if (part_mass>0.) res = part_vec * (lifetime/part_mass);
134  //MELAout << "Displacement for id=" << this->id << " = " << res.X() << ", " << res.Y() << ", " << res.Z() << " [mom: " << this->p4 << ", lifetime: " << lifetime << "]" << std::endl;
135 
136  // Add mother displacement
137  if (this->getNMothers()==1) res += this->getMother(0)->calculateTotalDisplacement();
138 
139  return res;
140 }

◆ charge()

double MELAParticle::charge ( ) const

Definition at line 90 of file MELAParticle.cc.

90  {
91  double cpos=0;
92  if (isAWBoson(id) || abs(id)==37 || abs(id)==2212 || abs(id)==211 || abs(id)==321 || abs(id)==411 || abs(id)==521) cpos = 1.;
93  else if (isALepton(id)) cpos = -1.;
94  else if (isUpTypeQuark(id)) cpos = 2./3.;
95  else if (isDownTypeQuark(id)) cpos = -1./3.;
96  if (id<0) cpos *= -1.;
97  return cpos;
98 }

◆ checkDeepDaughtership()

bool MELAParticle::checkDeepDaughtership ( MELAParticle const *  part1,
MELAParticle const *  part2 
)
static

Definition at line 119 of file MELAParticle.cc.

119  {
120  bool res = false;
121  if (!part1 || !part2) return res;
122  std::vector<MELAParticle*> daughters1; part1->getDaughterParticles(daughters1);
123  std::vector<MELAParticle*> daughters2; part2->getDaughterParticles(daughters2);
124  return TUtilHelpers::hasCommonElements(daughters1, daughters2);
125 }

◆ checkParticleExists()

bool MELAParticle::checkParticleExists ( MELAParticle const *  myParticle,
std::vector< MELAParticle * > const &  particleArray 
)
static

Definition at line 116 of file MELAParticle.cc.

116  {
117  return TUtilHelpers::checkElementExists<MELAParticle const*, MELAParticle*>(myParticle, particleArray);
118 }

◆ deltaR() [1/3]

double MELAParticle::deltaR ( const MELAParticle part) const
inline

Definition at line 83 of file MELAParticle.h.

83 { return deltaR(part.p4); }

◆ deltaR() [2/3]

double MELAParticle::deltaR ( const MELAParticle part) const
inline

Definition at line 84 of file MELAParticle.h.

84 { if (part) return deltaR(*part); else return -1; }

◆ deltaR() [3/3]

double MELAParticle::deltaR ( const TLorentzVector &  v) const
inline

Definition at line 82 of file MELAParticle.h.

82 { return p4.DeltaR(v); }

◆ dot() [1/3]

double MELAParticle::dot ( const MELAParticle part) const
inline

Definition at line 77 of file MELAParticle.h.

77 { return dot(part.p4); }

◆ dot() [2/3]

double MELAParticle::dot ( const MELAParticle part) const
inline

Definition at line 78 of file MELAParticle.h.

78 { if (part) return dot(*part); else return 0; }

◆ dot() [3/3]

double MELAParticle::dot ( const TLorentzVector &  v) const
inline

Definition at line 76 of file MELAParticle.h.

76 { return p4.Dot(v); }

◆ eta()

double MELAParticle::eta ( ) const
inline

Definition at line 73 of file MELAParticle.h.

73 { return p4.Eta(); }

◆ euclidean_dot() [1/3]

double MELAParticle::euclidean_dot ( const MELAParticle part) const
inline

Definition at line 80 of file MELAParticle.h.

80 { return euclidean_dot(part.p4); }

◆ euclidean_dot() [2/3]

double MELAParticle::euclidean_dot ( const MELAParticle part) const
inline

Definition at line 81 of file MELAParticle.h.

81 { if (part) return euclidean_dot(*part); else return 0; }

◆ euclidean_dot() [3/3]

double MELAParticle::euclidean_dot ( const TLorentzVector &  v) const
inline

Definition at line 79 of file MELAParticle.h.

79 { return (p4.Vect().Dot(v.Vect())+p4.T()*v.T()); }

◆ getDaughter()

MELAParticle * MELAParticle::getDaughter ( int  index) const

Definition at line 68 of file MELAParticle.cc.

68  {
69  if ((int)daughters.size()>index) return daughters.at(index);
70  else return 0;
71 }

◆ getDaughterIds()

std::vector< int > MELAParticle::getDaughterIds ( ) const
virtual

Reimplemented in MELACandidate.

Definition at line 72 of file MELAParticle.cc.

72  {
73  std::vector<int> result;
74  for (auto& dau:daughters){ if (dau) result.push_back(dau->id); }
75  return result;
76 }

◆ getDaughterParticles()

void MELAParticle::getDaughterParticles ( std::vector< MELAParticle * > &  particles) const
virtual

Reimplemented in MELACandidate.

Definition at line 82 of file MELAParticle.cc.

82  {
83  for (auto* part:daughters){ if (part) part->getDaughterParticles(particles); }
84  if (!checkParticleExists(this, particles)) particles.push_back((MELAParticle*) this); // A particle is its own daughter. This is to ensure that particle chains are reported properly.
85 }

◆ getDaughters() [1/2]

std::vector<MELAParticle*>& MELAParticle::getDaughters ( )
inline

Definition at line 59 of file MELAParticle.h.

59 { return daughters; }

◆ getDaughters() [2/2]

const std::vector<MELAParticle*>& MELAParticle::getDaughters ( ) const
inline

Definition at line 61 of file MELAParticle.h.

61 { return daughters; }

◆ getMother()

MELAParticle * MELAParticle::getMother ( int  index) const

Definition at line 64 of file MELAParticle.cc.

64  {
65  if ((int)mothers.size()>index) return mothers.at(index);
66  else return 0;
67 }

◆ getMothers() [1/2]

std::vector<MELAParticle*>& MELAParticle::getMothers ( )
inline

Definition at line 58 of file MELAParticle.h.

58 { return mothers; }

◆ getMothers() [2/2]

const std::vector<MELAParticle*>& MELAParticle::getMothers ( ) const
inline

Definition at line 60 of file MELAParticle.h.

60 { return mothers; }

◆ getNDaughters()

int MELAParticle::getNDaughters ( ) const
inline

Definition at line 50 of file MELAParticle.h.

50 { return daughters.size(); };

◆ getNMothers()

int MELAParticle::getNMothers ( ) const
inline

Definition at line 49 of file MELAParticle.h.

49 { return mothers.size(); };

◆ getRelatedParticles()

void MELAParticle::getRelatedParticles ( std::vector< MELAParticle * > &  particles) const
virtual

Reimplemented in MELACandidate.

Definition at line 77 of file MELAParticle.cc.

77  {
78  for (auto* part:mothers){ if (part) part->getRelatedParticles(particles); }
79  for (auto* part:daughters){ if (part) part->getRelatedParticles(particles); }
80  if (!checkParticleExists(this, particles)) particles.push_back((MELAParticle*) this);
81 }

◆ hasDaughter()

bool MELAParticle::hasDaughter ( MELAParticle const *  part) const

Definition at line 88 of file MELAParticle.cc.

◆ hasMother()

bool MELAParticle::hasMother ( MELAParticle const *  part) const

Definition at line 87 of file MELAParticle.cc.

◆ m()

double MELAParticle::m ( ) const
inline

Definition at line 66 of file MELAParticle.h.

66 { return p4.M(); }

◆ operator+=() [1/2]

MELAParticle& MELAParticle::operator+= ( const TLorentzVector &  mom)
inline

Definition at line 93 of file MELAParticle.h.

93 { p4 += mom; return *this; }

◆ operator+=() [2/2]

MELAParticle& MELAParticle::operator+= ( MELAParticle part)
inline

Definition at line 92 of file MELAParticle.h.

92 { if (part){ p4 += part->p4; addDaughter(part); } return *this; }

◆ operator=()

MELAParticle & MELAParticle::operator= ( const MELAParticle particle_)

Definition at line 46 of file MELAParticle.cc.

46  {
47  MELAParticle tmp(particle_);
48  swap(tmp);
49  return *this;
50 }

◆ p()

double MELAParticle::p ( ) const
inline

Definition at line 71 of file MELAParticle.h.

71 { return p4.P(); }

◆ phi()

double MELAParticle::phi ( ) const
inline

Definition at line 74 of file MELAParticle.h.

74 { return p4.Phi(); }

◆ pt()

double MELAParticle::pt ( ) const
inline

Definition at line 72 of file MELAParticle.h.

72 { return p4.Pt(); }

◆ rapidity()

double MELAParticle::rapidity ( ) const
inline

Definition at line 75 of file MELAParticle.h.

75 { return p4.Rapidity(); }

◆ setGenStatus()

void MELAParticle::setGenStatus ( int  status_)
inline

Definition at line 43 of file MELAParticle.h.

43 { genStatus=status_; }

◆ setLifetime()

void MELAParticle::setLifetime ( double  life_)
inline

Definition at line 44 of file MELAParticle.h.

44 { lifetime=life_; }

◆ setSelected()

void MELAParticle::setSelected ( bool  isSelected = true)
inline

Definition at line 42 of file MELAParticle.h.

42 { passSelection = isSelected; }

◆ swap()

void MELAParticle::swap ( MELAParticle particle_)

Definition at line 52 of file MELAParticle.cc.

52  {
53  std::swap(id, particle_.id);
54  std::swap(p4, particle_.p4);
55  std::swap(passSelection, particle_.passSelection);
56  std::swap(genStatus, particle_.genStatus);
57  std::swap(lifetime, particle_.lifetime);
58  std::swap(mothers, particle_.mothers);
59  std::swap(daughters, particle_.daughters);
60 }

◆ t()

double MELAParticle::t ( ) const
inline

Definition at line 70 of file MELAParticle.h.

70 { return p4.T(); }

◆ vect()

TVector3 MELAParticle::vect ( ) const
inline

Definition at line 86 of file MELAParticle.h.

86 { return p4.Vect(); }

◆ x()

double MELAParticle::x ( ) const
inline

Definition at line 67 of file MELAParticle.h.

67 { return p4.X(); }

◆ y()

double MELAParticle::y ( ) const
inline

Definition at line 68 of file MELAParticle.h.

68 { return p4.Y(); }

◆ z()

double MELAParticle::z ( ) const
inline

Definition at line 69 of file MELAParticle.h.

69 { return p4.Z(); }

Member Data Documentation

◆ daughters

std::vector<MELAParticle*> MELAParticle::daughters
protected

Definition at line 25 of file MELAParticle.h.

◆ genStatus

int MELAParticle::genStatus

Definition at line 20 of file MELAParticle.h.

◆ id

int MELAParticle::id

Definition at line 17 of file MELAParticle.h.

◆ lifetime

double MELAParticle::lifetime

Definition at line 21 of file MELAParticle.h.

◆ mothers

std::vector<MELAParticle*> MELAParticle::mothers
protected

Definition at line 24 of file MELAParticle.h.

◆ p4

TLorentzVector MELAParticle::p4

Definition at line 18 of file MELAParticle.h.

◆ passSelection

bool MELAParticle::passSelection

Definition at line 19 of file MELAParticle.h.


The documentation for this class was generated from the following files:
PDGHelpers::isALepton
bool isALepton(const int id)
Definition: PDGHelpers.cc:62
MELAParticle::euclidean_dot
double euclidean_dot(const TLorentzVector &v) const
Definition: MELAParticle.h:79
MELAParticle::swap
void swap(MELAParticle &particle_)
Definition: MELAParticle.cc:52
MELAParticle::calculateTotalDisplacement
TVector3 calculateTotalDisplacement() const
Definition: MELAParticle.cc:127
MELAParticle::checkParticleExists
static bool checkParticleExists(MELAParticle const *myParticle, std::vector< MELAParticle * > const &particleArray)
Definition: MELAParticle.cc:116
MELAParticle::m
double m() const
Definition: MELAParticle.h:66
PDGHelpers::isDownTypeQuark
bool isDownTypeQuark(const int id)
Definition: PDGHelpers.cc:45
MELAParticle::p4
TLorentzVector p4
Definition: MELAParticle.h:18
MELAParticle::daughters
std::vector< MELAParticle * > daughters
Definition: MELAParticle.h:25
MELAParticle::vect
TVector3 vect() const
Definition: MELAParticle.h:86
PDGHelpers::isAWBoson
bool isAWBoson(const int id)
Definition: PDGHelpers.cc:80
MELAParticle::genStatus
int genStatus
Definition: MELAParticle.h:20
MELAParticle::deltaR
double deltaR(const TLorentzVector &v) const
Definition: MELAParticle.h:82
MELAParticle
Definition: MELAParticle.h:13
MELAParticle::lifetime
double lifetime
Definition: MELAParticle.h:21
MELAParticle::mothers
std::vector< MELAParticle * > mothers
Definition: MELAParticle.h:24
MELAStreamHelpers::MELAerr
MELAOutputStreamer MELAerr
MELAParticle::passSelection
bool passSelection
Definition: MELAParticle.h:19
MELAParticle::getMother
MELAParticle * getMother(int index) const
Definition: MELAParticle.cc:64
TUtilHelpers::hasCommonElements
bool hasCommonElements(std::vector< T > const &v1, std::vector< T > const &v2)
Definition: TUtilHelpers.hh:63
MELAParticle::dot
double dot(const TLorentzVector &v) const
Definition: MELAParticle.h:76
MELAParticle::getRelatedParticles
virtual void getRelatedParticles(std::vector< MELAParticle * > &particles) const
Definition: MELAParticle.cc:77
MELAParticle::id
int id
Definition: MELAParticle.h:17
MELAParticle::getNMothers
int getNMothers() const
Definition: MELAParticle.h:49
PDGHelpers::isUpTypeQuark
bool isUpTypeQuark(const int id)
Definition: PDGHelpers.cc:40
MELAParticle::addDaughter
void addDaughter(MELAParticle *myParticle)
Definition: MELAParticle.cc:63