1 |
peiffer |
1.1 |
#ifndef GenParticle_H
|
2 |
|
|
#define GenParticle_H
|
3 |
|
|
|
4 |
peiffer |
1.7 |
#include "FlavorParticle.h"
|
5 |
rkogler |
1.6 |
#include <iomanip>
|
6 |
|
|
#include <iostream>
|
7 |
|
|
#include <string>
|
8 |
|
|
#include <sstream>
|
9 |
peiffer |
1.1 |
|
10 |
peiffer |
1.4 |
/**
|
11 |
|
|
* @short generator particle class
|
12 |
|
|
* @author Thomas Peiffer
|
13 |
|
|
*/
|
14 |
|
|
|
15 |
peiffer |
1.7 |
class GenParticle : public FlavorParticle{
|
16 |
peiffer |
1.1 |
public:
|
17 |
|
|
GenParticle(){
|
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 |
peiffer |
1.5 |
m_spin=0;
|
25 |
peiffer |
1.1 |
};
|
26 |
|
|
~GenParticle(){
|
27 |
|
|
};
|
28 |
|
|
|
29 |
peiffer |
1.2 |
int status() const{return m_status;}
|
30 |
|
|
int index() const{return m_index;}
|
31 |
peiffer |
1.3 |
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 |
peiffer |
1.5 |
int spin() const{return m_spin;}
|
36 |
peiffer |
1.1 |
|
37 |
|
|
//return mother 1 or 2 (ind<=1 or ind>=2)
|
38 |
rkogler |
1.6 |
GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1) const {
|
39 |
peiffer |
1.1 |
for(unsigned int i=0; i< gplist->size(); ++i){
|
40 |
|
|
if(ind<=1){
|
41 |
|
|
if(this->m_mother1 == gplist->at(i).index()){
|
42 |
|
|
return &(gplist->at(i));
|
43 |
|
|
}
|
44 |
|
|
}
|
45 |
|
|
else{
|
46 |
|
|
if(this->m_mother2 == gplist->at(i).index()){
|
47 |
|
|
return &(gplist->at(i));
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
//std::cout << "WARNING: Mother " << ind << " not found in list of GenParticles" << std::endl;
|
52 |
|
|
return 0;
|
53 |
|
|
}
|
54 |
rkogler |
1.6 |
|
55 |
peiffer |
1.1 |
//return daughter 1 or 2 (ind<=1 or ind>=2)
|
56 |
rkogler |
1.6 |
GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1) const {
|
57 |
peiffer |
1.1 |
for(unsigned int i=0; i< gplist->size(); ++i){
|
58 |
|
|
if(ind<=1){
|
59 |
|
|
if(this->m_daughter1 == gplist->at(i).index()){
|
60 |
|
|
return &(gplist->at(i));
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
else{
|
64 |
|
|
if(this->m_daughter2 == gplist->at(i).index()){
|
65 |
|
|
return &(gplist->at(i));
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
}
|
69 |
|
|
//std::cout << "WARNING: Daughter " << ind << " not found in list of GenParticles" << std::endl;
|
70 |
|
|
return 0;
|
71 |
|
|
}
|
72 |
rkogler |
1.6 |
|
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 |
peiffer |
1.7 |
std::cout << std::setw(10) << this->pdgId() << '|';
|
77 |
rkogler |
1.6 |
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 |
peiffer |
1.1 |
|
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 |
peiffer |
1.5 |
void set_spin(int x){ m_spin=x;}
|
123 |
peiffer |
1.1 |
|
124 |
|
|
private:
|
125 |
|
|
int m_status;
|
126 |
|
|
int m_index;
|
127 |
|
|
|
128 |
|
|
int m_mother1;
|
129 |
|
|
int m_mother2;
|
130 |
|
|
int m_daughter1;
|
131 |
|
|
int m_daughter2;
|
132 |
peiffer |
1.5 |
int m_spin;
|
133 |
peiffer |
1.1 |
|
134 |
|
|
|
135 |
|
|
};
|
136 |
|
|
|
137 |
|
|
#endif
|