1 #include "TauolaHEPEVTEvent.h"
8 TauolaHEPEVTEvent::~TauolaHEPEVTEvent()
10 for(unsigned int i=0;i<particle_list.size();i++) delete particle_list[i];
13 TauolaHEPEVTEvent::TauolaHEPEVTEvent() {}
15 void TauolaHEPEVTEvent::addParticle(TauolaHEPEVTParticle *p)
19 p->setBarcode(particle_list.size());
20 particle_list.push_back(p);
23 TauolaHEPEVTParticle *TauolaHEPEVTEvent::getParticle(int i)
25 if( i<0 || i>=(int)particle_list.size() ) return NULL;
26 return particle_list[i];
29 int TauolaHEPEVTEvent::getParticleCount()
31 return particle_list.size();
34 // we have conflict in names, looks for -pdg_id also...
35 std::vector<TauolaParticle*> TauolaHEPEVTEvent::findParticles(int pdg_id){
37 std::vector<TauolaParticle*> list;
39 // Loop over all particles in the event looking
40 // for tau (or other) particle with specified pdg_id and -pdg_id
41 for(unsigned int i=0; i<particle_list.size(); i++)
43 if( abs(particle_list[i]->getPdgID() ) == pdg_id)
44 list.push_back(particle_list[i]);
50 // we have conflict in names, should be findStableTaus or have another argument.
51 std::vector<TauolaParticle*> TauolaHEPEVTEvent::findStableParticles(int pdg_id){
53 std::vector<TauolaParticle*> tau_list = findParticles(pdg_id);
54 std::vector<TauolaParticle*> stable_tau_list;
56 for(int i=0; i<(int) tau_list.size(); i++){
58 if(!tau_list.at(i)->hasDaughters())
59 stable_tau_list.push_back(tau_list[i]);
62 std::vector<TauolaParticle*> t = tau_list[i]->getDaughters();
63 //Ignore taus that we won't be decaying anyway
64 if(t.size()==1) continue;
65 if(t.size()==2 && (abs(t[0]->getPdgID())==15 || abs(t[1]->getPdgID())==15) ) continue;
66 Log::Warning()<<"Particle with pdg code "<<tau_list.at(i)->getPdgID()
67 <<" already has daughters" <<endl;
71 return stable_tau_list;
75 void TauolaHEPEVTEvent::print()
77 printf("TauolaHEPEVTEvent\n-----------------\n");
78 for(unsigned int i=0;i<particle_list.size();i++) particle_list[i]->print();
81 void TauolaHEPEVTEvent::clear()
83 for(unsigned int i=0;i<particle_list.size();i++) delete particle_list[i];
84 particle_list.clear();
87 #ifdef USE_HEPEVT_INTERFACE
89 void TauolaHEPEVTEvent::read_event_from_HEPEVT(TauolaHEPEVTEvent *evt)
93 for(int i=0; i<hepevt_.nhep; i++)
95 TauolaHEPEVTParticle *p = new TauolaHEPEVTParticle
104 hepevt_.jmohep[i][0]-1,
105 hepevt_.jmohep[i][1]-1,
106 hepevt_.jdahep[i][0]-1,
107 hepevt_.jdahep[i][1]-1
113 void TauolaHEPEVTEvent::write_event_to_HEPEVT(TauolaHEPEVTEvent *evt)
115 if(evt==NULL) return;
117 hepevt_.nhep = evt->getParticleCount();
119 for(int i=0; i<hepevt_.nhep; i++)
121 TauolaHEPEVTParticle *p = evt->getParticle(i);
123 hepevt_.idhep [i] =p->getPdgID();
124 hepevt_.isthep[i] =p->getStatus();
125 hepevt_.phep [i][0]=p->getPx();
126 hepevt_.phep [i][1]=p->getPy();
127 hepevt_.phep [i][2]=p->getPz();
128 hepevt_.phep [i][3]=p->getE();
129 hepevt_.phep [i][4]=p->getMass();
130 hepevt_.jmohep[i][0]=p->getFirstMotherIndex() +1;
131 hepevt_.jmohep[i][1]=p->getSecondMotherIndex() +1;
132 hepevt_.jdahep[i][0]=p->getDaughterRangeStart()+1;
133 hepevt_.jdahep[i][1]=p->getDaughterRangeEnd() +1;
134 hepevt_.vhep [i][0]=0.0;
135 hepevt_.vhep [i][1]=0.0;
136 hepevt_.vhep [i][2]=0.0;
137 hepevt_.vhep [i][3]=0.0;
143 } // namespace Tauolapp