1 #include "TauolaHepMCParticle.h"
11 TauolaHepMCParticle::~TauolaHepMCParticle(){
14 while(m_mothers.size()!=0){
19 while(m_daughters.size()!=0){
21 m_daughters.pop_back();
25 while(m_created_particles.size()!=0){
27 m_created_particles.pop_back();
28 if(temp->getHepMC()->barcode()==0)
delete temp->getHepMC();
43 m_particle = particle;
52 std::vector<TauolaParticle*>::iterator dIter = daughters.begin();
54 for(; dIter != daughters.end(); dIter++)
70 for(
unsigned int i=0;i<daughters.size();i++)
91 if(!production_vertex){
99 vector<TauolaParticle*>::iterator mother_itr;
100 for(mother_itr = mothers.begin(); mother_itr != mothers.end();
106 if(moth->
end_vertex()!=orig_production_vertex)
107 Log::Fatal(
"Mother production_vertices point to difference places. Can not override. Please delete vertices first.",1);
122 Log::Fatal(
"New particle needs the event set before it's daughters can be added",2);
125 if(daughters.size()>0){
143 vector<TauolaParticle*>::iterator daughter_itr;
144 for(daughter_itr = daughters.begin(); daughter_itr != daughters.end();
152 Log::Fatal(
"Daughter production_vertices point to difference places. Can not override. Please delete vertices first.",3);
169 for(;pcle_itr != pcle_itr_end; pcle_itr++){
178 if(m_daughters.size()==0&&m_particle->
end_vertex()){
185 for(;pcle_itr != pcle_itr_end; pcle_itr++){
199 double sumpx = 0, sumpy = 0, sumpz = 0, sume = 0;
203 sumpx += (*part1)->momentum().px();
204 sumpy += (*part1)->momentum().py();
205 sumpz += (*part1)->momentum().pz();
206 sume += (*part1)->momentum().e();
212 sumpx -= (*part2)->momentum().px();
213 sumpy -= (*part2)->momentum().py();
214 sumpz -= (*part2)->momentum().pz();
215 sume -= (*part2)->momentum().e();
218 if( sqrt( sumpx*sumpx + sumpy*sumpy + sumpz*sumpz + sume*sume) > Tauola::momentum_conservation_threshold ) {
219 Log::Warning()<<
"Momentum not conserved in the vertex:"<<endl;
244 return m_particle->
pdg_id();
248 return m_particle->
status();
258 double lifetime = Tauola::tau_lifetime * (-log( Tauola::randomDouble() ));
261 double mass = sqrt(abs( tau_momentum.e()*tau_momentum.e()
262 - tau_momentum.px()*tau_momentum.px()
263 - tau_momentum.py()*tau_momentum.py()
264 - tau_momentum.pz()*tau_momentum.pz()
272 previous_position.
y()+tau_momentum.py()/mass*lifetime,
273 previous_position.
z()+tau_momentum.pz()/mass*lifetime,
274 previous_position.
t()+tau_momentum.e() /mass*lifetime);
278 recursiveSetPosition(m_particle,new_position);
289 if( !(*pp)->end_vertex() )
continue;
292 (*pp)->end_vertex()->set_position(pos);
293 recursiveSetPosition(*pp,pos);
298 int pdg_id,
int status,
double mass,
299 double px,
double py,
double pz,
double e){
309 m_created_particles.push_back(new_particle);
GenEvent * parent_event() const
pointer to the event that owns this particle
void set_generated_mass(const double &m)
define the actual generated mass
int pdg_id() const
particle ID
double z() const
return z
std::vector< HepMC::GenParticle * >::const_iterator particles_in_const_iterator
const iterator for incoming particles
void set_status(int status=0)
set decay status
void setMass(double mass)
GenParticle * remove_particle(GenParticle *particle)
remove a particle
Interface to HepMC::GenParticle objects.
void print(std::ostream &ostr=std::cout) const
print vertex information
void add_particle_in(GenParticle *inparticle)
add incoming particle
int barcode() const
particle barcode
particles_out_const_iterator particles_out_const_end() const
end iteration of outgoing particles
std::vector< HepMC::GenParticle * >::const_iterator particles_out_const_iterator
const iterator for outgoing particles
void setDaughters(std::vector< TauolaParticle * > daughters)
double e() const
return E
Abstract base class for particle in the event. This class also handles boosting.
static void RedirectOutput(void(*func)(), ostream &where=*out)
double y() const
return y
void set_position(const FourVector &position=FourVector(0, 0, 0, 0))
set vertex position and time
double px() const
return px
GenVertex * production_vertex() const
pointer to the production vertex
GenVertex contains information about decay vertices.
std::vector< TauolaParticle * > getMothers()
void checkMomentumConservation()
double pz() const
return pz
void add_particle_out(GenParticle *outparticle)
add outgoing particle
particles_in_const_iterator particles_in_const_end() const
end iteration of incoming particles
bool add_vertex(GenVertex *vtx)
adds to evt and adopts
void setStatus(int statu)
int status() const
HEPEVT decay status.
HepMC::GenParticle * getHepMC()
double x() const
return x
static void Fatal(string text, unsigned short int code=0)
int particles_out_size() const
number of outgoing particles
particles_out_const_iterator particles_out_const_begin() const
begin iteration of outgoing particles
void set_momentum(const FourVector &vec4)
set standard 4 momentum
const FourVector & position() const
vertex position and time
void print(std::ostream &ostr=std::cout) const
dump this particle's full info to ostr
const FourVector & momentum() const
standard 4 momentum
FourVector is a simple representation of a physics 4 vector.
GenVertex * end_vertex() const
pointer to the decay vertex
TauolaHepMCParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
void set_pdg_id(int id)
set particle ID
double py() const
return py
particles_in_const_iterator particles_in_const_begin() const
begin iteration of incoming particles
std::vector< TauolaParticle * > getDaughters()
void setPdgID(int pdg_id)
double t() const
return t
void setMothers(std::vector< TauolaParticle * > mothers)
static void RevertOutput()
The GenParticle class contains information about generated particles.