Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenBase/EvtParticleDecayList.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
EvtParticleDecayList::~EvtParticleDecayList() | EvtParticleDecayList::~EvtParticleDecayList() | ||||
{ | { | ||||
int i; | int i; | ||||
for ( i = 0; i < _nmode; i++ ) { | for ( i = 0; i < _nmode; i++ ) { | ||||
delete _decaylist[i]; | delete _decaylist[i]; | ||||
} | } | ||||
if ( _decaylist != 0 ) | if ( _decaylist != nullptr ) | ||||
delete[] _decaylist; | delete[] _decaylist; | ||||
} | } | ||||
void EvtParticleDecayList::printSummary() | void EvtParticleDecayList::printSummary() | ||||
{ | { | ||||
int i; | int i; | ||||
for ( i = 0; i < _nmode; i++ ) { | for ( i = 0; i < _nmode; i++ ) { | ||||
_decaylist[i]->printSummary(); | _decaylist[i]->printSummary(); | ||||
} | } | ||||
} | } | ||||
void EvtParticleDecayList::removeDecay() | void EvtParticleDecayList::removeDecay() | ||||
{ | { | ||||
int i; | int i; | ||||
for ( i = 0; i < _nmode; i++ ) { | for ( i = 0; i < _nmode; i++ ) { | ||||
delete _decaylist[i]; | delete _decaylist[i]; | ||||
} | } | ||||
delete[] _decaylist; | delete[] _decaylist; | ||||
_decaylist = 0; | _decaylist = nullptr; | ||||
_nmode = 0; | _nmode = 0; | ||||
_rawbrfrsum = 0.0; | _rawbrfrsum = 0.0; | ||||
} | } | ||||
EvtDecayBase* EvtParticleDecayList::getDecayModel( int imode ) | EvtDecayBase* EvtParticleDecayList::getDecayModel( int imode ) | ||||
{ | { | ||||
EvtDecayBase* theModel( 0 ); | EvtDecayBase* theModel( nullptr ); | ||||
if ( imode >= 0 && imode < _nmode ) { | if ( imode >= 0 && imode < _nmode ) { | ||||
EvtParticleDecay* theDecay = _decaylist[imode]; | EvtParticleDecay* theDecay = _decaylist[imode]; | ||||
if ( theDecay != 0 ) { | if ( theDecay != nullptr ) { | ||||
theModel = theDecay->getDecayModel(); | theModel = theDecay->getDecayModel(); | ||||
} | } | ||||
} | } | ||||
return theModel; | return theModel; | ||||
} | } | ||||
EvtDecayBase* EvtParticleDecayList::getDecayModel( EvtParticle* p ) | EvtDecayBase* EvtParticleDecayList::getDecayModel( EvtParticle* p ) | ||||
{ | { | ||||
if ( p->getNDaug() != 0 ) { | if ( p->getNDaug() != 0 ) { | ||||
assert( p->getChannel() >= 0 ); | assert( p->getChannel() >= 0 ); | ||||
return getDecay( p->getChannel() ).getDecayModel(); | return getDecay( p->getChannel() ).getDecayModel(); | ||||
} | } | ||||
if ( p->getChannel() > ( -1 ) ) { | if ( p->getChannel() > ( -1 ) ) { | ||||
return getDecay( p->getChannel() ).getDecayModel(); | return getDecay( p->getChannel() ).getDecayModel(); | ||||
} | } | ||||
if ( getNMode() == 0 ) { | if ( getNMode() == 0 ) { | ||||
return 0; | return nullptr; | ||||
} | } | ||||
if ( getRawBrfrSum() < 0.00000001 ) { | if ( getRawBrfrSum() < 0.00000001 ) { | ||||
return 0; | return nullptr; | ||||
} | } | ||||
if ( getNMode() == 1 ) { | if ( getNMode() == 1 ) { | ||||
p->setChannel( 0 ); | p->setChannel( 0 ); | ||||
return getDecay( 0 ).getDecayModel(); | return getDecay( 0 ).getDecayModel(); | ||||
} | } | ||||
if ( p->getChannel() > ( -1 ) ) { | if ( p->getChannel() > ( -1 ) ) { | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | for ( i = 0; i < getNMode(); i++ ) { | ||||
previousBrSum = getDecay( i ).getBrfrSum(); | previousBrSum = getDecay( i ).getBrfrSum(); | ||||
} | } | ||||
EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | ||||
<< "Could not decay:" << EvtPDL::name( p->getId() ).c_str() | << "Could not decay:" << EvtPDL::name( p->getId() ).c_str() | ||||
<< " with mass:" << p->mass() << " will throw event away! " << endl; | << " with mass:" << p->mass() << " will throw event away! " << endl; | ||||
EvtStatus::setRejectFlag(); | EvtStatus::setRejectFlag(); | ||||
return 0; | return nullptr; | ||||
} | } | ||||
void EvtParticleDecayList::setNMode( int nmode ) | void EvtParticleDecayList::setNMode( int nmode ) | ||||
{ | { | ||||
EvtParticleDecayPtr* _decaylist_new = new EvtParticleDecayPtr[nmode]; | EvtParticleDecayPtr* _decaylist_new = new EvtParticleDecayPtr[nmode]; | ||||
if ( _nmode != 0 ) { | if ( _nmode != 0 ) { | ||||
EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | ||||
<< "Error _nmode not equal to zero!!!" << endl; | << "Error _nmode not equal to zero!!!" << endl; | ||||
::abort(); | ::abort(); | ||||
} | } | ||||
if ( _decaylist != 0 ) { | if ( _decaylist != nullptr ) { | ||||
delete[] _decaylist; | delete[] _decaylist; | ||||
} | } | ||||
_decaylist = _decaylist_new; | _decaylist = _decaylist_new; | ||||
_nmode = nmode; | _nmode = nmode; | ||||
} | } | ||||
EvtParticleDecay& EvtParticleDecayList::getDecay( int nchannel ) const | EvtParticleDecay& EvtParticleDecayList::getDecay( int nchannel ) const | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | for ( i = 0; i < _nmode; i++ ) { | ||||
assert( 0 ); | assert( 0 ); | ||||
} | } | ||||
} | } | ||||
if ( _nmode != 0 ) { | if ( _nmode != 0 ) { | ||||
delete[] _decaylist; | delete[] _decaylist; | ||||
} | } | ||||
if ( ( _nmode == 0 ) && ( _decaylist != 0 ) ) | if ( ( _nmode == 0 ) && ( _decaylist != nullptr ) ) | ||||
delete[] _decaylist; | delete[] _decaylist; | ||||
_nmode++; | _nmode++; | ||||
_decaylist = newlist; | _decaylist = newlist; | ||||
} | } | ||||
void EvtParticleDecayList::finalize() | void EvtParticleDecayList::finalize() | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |