8 #include "StGenParticle.h"
13 void StGenParticle::Print(
const char *opt)
const
15 static int nCall=0; nCall++;
16 cout << GetIdx() <<
" -" << endl;
17 cout <<
" Ist=" << GetStatusCode() << endl;
18 cout <<
" Pdg=" << GetPdgCode() << endl;
19 cout <<
" Gea=" << GetGeaCode() << endl;
21 double V[3];
Vertex(V); cout <<
" Z=" << V[2] << endl;
23 if (GetNDaughters()) cout <<
"\tKids=" << GetNDaughters() << endl;
25 int moth1 = -1,moth2=-1;
27 if (m) moth1 = m->GetIdx();
29 if (m) moth2 = m->GetIdx();
31 if (moth1>=0 || moth2>=0) {
32 cout <<
"\tMoth=(" << endl;
33 if (moth1>=0) {cout << moth1 << endl;}
else {cout <<
"_" <<endl;}
35 if (moth2>=0) {cout << moth2 << endl;}
else {cout <<
"_" << endl;}
43 double StGenParticle::GetCalcMass()
const
47 double m =p[3]*p[3]-(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
48 return (m>0) ? sqrt(m) : -sqrt(-m);
51 double StGenParticle::R()
const
53 double x[3];
Vertex(x);
return sqrt(x[0]*x[0]+x[1]*x[1]);
57 double StGenParticle::Rho()
const
59 double x[3];
Vertex(x);
return sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]);
63 double StGenParticle::P()
const
65 double p[4]; Momentum(p);
return sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
69 double StGenParticle::Pt()
const
71 double p[4]; Momentum(p);
return sqrt(p[0]*p[0]+p[1]*p[1]);
75 double StGenParticle::Energy()
const
77 double p[4]; Momentum(p);
return p[3];
81 double StGenParticle::Eta()
const
83 double p[4]; Momentum(p);
85 if (pmom > fabs(p[2]))
return 0.5*log((pmom+p[2])/(pmom-p[2]));
89 double StGenParticle::Phi()
const
91 double p[4]; Momentum(p);
92 return atan2(p[1],p[0]);
95 double StGenParticle::Theta()
const
97 double p[4]; Momentum(p);
98 return acos(p[2]/P());
100 int StGenParticle::GetPdgCode()
const {
return StGenParticleMaster::Gea2Pdg(GetGeaCode());}
101 int StGenParticle::GetGeaCode()
const {
return StGenParticleMaster::Pdg2Gea(GetPdgCode());}
105 void StGenParticleMaster::Print(
const char *tit)
const
108 cout <<
"StGenParticleMaster::Print(" << tit <<
")" << endl;
132 static const int IDGEA[] = {
133 0, 1, 8, 9, 7, 10, 11, 12, 16, 17,
134 14, 13, 15, 25, 2, 3, 4, 4, 5, 6,
135 18, 19, 20, 21, 22, 23, 24,
136 26, 27, 28, 29, 30, 31, 32,
137 33, 34, 35, 36, 37, 38, 39, 40, 41,
138 42, 43, 44, 4, 4, 4, 4, 48, 48, 48,
141 static const int IDPDG[] = {
142 0, 22, 211, -211, 111, 130, 321, -321, 310, 221,
143 2212, 2112,-2212,-2112, -11, 11, -12, 12, -13, 13,
144 3122, 3222, 3212, 3112, 3322, 3312, 3334,
145 -3122,-3222,-3212,-3112,-3322,-3312,-3334,
146 -15, 15, 411, -411, 421, -421, 431, -431, 4122,
147 24, -24, 23, -14, 14, -16, 16, 71, 72, 75,
148 700201,700301,700202,700302};
150 int StGenParticleMaster::Gea2Pdg(
int igea)
153 static int PdgOfGea[kNGEA]={0};
156 for (
int i = 0;i<kNGEA; i++) { PdgOfGea[IDGEA[i]] = IDPDG[i]; }
158 if (igea >=kNGEA)
return 0;
159 return PdgOfGea[igea];
162 double StGenParticleMaster::Gea2Mas(
int igea)
164 static double mass[kNGEA]={
165 0 ,0 ,0.00051 ,0.00051 ,0
166 ,0.10566 ,0.10566 ,0.13498 ,0.13957 ,0.13957
167 ,0.49767 ,0.4936 ,0.4936 ,0.93957 ,0.93827
168 ,0.93827 ,0.49767 ,0.54745 ,1.11568 ,1.18937
169 ,1.19255 ,1.19744 ,1.3149 ,1.3213 ,1.67245
170 ,0.93957 ,1.11568 ,1.18937 ,1.19255 ,1.19744
171 ,1.3149 ,1.3213 ,1.67245 ,1.777 ,1.777
172 ,1.8693 ,1.8693 ,1.8645 ,1.8645 ,1.9685
173 ,1.9685 ,2.2849 ,80.33 ,80.33 ,91.187
176 if (igea>=kNGEA)
return 0.;
181 int StGenParticleMaster::Pdg2Gea(
int ipdg)
183 typedef std::map<int, int > pdgMap_t;
184 static pdgMap_t pdgMap;
185 static int once = 2009;
187 if (once) { once=0;
for (
int i=0;i<kNGEA;i++) {pdgMap[IDPDG[i]] = IDGEA[i];}}
189 pdgMap_t::iterator it = pdgMap.find(ipdg);
190 if (it == pdgMap.end())
return 0;
Abstract base class for particles related to common /HEPEVT/.