1 #include "TauolaHEPEVTParticle.h"
11 for(
unsigned int i=0;i<
cache.size();i++)
16 TauolaHEPEVTParticle::TauolaHEPEVTParticle(
int pdgid,
int status,
double px,
double py,
double pz,
double e,
double m,
int ms,
int me,
int ds,
int de){
37 Log::Info()<<
"TauolaHEPEVTParticle::undecay not implemented for HEPEVT"<<endl;
50 if(mothers.size()>2)
Log::Fatal(
"TauolaHEPEVTParticle::setMothers: HEPEVT does not allow more than two mothers!");
53 if(mothers.size()>1) m_second_mother = mothers[1]->
getBarcode();
59 if(
m_event==NULL)
Log::Fatal(
"TauolaHEPEVTParticle::setDaughters: particle not inside event record.");
61 int beg = 65535, end = -1;
63 for(
unsigned int i=0;i<daughters.size();i++)
65 int bc = daughters[i]->getBarcode();
66 if(bc<0)
Log::Fatal(
"TauolaHEPEVTParticle::setDaughters: all daughters has to be in event record first");
70 if(end == -1) beg = -1;
78 std::vector<TauolaParticle*> mothers;
86 if(p1) mothers.push_back(p1);
87 if(p2) mothers.push_back(p2);
96 std::vector<TauolaParticle*> daughters;
104 int min_d=65535, max_d=-1;
109 if(i<min_d) min_d = i;
110 if(i>max_d) max_d = i;
116 m_daughter_end = max_d;
123 if(m_daughter_end>=0)
130 Log::Warning()<<
"TauolaHEPEVTParticle::getDaughters(): No particle with index "<<i<<endl;
134 daughters.push_back(p);
144 if(m_daughter_end < 0)
return;
148 int first_mother_idx = buf->getFirstMotherIndex();
149 int second_mother_idx = buf->getSecondMotherIndex();
151 double px =0.0, py =0.0, pz =0.0, e =0.0;
152 double px2=0.0, py2=0.0, pz2=0.0, e2=0.0;
163 if(first_mother_idx>=0)
172 if(second_mother_idx>=0)
181 double dp = sqrt( (px-px2)*(px-px2) + (py-py2)*(py-py2) + (pz-pz2)*(pz-pz2) );
183 double m1 = sqrt( fabs( e*e - px*px - py*py - pz*pz ) );
184 double m2 = sqrt( fabs( e2*e2 - px2*px2 - py2*py2 - pz2*pz2 ) );
186 if( fabs(m1-m2) > 0.0001 || dp > 0.0001*(e+e2))
197 int pdg_id,
int status,
double mass,
198 double px,
double py,
double pz,
double e){
203 cache.push_back(
new TauolaHEPEVTParticle(pdg_id,status,px,py,pz,e,mass,-1,-1,-1,-1));
225 sprintf(buf,
"P: (%2i) %6i %2i | %11.4e %11.4e %11.4e %11.4e | %11.4e | M: %2i %2i | D: %2i %2i\n",
308 return m_second_mother;
316 return m_daughter_end;
static void Fatal(string text, unsigned short int code=0)
static void RevertOutput()
static void RedirectOutput(void(*func)(), ostream &where=*out)
TauolaHEPEVTParticle * getParticle(int i)
void addParticle(TauolaHEPEVTParticle *p)
std::vector< TauolaParticle * > getDaughters()
vector< TauolaHEPEVTParticle * > cache
TauolaHEPEVTEvent * m_event
void setEvent(TauolaHEPEVTEvent *event)
TauolaHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de)
void setStatus(int statu)
int getDaughterRangeStart()
void setMothers(std::vector< TauolaParticle * > mothers)
int getFirstMotherIndex()
void setDaughters(std::vector< TauolaParticle * > daughters)
void checkMomentumConservation()
bool isDaughterOf(TauolaHEPEVTParticle *p)
void setBarcode(int barcode)
int getSecondMotherIndex()
std::vector< TauolaParticle * > getMothers()
int getDaughterRangeEnd()
bool isMotherOf(TauolaHEPEVTParticle *p)
void setMass(double mass)
TauolaHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
void setPdgID(int pdg_id)