Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenExternal/EvtPhotosEngine.cpp
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool EvtPhotosEngine::doDecay( EvtParticle* theMother ) | bool EvtPhotosEngine::doDecay( EvtParticle* theMother ) | ||||
{ | { | ||||
if ( _initialised == false ) { | if ( _initialised == false ) { | ||||
this->initialise(); | this->initialise(); | ||||
} | } | ||||
if ( theMother == 0 ) { | if ( theMother == nullptr ) { | ||||
return false; | return false; | ||||
} | } | ||||
// Create a dummy HepMC GenEvent containing a single vertex, with the mother | // Create a dummy HepMC GenEvent containing a single vertex, with the mother | ||||
// assigned as the incoming particle and its daughters as outgoing particles. | // assigned as the incoming particle and its daughters as outgoing particles. | ||||
// We then pass this event to Photos for processing. | // We then pass this event to Photos for processing. | ||||
// It will return a modified version of the event, updating the momentum of | // It will return a modified version of the event, updating the momentum of | ||||
// the original particles and will contain any new photon particles. | // the original particles and will contain any new photon particles. | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | #else | ||||
// Get the next HepMC GenParticle | // Get the next HepMC GenParticle | ||||
HepMC::GenParticle* outParticle = *outIter; | HepMC::GenParticle* outParticle = *outIter; | ||||
#endif | #endif | ||||
// Get the three-momentum Photos result for this particle, and the PDG id | // Get the three-momentum Photos result for this particle, and the PDG id | ||||
double px( 0.0 ), py( 0.0 ), pz( 0.0 ); | double px( 0.0 ), py( 0.0 ), pz( 0.0 ); | ||||
int pdgId( 0 ); | int pdgId( 0 ); | ||||
if ( outParticle != 0 ) { | if ( outParticle != nullptr ) { | ||||
FourVector HepMCP4 = outParticle->momentum(); | FourVector HepMCP4 = outParticle->momentum(); | ||||
px = HepMCP4.px(); | px = HepMCP4.px(); | ||||
py = HepMCP4.py(); | py = HepMCP4.py(); | ||||
pz = HepMCP4.pz(); | pz = HepMCP4.pz(); | ||||
pdgId = outParticle->pdg_id(); | pdgId = outParticle->pdg_id(); | ||||
} | } | ||||
// Create an empty 4-momentum vector for the new/modified daughters | // Create an empty 4-momentum vector for the new/modified daughters | ||||
EvtVector4R newP4; | EvtVector4R newP4; | ||||
if ( iLoop < nDaug ) { | if ( iLoop < nDaug ) { | ||||
// Original daughters | // Original daughters | ||||
EvtParticle* daugParticle = theMother->getDaug( iLoop ); | EvtParticle* daugParticle = theMother->getDaug( iLoop ); | ||||
if ( daugParticle != 0 ) { | if ( daugParticle != nullptr ) { | ||||
// Keep the original particle mass, but set the three-momentum | // Keep the original particle mass, but set the three-momentum | ||||
// according to what Photos has modified. However, this will | // according to what Photos has modified. However, this will | ||||
// violate energy conservation (from what Photos has provided). | // violate energy conservation (from what Photos has provided). | ||||
double mass = daugParticle->mass(); | double mass = daugParticle->mass(); | ||||
double energy = sqrt( mass * mass + px * px + py * py + | double energy = sqrt( mass * mass + px * px + py * py + | ||||
pz * pz ); | pz * pz ); | ||||
newP4.set( energy, px, py, pz ); | newP4.set( energy, px, py, pz ); | ||||
// Set the new four-momentum (FSR applied) | // Set the new four-momentum (FSR applied) | ||||
Show All 28 Lines | #endif | ||||
return true; | return true; | ||||
} | } | ||||
GenParticlePtr EvtPhotosEngine::createGenParticle( EvtParticle* theParticle, | GenParticlePtr EvtPhotosEngine::createGenParticle( EvtParticle* theParticle, | ||||
bool incoming ) | bool incoming ) | ||||
{ | { | ||||
// 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( 0.0, 0.0, 0.0, 0.0 ); | EvtVector4R p4( 0.0, 0.0, 0.0, 0.0 ); | ||||
if ( incoming == true ) { | if ( incoming == true ) { | ||||
p4 = theParticle->getP4Restframe(); | p4 = theParticle->getP4Restframe(); | ||||
} else { | } else { | ||||
Show All 40 Lines | #else | ||||
for ( outIter = theVertex->particles_out_const_begin(); | for ( outIter = theVertex->particles_out_const_begin(); | ||||
outIter != theVertex->particles_out_const_end(); ++outIter ) { | outIter != theVertex->particles_out_const_end(); ++outIter ) { | ||||
// Get the next HepMC GenParticle | // Get the next HepMC GenParticle | ||||
HepMC::GenParticle* outParticle = *outIter; | HepMC::GenParticle* outParticle = *outIter; | ||||
#endif | #endif | ||||
// Get the PDG id | // Get the PDG id | ||||
int pdgId( 0 ); | int pdgId( 0 ); | ||||
if ( outParticle != 0 ) { | if ( outParticle != nullptr ) { | ||||
pdgId = outParticle->pdg_id(); | pdgId = outParticle->pdg_id(); | ||||
} | } | ||||
// Keep track of how many photons there are | // Keep track of how many photons there are | ||||
if ( pdgId == _gammaPDG ) { | if ( pdgId == _gammaPDG ) { | ||||
nPhotons++; | nPhotons++; | ||||
} | } | ||||
} | } | ||||
return nPhotons; | return nPhotons; | ||||
} | } | ||||
#endif | #endif |