11 #include "StHepParticle.h"
12 my_hepevt* StHepParticleMaster::mgMyHepevt=0;
14 static std::vector<StHepParticle*> myVec;
25 int jmohep[NMXHEP][2];
26 int jdahep[NMXHEP][2];
27 double phep[NMXHEP][5];
28 double vhep[NMXHEP][4];
32 StHepParticleMaster::StHepParticleMaster(
void *addr)
34 assert(!mgInst &&
"StHepParticleMaster created twice. NEVER,JAMAIS");
39 StHepParticleMaster::~StHepParticleMaster()
43 for (
int i=0;i<(int)myVec.size();i++) {
delete myVec[i]; }
47 void StHepParticleMaster::Update()
49 mNTk = mgMyHepevt->nhep;
50 if (mNTk <= (
int)myVec.size())
return;
51 for (
int i = (
int)myVec.size(); i < mNTk;i++)
59 assert(mgInst &&
"No new for StHepParticleMaster. Never,Jamais");
63 const StHepParticle *StHepParticleMaster::operator()(
int idx)
const
66 assert(idx>=0 &&
"Never,Jamais");
67 if (idx >= (
int)myVec.size())
return 0;
68 if (!myVec[idx]->GetStatusCode())
return 0;
76 int StHepParticle::GetStatusCode()
const
78 return StHepParticleMaster::mgMyHepevt->isthep[mIdx];
81 int StHepParticle::GetPdgCode()
const
83 return StHepParticleMaster::mgMyHepevt->idhep[mIdx];
88 int j = StHepParticleMaster::mgMyHepevt->jmohep[mIdx][i];
90 return (j) ? myVec[j-1]:0;
95 int j0 = StHepParticleMaster::mgMyHepevt->jdahep[mIdx][0];
97 int j1 = StHepParticleMaster::mgMyHepevt->jdahep[mIdx][1];
98 j0+=i;
if (j0>j1)
return 0;
103 double StHepParticle::GetMass()
const
105 return StHepParticleMaster::mgMyHepevt->phep[mIdx][4];
108 int StHepParticle::GetNDaughters()
const
110 int j0 = StHepParticleMaster::mgMyHepevt->jdahep[mIdx][0];
112 int j1 = StHepParticleMaster::mgMyHepevt->jdahep[mIdx][1];
116 void StHepParticle::Momentum(
double p4[4])
const
118 memcpy(p4,StHepParticleMaster::mgMyHepevt->phep[mIdx],4*
sizeof(
double));
121 void StHepParticle::Vertex(
double v[3])
const
123 double *V = StHepParticleMaster::mgMyHepevt->vhep[mIdx];
124 for (
int i=0;i<3;i++) {v[i] = V[i]*10;}
127 double StHepParticle::Time()
const
129 return StHepParticleMaster::mgMyHepevt->vhep[mIdx][3]*10;
Abstract base class for particles related to common /HEPEVT/.