Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenExternal/EvtTauolaEngine.cpp
Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool EvtTauolaEngine::doDecay( EvtParticle* tauParticle ) | bool EvtTauolaEngine::doDecay( EvtParticle* tauParticle ) | ||||
{ | { | ||||
if ( _initialised == false ) { | if ( _initialised == false ) { | ||||
this->initialise(); | this->initialise(); | ||||
} | } | ||||
if ( tauParticle == 0 ) { | if ( tauParticle == nullptr ) { | ||||
return false; | return false; | ||||
} | } | ||||
// Check that we have a tau particle. | // Check that we have a tau particle. | ||||
EvtId partId = tauParticle->getId(); | EvtId partId = tauParticle->getId(); | ||||
if ( abs( EvtPDL::getStdHep( partId ) ) != _tauPDG ) { | if ( abs( EvtPDL::getStdHep( partId ) ) != _tauPDG ) { | ||||
return false; | return false; | ||||
} | } | ||||
Show All 26 Lines | void EvtTauolaEngine::decayTauEvent( EvtParticle* tauParticle ) | ||||
auto theEvent = std::make_unique<GenEvent>( Units::GEV, Units::MM ); | auto theEvent = std::make_unique<GenEvent>( Units::GEV, Units::MM ); | ||||
// Create the decay "vertex". | // Create the decay "vertex". | ||||
GenVertexPtr theVertex = newGenVertexPtr(); | GenVertexPtr theVertex = newGenVertexPtr(); | ||||
theEvent->add_vertex( theVertex ); | theEvent->add_vertex( theVertex ); | ||||
// Get the parent of this tau particle | // Get the parent of this tau particle | ||||
EvtParticle* theParent = tauParticle->getParent(); | EvtParticle* theParent = tauParticle->getParent(); | ||||
GenParticlePtr hepMCParent( 0 ); | GenParticlePtr hepMCParent( nullptr ); | ||||
// Assign the parent particle as the incoming particle to the vertex. | // Assign the parent particle as the incoming particle to the vertex. | ||||
if ( theParent ) { | if ( theParent ) { | ||||
hepMCParent = this->createGenParticle( theParent ); | hepMCParent = this->createGenParticle( theParent ); | ||||
theVertex->add_particle_in( hepMCParent ); | theVertex->add_particle_in( hepMCParent ); | ||||
} else { | } else { | ||||
// The tau particle has no parent. Set "itself" as the incoming particle for the first vertex. | // The tau particle has no parent. Set "itself" as the incoming particle for the first vertex. | ||||
// This is needed, otherwise Tauola warns of momentum non-conservation for this (1st) vertex. | // This is needed, otherwise Tauola warns of momentum non-conservation for this (1st) vertex. | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
theEvent->clear(); | theEvent->clear(); | ||||
} | } | ||||
GenParticlePtr EvtTauolaEngine::createGenParticle( EvtParticle* theParticle ) | GenParticlePtr EvtTauolaEngine::createGenParticle( EvtParticle* theParticle ) | ||||
{ | { | ||||
// Method to create an HepMC::GenParticle version of the given EvtParticle. | // Method to create an HepMC::GenParticle version of the given EvtParticle. | ||||
if ( theParticle == 0 ) { | if ( theParticle == nullptr ) { | ||||
return 0; | return nullptr; | ||||
} | } | ||||
// Get the 4-momentum (E, px, py, pz) for the EvtParticle | // Get the 4-momentum (E, px, py, pz) for the EvtParticle | ||||
EvtVector4R p4 = theParticle->getP4Lab(); | EvtVector4R p4 = theParticle->getP4Lab(); | ||||
// Convert this to the HepMC 4-momentum | // Convert this to the HepMC 4-momentum | ||||
double E = p4.get( 0 ); | double E = p4.get( 0 ); | ||||
double px = p4.get( 1 ); | double px = p4.get( 1 ); | ||||
Show All 16 Lines |