1 |
|
#ifndef GenParticle_H |
2 |
|
#define GenParticle_H |
3 |
|
|
4 |
< |
#include "Particle.h" |
4 |
> |
#include "FlavorParticle.h" |
5 |
> |
#include <iomanip> |
6 |
> |
#include <iostream> |
7 |
> |
#include <string> |
8 |
> |
#include <sstream> |
9 |
> |
|
10 |
> |
/** |
11 |
> |
* @short generator particle class |
12 |
> |
* @author Thomas Peiffer |
13 |
> |
*/ |
14 |
|
|
15 |
< |
class GenParticle : public Particle{ |
15 |
> |
class GenParticle : public FlavorParticle{ |
16 |
|
public: |
17 |
|
GenParticle(){ |
9 |
– |
m_pdgId=0; |
18 |
|
m_status=0; |
19 |
|
m_index=0; |
20 |
|
m_mother1=0; |
21 |
|
m_mother2=0; |
22 |
|
m_daughter1=0; |
23 |
|
m_daughter2=0; |
24 |
+ |
m_spin=0; |
25 |
|
}; |
26 |
|
~GenParticle(){ |
27 |
|
}; |
28 |
|
|
20 |
– |
int pdgId() const{return m_pdgId;} |
29 |
|
int status() const{return m_status;} |
30 |
|
int index() const{return m_index;} |
31 |
|
int mother1() const{return m_mother1;} |
32 |
|
int mother2() const{return m_mother2;} |
33 |
|
int daughter1() const{return m_daughter1;} |
34 |
|
int daughter2() const{return m_daughter2;} |
35 |
+ |
int spin() const{return m_spin;} |
36 |
|
|
37 |
|
//return mother 1 or 2 (ind<=1 or ind>=2) |
38 |
< |
GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1){ |
38 |
> |
GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1) const { |
39 |
|
for(unsigned int i=0; i< gplist->size(); ++i){ |
40 |
|
if(ind<=1){ |
41 |
|
if(this->m_mother1 == gplist->at(i).index()){ |
51 |
|
//std::cout << "WARNING: Mother " << ind << " not found in list of GenParticles" << std::endl; |
52 |
|
return 0; |
53 |
|
} |
54 |
+ |
|
55 |
|
//return daughter 1 or 2 (ind<=1 or ind>=2) |
56 |
< |
GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1){ |
56 |
> |
GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1) const { |
57 |
|
for(unsigned int i=0; i< gplist->size(); ++i){ |
58 |
|
if(ind<=1){ |
59 |
|
if(this->m_daughter1 == gplist->at(i).index()){ |
69 |
|
//std::cout << "WARNING: Daughter " << ind << " not found in list of GenParticles" << std::endl; |
70 |
|
return 0; |
71 |
|
} |
72 |
+ |
|
73 |
+ |
//print list of particles in one event with their characteristics |
74 |
+ |
void Print(std::vector<GenParticle> *gplist) const{ |
75 |
+ |
std::cout << std::setw(10) << this->m_index << '|'; |
76 |
+ |
std::cout << std::setw(10) << this->pdgId() << '|'; |
77 |
+ |
std::cout << std::setw(10) << this->m_status << '|'; |
78 |
+ |
if(this->mother(gplist, 1)){ |
79 |
+ |
std::ostringstream convert1; |
80 |
+ |
convert1 << "id:" << this->mother(gplist, 1)->pdgId() << ", ind:" << this->m_mother1; |
81 |
+ |
std::cout << std::setw(20) << convert1.str() << '|'; |
82 |
+ |
} |
83 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
84 |
+ |
if(this->mother(gplist, 2)){ |
85 |
+ |
std::ostringstream convert2; |
86 |
+ |
convert2 << "id:" << this->mother(gplist, 2)->pdgId() << ", ind:" << this->m_mother2; |
87 |
+ |
std::cout << std::setw(20) << convert2.str() << '|'; |
88 |
+ |
} |
89 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
90 |
+ |
if(this->daughter(gplist, 1)){ |
91 |
+ |
std::ostringstream convert3; |
92 |
+ |
convert3 << "id:" << this->daughter(gplist, 1)->pdgId() << ", ind:" << this->m_daughter1; |
93 |
+ |
std::cout << std::setw(20) << convert3.str() << '|'; |
94 |
+ |
} |
95 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
96 |
+ |
if(this->daughter(gplist, 2)){ |
97 |
+ |
std::ostringstream convert4; |
98 |
+ |
convert4 << "id:" << this->daughter(gplist, 2)->pdgId() << ", ind:" << this->m_daughter2; |
99 |
+ |
std::cout << std::setw(20) << convert4.str() << '|'; |
100 |
+ |
} |
101 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
102 |
+ |
std::cout << std::setw(10) << this->v4().Px() << '|'; |
103 |
+ |
std::cout << std::setw(10) << this->v4().Py() << '|'; |
104 |
+ |
std::cout << std::setw(10) << this->v4().Pz() << '|'; |
105 |
+ |
std::cout << std::setw(10) << this->energy() << '|'; |
106 |
+ |
std::cout << std::setw(10) << this->pt() << '|'; |
107 |
+ |
double m2 = this->v4().M2(); |
108 |
+ |
double m; |
109 |
+ |
if (m2>0) m = sqrt(m2); |
110 |
+ |
else m = (-1)*sqrt((-1)*m2); |
111 |
+ |
std::cout << std::setw(10) << m << std::endl; |
112 |
+ |
return; |
113 |
+ |
} |
114 |
+ |
|
115 |
|
|
63 |
– |
void set_pdgId(int x){ m_pdgId=x;} |
116 |
|
void set_status(int x){ m_status=x;} |
117 |
|
void set_index(int x){ m_index=x;} |
118 |
|
void set_mother1(int x){ m_mother1=x;} |
119 |
|
void set_mother2(int x){ m_mother2=x;} |
120 |
|
void set_daughter1(int x){ m_daughter1=x;} |
121 |
|
void set_daughter2(int x){ m_daughter2=x;} |
122 |
+ |
void set_spin(int x){ m_spin=x;} |
123 |
|
|
124 |
|
private: |
72 |
– |
int m_pdgId; |
125 |
|
int m_status; |
126 |
|
int m_index; |
127 |
|
|
129 |
|
int m_mother2; |
130 |
|
int m_daughter1; |
131 |
|
int m_daughter2; |
132 |
+ |
int m_spin; |
133 |
|
|
134 |
|
|
135 |
|
}; |