1 #include "TauolaHEPEVTParticle.h"
11 for(
unsigned int i=0;i<cache.size();i++)
12 if(cache[i]->m_barcode<0)
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){
28 m_daughter_start = ds;
37 Log::Info()<<
"TauolaHEPEVTParticle::undecay not implemented for HEPEVT"<<endl;
44 if(m_barcode<0 && mothers.size()>0)
50 if(mothers.size()>2)
Log::Fatal(
"TauolaHEPEVTParticle::setMothers: HEPEVT does not allow more than two mothers!");
52 if(mothers.size()>0) m_first_mother = mothers[0]->
getBarcode();
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;
72 m_daughter_start = beg;
78 std::vector<TauolaParticle*> mothers;
83 if(m_first_mother>=0) p1 = m_event->
getParticle(m_first_mother);
84 if(m_second_mother>=0) p2 = m_event->
getParticle(m_second_mother);
86 if(p1) mothers.push_back(p1);
87 if(p2) mothers.push_back(p2);
96 std::vector<TauolaParticle*> daughters;
98 if(!m_event)
return 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;
115 m_daughter_start = min_d;
116 m_daughter_end = max_d;
123 if(m_daughter_end>=0)
125 for(
int i=m_daughter_start;i<=m_daughter_end;i++)
130 Log::Warning()<<
"TauolaHEPEVTParticle::getDaughters(): No particle with index "<<i<<endl;
134 daughters.push_back(p);
144 if(m_daughter_end < 0)
return;
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;
154 for(
int i=m_daughter_start;i<=m_daughter_end;i++)
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))
191 for(
int i=m_daughter_start;i<=m_daughter_end;i++) m_event->
getParticle(i)->
print();
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));
210 if(bc==m_first_mother || bc==m_second_mother)
return true;
218 if(bc>=m_daughter_start && bc<=m_daughter_end)
return true;
225 sprintf(buf,
"P: (%2i) %6i %2i | %11.4e %11.4e %11.4e %11.4e | %11.4e | M: %2i %2i | D: %2i %2i\n",
226 m_barcode, m_pdgid, m_status, m_px, m_py, m_pz, m_e, m_generated_mass,
227 m_first_mother, m_second_mother, m_daughter_start, m_daughter_end);
243 m_generated_mass = mass;
255 return m_generated_mass;
304 return m_first_mother;
308 return m_second_mother;
312 return m_daughter_start;
316 return m_daughter_end;
void setBarcode(int barcode)
std::vector< TauolaParticle * > getMothers()
int getDaughterRangeEnd()
int getSecondMotherIndex()
void addParticle(TauolaHEPEVTParticle *p)
bool isMotherOf(TauolaHEPEVTParticle *p)
TauolaHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
static void RedirectOutput(void(*func)(), ostream &where=*out)
int getDaughterRangeStart()
void setMothers(std::vector< TauolaParticle * > mothers)
TauolaHEPEVTParticle * getParticle(int i)
TauolaHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de)
void setPdgID(int pdg_id)
void setEvent(TauolaHEPEVTEvent *event)
int getFirstMotherIndex()
static void Fatal(string text, unsigned short int code=0)
void setDaughters(std::vector< TauolaParticle * > daughters)
void checkMomentumConservation()
std::vector< TauolaParticle * > getDaughters()
void setMass(double mass)
bool isDaughterOf(TauolaHEPEVTParticle *p)
static void RevertOutput()
void setStatus(int statu)