10 for(
unsigned int i=0;
i<
cache.size();
i++)
15 PhotosHEPEVTParticle::PhotosHEPEVTParticle(
int pdgid,
int status,
double px,
double py,
double pz,
double e,
double m,
int ms,
int me,
int ds,
int de){
37 if(!
m_event)
Log::Fatal(
"PhotosHEPEVTParticle::addDaughter - particle not in event record");
39 std::vector<PhotosParticle*> mothers = daughter->
getMothers();
74 if(m!=-1 && m>m_daughter_end)
94 if(mothers.size()>2)
Log::Fatal(
"PhotosHEPEVTParticle::setMothers: HEPEVT does not allow more than two mothers!");
103 if(
m_event==NULL)
Log::Fatal(
"PhotosHEPEVTParticle::setDaughters: particle not inside event record.");
105 int beg = 65535, end = -1;
107 for(
unsigned int i=0;
i<daughters.size();
i++)
109 int bc = daughters[
i]->getBarcode();
110 if(bc<0)
Log::Fatal(
"PhotosHEPEVTParticle::setDaughters: all daughters has to be in event record first");
114 if(end == -1) beg = -1;
122 std::vector<PhotosParticle*> mothers;
130 if(p1) mothers.push_back(p1);
131 if(p2) mothers.push_back(p2);
140 std::vector<PhotosParticle*> daughters;
148 int min_d=65535, max_d=-1;
153 if(
i<min_d) min_d =
i;
154 if(
i>max_d) max_d =
i;
174 Log::Warning()<<
"PhotosHEPEVTParticle::getDaughters(): No particle with index "<<
i<<endl;
178 daughters.push_back(p);
187 std::vector<PhotosParticle*> list;
192 std::vector<PhotosParticle*> daughters =
getDaughters();
195 list.insert(list.end(),daughters.begin(),daughters.end());
203 for(
unsigned int i=0;
i<list.size();
i++)
205 std::vector<PhotosParticle*> daughters2 = list[
i]->getDaughters();
208 for(
unsigned int j=0;j<daughters2.size();j++)
211 for(
unsigned int k=0;k<list.size();k++)
212 if( daughters2[j]->
getBarcode() == list[k]->getBarcode() )
218 if(add) list.push_back(daughters2[j]);
235 double px =0.0, py =0.0,
pz =0.0, e =0.0;
236 double px2=0.0, py2=0.0, pz2=0.0, e2=0.0;
247 if(first_mother_idx>=0)
256 if(second_mother_idx>=0)
265 double dp =
sqrt( (px-px2)*(px-px2) + (py-py2)*(py-py2) + (
pz-pz2)*(
pz-pz2) );
267 double m1 =
sqrt(
fabs( e*e - px*px - py*py -
pz*
pz ) );
268 double m2 =
sqrt(
fabs( e2*e2 - px2*px2 - py2*py2 - pz2*pz2 ) );
270 if(
fabs(m1-m2) > 0.0001 || dp > 0.0001*(e+e2))
284 int pdg_id,
int status,
double mass,
285 double px,
double py,
double pz,
double e){
290 cache.push_back(
new PhotosHEPEVTParticle(pdg_id,status,px,py,pz,e,mass,-1,-1,-1,-1));
296 Log::Warning()<<
"PhotosParticle::createHistoryEntry() not implemented for HEPEVT."<<endl;
301 Log::Warning()<<
"PhotosHEPEVTParticle::createSelfDecayVertex() not implemented for HEPEVT."<<endl;
322 sprintf(buf,
"P: (%2i) %6i %2i | %11.4e %11.4e %11.4e %11.4e | %11.4e | M: %2i %2i | D: %2i %2i\n",
PhotosHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
int getDaughterRangeStart()
bool checkMomentumConservation()
void setEvent(PhotosHEPEVTEvent *event)
friend F32vec4 sqrt(const F32vec4 &a)
std::vector< PhotosParticle * > getMothers()
void setDaughterRangeStart(int i)
void setStatus(int statu)
PhotosHEPEVTParticle * getParticle(int i)
PhotosHEPEVTEvent * m_event
std::vector< PhotosParticle * > getAllDecayProducts()
int getFirstMotherIndex()
std::vector< PhotosParticle * > getDaughters()
bool isMotherOf(PhotosHEPEVTParticle *p)
TString m2(TString pts, TString exts="e px py pz")
virtual int getBarcode()=0
virtual void setMothers(std::vector< PhotosParticle * > mothers)=0
void createHistoryEntry()
void setDaughters(std::vector< PhotosParticle * > daughters)
friend F32vec4 fabs(const F32vec4 &a)
int getDaughterRangeEnd()
static ostream & Warning(bool count=true)
int getSecondMotherIndex()
void setMass(double mass)
void setMothers(std::vector< PhotosParticle * > mothers)
PhotosHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de)
static void Fatal(string text, unsigned short int code=0)
void setBarcode(int barcode)
void setDaughterRangeEnd(int i)
bool isDaughterOf(PhotosHEPEVTParticle *p)
vector< PhotosHEPEVTParticle * > cache
void createSelfDecayVertex(PhotosParticle *out)
virtual std::vector< PhotosParticle * > getMothers()=0
void setPdgID(int pdg_id)
void setParticle(int i, PhotosHEPEVTParticle *p)
static void RevertOutput()
void addDaughter(PhotosParticle *daughter)
void addParticle(PhotosHEPEVTParticle *p)
static void RedirectOutput(void(*func)(), ostream &where=*out)