2 |
|
#define GenParticle_H |
3 |
|
|
4 |
|
#include "Particle.h" |
5 |
+ |
#include <iomanip> |
6 |
+ |
#include <iostream> |
7 |
+ |
#include <string> |
8 |
+ |
#include <sstream> |
9 |
|
|
10 |
|
/** |
11 |
|
* @short generator particle class |
37 |
|
int spin() const{return m_spin;} |
38 |
|
|
39 |
|
//return mother 1 or 2 (ind<=1 or ind>=2) |
40 |
< |
GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1){ |
40 |
> |
GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1) const { |
41 |
|
for(unsigned int i=0; i< gplist->size(); ++i){ |
42 |
|
if(ind<=1){ |
43 |
|
if(this->m_mother1 == gplist->at(i).index()){ |
53 |
|
//std::cout << "WARNING: Mother " << ind << " not found in list of GenParticles" << std::endl; |
54 |
|
return 0; |
55 |
|
} |
56 |
+ |
|
57 |
|
//return daughter 1 or 2 (ind<=1 or ind>=2) |
58 |
< |
GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1){ |
58 |
> |
GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1) const { |
59 |
|
for(unsigned int i=0; i< gplist->size(); ++i){ |
60 |
|
if(ind<=1){ |
61 |
|
if(this->m_daughter1 == gplist->at(i).index()){ |
71 |
|
//std::cout << "WARNING: Daughter " << ind << " not found in list of GenParticles" << std::endl; |
72 |
|
return 0; |
73 |
|
} |
74 |
+ |
|
75 |
+ |
//print list of particles in one event with their characteristics |
76 |
+ |
void Print(std::vector<GenParticle> *gplist) const{ |
77 |
+ |
std::cout << std::setw(10) << this->m_index << '|'; |
78 |
+ |
std::cout << std::setw(10) << this->m_pdgId << '|'; |
79 |
+ |
std::cout << std::setw(10) << this->m_status << '|'; |
80 |
+ |
if(this->mother(gplist, 1)){ |
81 |
+ |
std::ostringstream convert1; |
82 |
+ |
convert1 << "id:" << this->mother(gplist, 1)->pdgId() << ", ind:" << this->m_mother1; |
83 |
+ |
std::cout << std::setw(20) << convert1.str() << '|'; |
84 |
+ |
} |
85 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
86 |
+ |
if(this->mother(gplist, 2)){ |
87 |
+ |
std::ostringstream convert2; |
88 |
+ |
convert2 << "id:" << this->mother(gplist, 2)->pdgId() << ", ind:" << this->m_mother2; |
89 |
+ |
std::cout << std::setw(20) << convert2.str() << '|'; |
90 |
+ |
} |
91 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
92 |
+ |
if(this->daughter(gplist, 1)){ |
93 |
+ |
std::ostringstream convert3; |
94 |
+ |
convert3 << "id:" << this->daughter(gplist, 1)->pdgId() << ", ind:" << this->m_daughter1; |
95 |
+ |
std::cout << std::setw(20) << convert3.str() << '|'; |
96 |
+ |
} |
97 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
98 |
+ |
if(this->daughter(gplist, 2)){ |
99 |
+ |
std::ostringstream convert4; |
100 |
+ |
convert4 << "id:" << this->daughter(gplist, 2)->pdgId() << ", ind:" << this->m_daughter2; |
101 |
+ |
std::cout << std::setw(20) << convert4.str() << '|'; |
102 |
+ |
} |
103 |
+ |
else{std::cout << std::setw(20) << "none" << '|';} |
104 |
+ |
std::cout << std::setw(10) << this->v4().Px() << '|'; |
105 |
+ |
std::cout << std::setw(10) << this->v4().Py() << '|'; |
106 |
+ |
std::cout << std::setw(10) << this->v4().Pz() << '|'; |
107 |
+ |
std::cout << std::setw(10) << this->energy() << '|'; |
108 |
+ |
std::cout << std::setw(10) << this->pt() << '|'; |
109 |
+ |
double m2 = this->v4().M2(); |
110 |
+ |
double m; |
111 |
+ |
if (m2>0) m = sqrt(m2); |
112 |
+ |
else m = (-1)*sqrt((-1)*m2); |
113 |
+ |
std::cout << std::setw(10) << m << std::endl; |
114 |
+ |
return; |
115 |
+ |
} |
116 |
+ |
|
117 |
|
|
118 |
|
void set_pdgId(int x){ m_pdgId=x;} |
119 |
|
void set_status(int x){ m_status=x;} |