JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
MELAParticle.h
Go to the documentation of this file.
1 #ifndef MELAPARTICLE_H
2 #define MELAPARTICLE_H
3 
4 #include <vector>
5 #include "PDGHelpers.h"
6 #include "TVector3.h"
7 #include "TLorentzVector.h"
8 
9 namespace debugVars{
10  extern bool debugFlag;
11 }
12 
14 
15  // Data members
16 public:
17  int id;
18  TLorentzVector p4;
20  int genStatus;
21  double lifetime;
22 
23 protected:
24  std::vector<MELAParticle*> mothers;
25  std::vector<MELAParticle*> daughters;
26 
27 
28  // Member functions
29 public:
30 
31  // Constructors
32  MELAParticle();
33  MELAParticle(int id_);
34  MELAParticle(int id_, TLorentzVector p4_);
35  MELAParticle(const MELAParticle& particle_);
36  MELAParticle& operator=(const MELAParticle& particle_);
37  virtual ~MELAParticle(){};
38 
39  // Utility functions
40  void swap(MELAParticle& particle_);
41 
42  void setSelected(bool isSelected=true){ passSelection = isSelected; }
43  void setGenStatus(int status_){ genStatus=status_; }
44  void setLifetime(double life_){ lifetime=life_; }
45 
46  void addMother(MELAParticle* myParticle);
47  void addDaughter(MELAParticle* myParticle);
48 
49  int getNMothers() const{ return mothers.size(); };
50  int getNDaughters() const{ return daughters.size(); };
51  virtual std::vector<int> getDaughterIds()const;
52 
53  MELAParticle* getMother(int index) const;
54  MELAParticle* getDaughter(int index) const;
55  virtual void getRelatedParticles(std::vector<MELAParticle*>& particles) const;
56  virtual void getDaughterParticles(std::vector<MELAParticle*>& particles) const;
57 
58  std::vector<MELAParticle*>& getMothers(){ return mothers; }
59  std::vector<MELAParticle*>& getDaughters(){ return daughters; }
60  const std::vector<MELAParticle*>& getMothers()const{ return mothers; }
61  const std::vector<MELAParticle*>& getDaughters()const{ return daughters; }
62  bool hasMother(MELAParticle const* part) const;
63  bool hasDaughter(MELAParticle const* part) const;
64 
65  double charge()const;
66  double m()const{ return p4.M(); }
67  double x()const{ return p4.X(); }
68  double y()const{ return p4.Y(); }
69  double z()const{ return p4.Z(); }
70  double t()const{ return p4.T(); }
71  double p()const{ return p4.P(); }
72  double pt()const{ return p4.Pt(); }
73  double eta()const{ return p4.Eta(); }
74  double phi()const{ return p4.Phi(); }
75  double rapidity()const{ return p4.Rapidity(); }
76  double dot(const TLorentzVector& v)const{ return p4.Dot(v); }
77  double dot(const MELAParticle& part)const{ return dot(part.p4); }
78  double dot(const MELAParticle* part)const{ if (part) return dot(*part); else return 0; }
79  double euclidean_dot(const TLorentzVector& v)const{ return (p4.Vect().Dot(v.Vect())+p4.T()*v.T()); }
80  double euclidean_dot(const MELAParticle& part)const{ return euclidean_dot(part.p4); }
81  double euclidean_dot(const MELAParticle* part)const{ if (part) return euclidean_dot(*part); else return 0; }
82  double deltaR(const TLorentzVector& v)const{ return p4.DeltaR(v); }
83  double deltaR(const MELAParticle& part)const{ return deltaR(part.p4); }
84  double deltaR(const MELAParticle* part)const{ if (part) return deltaR(*part); else return -1; }
85  void boost(const TVector3& vec, bool boostAll=false);
86  TVector3 vect()const{ return p4.Vect(); }
87 
88  // Function to calculate displacements from lifetimes
89  TVector3 calculateTotalDisplacement()const;
90 
91  // Operators
92  MELAParticle& operator+=(MELAParticle* part){ if (part){ p4 += part->p4; addDaughter(part); } return *this; }
93  MELAParticle& operator+=(const TLorentzVector& mom){ p4 += mom; return *this; }
94 
95  // Helper functions
96  static bool checkParticleExists(MELAParticle const* myParticle, std::vector<MELAParticle*> const& particleArray);
97  static bool checkDeepDaughtership(MELAParticle const* part1, MELAParticle const* part2);
98 
99 };
100 
101 
102 #endif
MELAParticle::operator=
MELAParticle & operator=(const MELAParticle &particle_)
Definition: MELAParticle.cc:46
MELAParticle::MELAParticle
MELAParticle()
Definition: MELAParticle.cc:16
MELAParticle::getDaughter
MELAParticle * getDaughter(int index) const
Definition: MELAParticle.cc:68
debugVars::debugFlag
bool debugFlag
Definition: MELAParticle.cc:12
MELAParticle::deltaR
double deltaR(const MELAParticle *part) const
Definition: MELAParticle.h:84
MELAParticle::pt
double pt() const
Definition: MELAParticle.h:72
MELAParticle::euclidean_dot
double euclidean_dot(const TLorentzVector &v) const
Definition: MELAParticle.h:79
MELAParticle::getNDaughters
int getNDaughters() const
Definition: MELAParticle.h:50
MELAParticle::getMothers
const std::vector< MELAParticle * > & getMothers() const
Definition: MELAParticle.h:60
MELAParticle::swap
void swap(MELAParticle &particle_)
Definition: MELAParticle.cc:52
MELAParticle::euclidean_dot
double euclidean_dot(const MELAParticle &part) const
Definition: MELAParticle.h:80
MELAParticle::getDaughters
std::vector< MELAParticle * > & getDaughters()
Definition: MELAParticle.h:59
MELAParticle::eta
double eta() const
Definition: MELAParticle.h:73
MELAParticle::setGenStatus
void setGenStatus(int status_)
Definition: MELAParticle.h:43
MELAParticle::rapidity
double rapidity() const
Definition: MELAParticle.h:75
MELAParticle::operator+=
MELAParticle & operator+=(const TLorentzVector &mom)
Definition: MELAParticle.h:93
MELAParticle::calculateTotalDisplacement
TVector3 calculateTotalDisplacement() const
Definition: MELAParticle.cc:127
MELAParticle::t
double t() const
Definition: MELAParticle.h:70
MELAParticle::phi
double phi() const
Definition: MELAParticle.h:74
MELAParticle::checkParticleExists
static bool checkParticleExists(MELAParticle const *myParticle, std::vector< MELAParticle * > const &particleArray)
Definition: MELAParticle.cc:116
MELAParticle::getMothers
std::vector< MELAParticle * > & getMothers()
Definition: MELAParticle.h:58
MELAParticle::y
double y() const
Definition: MELAParticle.h:68
MELAParticle::hasDaughter
bool hasDaughter(MELAParticle const *part) const
Definition: MELAParticle.cc:88
MELAParticle::x
double x() const
Definition: MELAParticle.h:67
MELAParticle::p
double p() const
Definition: MELAParticle.h:71
MELAParticle::m
double m() const
Definition: MELAParticle.h:66
MELAParticle::p4
TLorentzVector p4
Definition: MELAParticle.h:18
MELAParticle::hasMother
bool hasMother(MELAParticle const *part) const
Definition: MELAParticle.cc:87
MELAParticle::daughters
std::vector< MELAParticle * > daughters
Definition: MELAParticle.h:25
MELAParticle::vect
TVector3 vect() const
Definition: MELAParticle.h:86
MELAParticle::z
double z() const
Definition: MELAParticle.h:69
MELAParticle::genStatus
int genStatus
Definition: MELAParticle.h:20
MELAParticle::charge
double charge() const
Definition: MELAParticle.cc:90
MELAParticle::deltaR
double deltaR(const TLorentzVector &v) const
Definition: MELAParticle.h:82
MELAParticle::setLifetime
void setLifetime(double life_)
Definition: MELAParticle.h:44
MELAParticle::dot
double dot(const MELAParticle &part) const
Definition: MELAParticle.h:77
MELAParticle::checkDeepDaughtership
static bool checkDeepDaughtership(MELAParticle const *part1, MELAParticle const *part2)
Definition: MELAParticle.cc:119
MELAParticle
Definition: MELAParticle.h:13
debugVars
Definition: MELAParticle.h:9
MELAParticle::lifetime
double lifetime
Definition: MELAParticle.h:21
MELAParticle::getDaughterParticles
virtual void getDaughterParticles(std::vector< MELAParticle * > &particles) const
Definition: MELAParticle.cc:82
MELAParticle::deltaR
double deltaR(const MELAParticle &part) const
Definition: MELAParticle.h:83
MELAParticle::dot
double dot(const MELAParticle *part) const
Definition: MELAParticle.h:78
MELAParticle::mothers
std::vector< MELAParticle * > mothers
Definition: MELAParticle.h:24
MELAParticle::euclidean_dot
double euclidean_dot(const MELAParticle *part) const
Definition: MELAParticle.h:81
MELAParticle::operator+=
MELAParticle & operator+=(MELAParticle *part)
Definition: MELAParticle.h:92
MELAParticle::addMother
void addMother(MELAParticle *myParticle)
Definition: MELAParticle.cc:62
MELAParticle::~MELAParticle
virtual ~MELAParticle()
Definition: MELAParticle.h:37
MELAParticle::passSelection
bool passSelection
Definition: MELAParticle.h:19
MELAParticle::getDaughters
const std::vector< MELAParticle * > & getDaughters() const
Definition: MELAParticle.h:61
MELAParticle::getMother
MELAParticle * getMother(int index) const
Definition: MELAParticle.cc:64
PDGHelpers.h
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::getDaughterIds
virtual std::vector< int > getDaughterIds() const
Definition: MELAParticle.cc:72
MELAParticle::boost
void boost(const TVector3 &vec, bool boostAll=false)
Definition: MELAParticle.cc:100
MELAParticle::getNMothers
int getNMothers() const
Definition: MELAParticle.h:49
MELAParticle::setSelected
void setSelected(bool isSelected=true)
Definition: MELAParticle.h:42
MELAParticle::addDaughter
void addDaughter(MELAParticle *myParticle)
Definition: MELAParticle.cc:63