Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenBase/EvtParticle.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
EvtParticle::~EvtParticle() | EvtParticle::~EvtParticle() | ||||
{ | { | ||||
delete _decayProb; | delete _decayProb; | ||||
} | } | ||||
EvtParticle::EvtParticle() | EvtParticle::EvtParticle() | ||||
{ | { | ||||
_ndaug = 0; | _ndaug = 0; | ||||
_parent = 0; | _parent = nullptr; | ||||
_channel = -10; | _channel = -10; | ||||
_t = 0.0; | _t = 0.0; | ||||
_genlifetime = 1; | _genlifetime = 1; | ||||
_first = 1; | _first = 1; | ||||
_isInit = false; | _isInit = false; | ||||
_validP4 = false; | _validP4 = false; | ||||
_isDecayed = false; | _isDecayed = false; | ||||
_decayProb = 0; | _decayProb = nullptr; | ||||
_intAttributes.clear(); | _intAttributes.clear(); | ||||
_dblAttributes.clear(); | _dblAttributes.clear(); | ||||
// _mix=false; | // _mix=false; | ||||
} | } | ||||
void EvtParticle::setFirstOrNot() | void EvtParticle::setFirstOrNot() | ||||
{ | { | ||||
_first = 0; | _first = 0; | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void EvtParticle::initDecay( bool useMinMass ) | void EvtParticle::initDecay( bool useMinMass ) | ||||
{ | { | ||||
EvtParticle* p = this; | EvtParticle* p = this; | ||||
// carefull - the parent mass might be fixed in stone.. | // carefull - the parent mass might be fixed in stone.. | ||||
EvtParticle* par = p->getParent(); | EvtParticle* par = p->getParent(); | ||||
double parMass = -1.; | double parMass = -1.; | ||||
if ( par != 0 ) { | if ( par != nullptr ) { | ||||
if ( par->hasValidP4() ) | if ( par->hasValidP4() ) | ||||
parMass = par->mass(); | parMass = par->mass(); | ||||
for ( size_t i = 0; i < par->getNDaug(); i++ ) { | for ( size_t i = 0; i < par->getNDaug(); i++ ) { | ||||
EvtParticle* tDaug = par->getDaug( i ); | EvtParticle* tDaug = par->getDaug( i ); | ||||
if ( p != tDaug ) | if ( p != tDaug ) | ||||
parMass -= EvtPDL::getMinMass( tDaug->getId() ); | parMass -= EvtPDL::getMinMass( tDaug->getId() ); | ||||
} | } | ||||
} | } | ||||
if ( _isInit ) { | if ( _isInit ) { | ||||
//we have already been here - just reroll the masses! | //we have already been here - just reroll the masses! | ||||
if ( _ndaug > 0 ) { | if ( _ndaug > 0 ) { | ||||
for ( size_t ii = 0; ii < _ndaug; ii++ ) { | for ( size_t ii = 0; ii < _ndaug; ii++ ) { | ||||
if ( _ndaug == 1 || | if ( _ndaug == 1 || | ||||
EvtPDL::getWidth( p->getDaug( ii )->getId() ) > 0.0000001 ) | EvtPDL::getWidth( p->getDaug( ii )->getId() ) > 0.0000001 ) | ||||
p->getDaug( ii )->initDecay( useMinMass ); | p->getDaug( ii )->initDecay( useMinMass ); | ||||
else | else | ||||
p->getDaug( ii )->setMass( | p->getDaug( ii )->setMass( | ||||
EvtPDL::getMeanMass( p->getDaug( ii )->getId() ) ); | EvtPDL::getMeanMass( p->getDaug( ii )->getId() ) ); | ||||
} | } | ||||
} | } | ||||
EvtId* dauId = 0; | EvtId* dauId = nullptr; | ||||
double* dauMasses = 0; | double* dauMasses = nullptr; | ||||
if ( _ndaug > 0 ) { | if ( _ndaug > 0 ) { | ||||
dauId = new EvtId[_ndaug]; | dauId = new EvtId[_ndaug]; | ||||
dauMasses = new double[_ndaug]; | dauMasses = new double[_ndaug]; | ||||
for ( size_t j = 0; j < _ndaug; j++ ) { | for ( size_t j = 0; j < _ndaug; j++ ) { | ||||
dauId[j] = p->getDaug( j )->getId(); | dauId[j] = p->getDaug( j )->getId(); | ||||
dauMasses[j] = p->getDaug( j )->mass(); | dauMasses[j] = p->getDaug( j )->mass(); | ||||
} | } | ||||
} | } | ||||
EvtId* parId = 0; | EvtId* parId = nullptr; | ||||
EvtId* othDauId = 0; | EvtId* othDauId = nullptr; | ||||
EvtParticle* tempPar = p->getParent(); | EvtParticle* tempPar = p->getParent(); | ||||
if ( tempPar ) { | if ( tempPar ) { | ||||
parId = new EvtId( tempPar->getId() ); | parId = new EvtId( tempPar->getId() ); | ||||
if ( tempPar->getNDaug() == 2 ) { | if ( tempPar->getNDaug() == 2 ) { | ||||
if ( tempPar->getDaug( 0 ) == this ) | if ( tempPar->getDaug( 0 ) == this ) | ||||
othDauId = new EvtId( tempPar->getDaug( 1 )->getId() ); | othDauId = new EvtId( tempPar->getDaug( 1 )->getId() ); | ||||
else | else | ||||
othDauId = new EvtId( tempPar->getDaug( 0 )->getId() ); | othDauId = new EvtId( tempPar->getDaug( 0 )->getId() ); | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if ( decayer ) { | ||||
p->getDaug( i )->initDecay( useMinMass ); | p->getDaug( i )->initDecay( useMinMass ); | ||||
else | else | ||||
p->getDaug( i )->setMass( | p->getDaug( i )->setMass( | ||||
EvtPDL::getMeanMass( p->getDaug( i )->getId() ) ); | EvtPDL::getMeanMass( p->getDaug( i )->getId() ) ); | ||||
} | } | ||||
} | } | ||||
int j; | int j; | ||||
EvtId* dauId = 0; | EvtId* dauId = nullptr; | ||||
double* dauMasses = 0; | double* dauMasses = nullptr; | ||||
int nDaugT = p->getNDaug(); | int nDaugT = p->getNDaug(); | ||||
if ( nDaugT > 0 ) { | if ( nDaugT > 0 ) { | ||||
dauId = new EvtId[nDaugT]; | dauId = new EvtId[nDaugT]; | ||||
dauMasses = new double[nDaugT]; | dauMasses = new double[nDaugT]; | ||||
for ( j = 0; j < nDaugT; j++ ) { | for ( j = 0; j < nDaugT; j++ ) { | ||||
dauId[j] = p->getDaug( j )->getId(); | dauId[j] = p->getDaug( j )->getId(); | ||||
dauMasses[j] = p->getDaug( j )->mass(); | dauMasses[j] = p->getDaug( j )->mass(); | ||||
} | } | ||||
} | } | ||||
EvtId* parId = 0; | EvtId* parId = nullptr; | ||||
EvtId* othDauId = 0; | EvtId* othDauId = nullptr; | ||||
EvtParticle* tempPar = p->getParent(); | EvtParticle* tempPar = p->getParent(); | ||||
if ( tempPar ) { | if ( tempPar ) { | ||||
parId = new EvtId( tempPar->getId() ); | parId = new EvtId( tempPar->getId() ); | ||||
if ( tempPar->getNDaug() == 2 ) { | if ( tempPar->getNDaug() == 2 ) { | ||||
if ( tempPar->getDaug( 0 ) == this ) | if ( tempPar->getDaug( 0 ) == this ) | ||||
othDauId = new EvtId( tempPar->getDaug( 1 )->getId() ); | othDauId = new EvtId( tempPar->getDaug( 1 )->getId() ); | ||||
else | else | ||||
othDauId = new EvtId( tempPar->getDaug( 0 )->getId() ); | othDauId = new EvtId( tempPar->getDaug( 0 )->getId() ); | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | void EvtParticle::decay() | ||||
// remove D0 mixing for now.. | // remove D0 mixing for now.. | ||||
// if ( _ndaug==1 && (thisId==BS0||thisId==BSB||thisId==BD0||thisId==BDB||thisId==D0||thisId==D0B) ) { | // if ( _ndaug==1 && (thisId==BS0||thisId==BSB||thisId==BD0||thisId==BDB||thisId==D0||thisId==D0B) ) { | ||||
if ( _ndaug == 1 && | if ( _ndaug == 1 && | ||||
( thisId == BS0 || thisId == BSB || thisId == BD0 || thisId == BDB ) ) { | ( thisId == BS0 || thisId == BSB || thisId == BD0 || thisId == BDB ) ) { | ||||
p = p->getDaug( 0 ); | p = p->getDaug( 0 ); | ||||
decayer = EvtDecayTable::getInstance()->getDecayFunc( p ); | decayer = EvtDecayTable::getInstance()->getDecayFunc( p ); | ||||
} | } | ||||
//now we have accepted a set of masses - time | //now we have accepted a set of masses - time | ||||
if ( decayer != 0 ) { | if ( decayer != nullptr ) { | ||||
decayer->makeDecay( p ); | decayer->makeDecay( p ); | ||||
} else { | } else { | ||||
p->_rhoBackward.setDiag( p->getSpinStates() ); | p->_rhoBackward.setDiag( p->getSpinStates() ); | ||||
} | } | ||||
_isDecayed = true; | _isDecayed = true; | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | double EvtParticle::compMassProb() | ||||
EvtParticle* p = this; | EvtParticle* p = this; | ||||
double mass = p->mass(); | double mass = p->mass(); | ||||
double parMass = 0.; | double parMass = 0.; | ||||
if ( p->getParent() ) { | if ( p->getParent() ) { | ||||
parMass = p->getParent()->mass(); | parMass = p->getParent()->mass(); | ||||
} | } | ||||
int nDaug = p->getNDaug(); | int nDaug = p->getNDaug(); | ||||
double* dMasses = 0; | double* dMasses = nullptr; | ||||
int i; | int i; | ||||
if ( nDaug > 0 ) { | if ( nDaug > 0 ) { | ||||
dMasses = new double[nDaug]; | dMasses = new double[nDaug]; | ||||
for ( i = 0; i < nDaug; i++ ) | for ( i = 0; i < nDaug; i++ ) | ||||
dMasses[i] = p->getDaug( i )->mass(); | dMasses[i] = p->getDaug( i )->mass(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
EvtVector4R EvtParticle::getP4Lab() const | EvtVector4R EvtParticle::getP4Lab() const | ||||
{ | { | ||||
EvtVector4R temp, mom; | EvtVector4R temp, mom; | ||||
const EvtParticle* ptemp; | const EvtParticle* ptemp; | ||||
temp = this->getP4(); | temp = this->getP4(); | ||||
ptemp = this; | ptemp = this; | ||||
while ( ptemp->getParent() != 0 ) { | while ( ptemp->getParent() != nullptr ) { | ||||
ptemp = ptemp->getParent(); | ptemp = ptemp->getParent(); | ||||
mom = ptemp->getP4(); | mom = ptemp->getP4(); | ||||
temp = boostTo( temp, mom ); | temp = boostTo( temp, mom ); | ||||
} | } | ||||
return temp; | return temp; | ||||
} | } | ||||
EvtVector4R EvtParticle::getP4LabBeforeFSR() | EvtVector4R EvtParticle::getP4LabBeforeFSR() | ||||
{ | { | ||||
EvtVector4R temp, mom; | EvtVector4R temp, mom; | ||||
EvtParticle* ptemp; | EvtParticle* ptemp; | ||||
temp = this->_pBeforeFSR; | temp = this->_pBeforeFSR; | ||||
ptemp = this; | ptemp = this; | ||||
while ( ptemp->getParent() != 0 ) { | while ( ptemp->getParent() != nullptr ) { | ||||
ptemp = ptemp->getParent(); | ptemp = ptemp->getParent(); | ||||
mom = ptemp->getP4(); | mom = ptemp->getP4(); | ||||
temp = boostTo( temp, mom ); | temp = boostTo( temp, mom ); | ||||
} | } | ||||
return temp; | return temp; | ||||
} | } | ||||
EvtVector4R EvtParticle::getP4Restframe() const | EvtVector4R EvtParticle::getP4Restframe() const | ||||
{ | { | ||||
return EvtVector4R( mass(), 0.0, 0.0, 0.0 ); | return EvtVector4R( mass(), 0.0, 0.0, 0.0 ); | ||||
} | } | ||||
EvtVector4R EvtParticle::get4Pos() const | EvtVector4R EvtParticle::get4Pos() const | ||||
{ | { | ||||
EvtVector4R temp, mom; | EvtVector4R temp, mom; | ||||
EvtParticle* ptemp; | EvtParticle* ptemp; | ||||
temp.set( 0.0, 0.0, 0.0, 0.0 ); | temp.set( 0.0, 0.0, 0.0, 0.0 ); | ||||
ptemp = getParent(); | ptemp = getParent(); | ||||
if ( ptemp == 0 ) | if ( ptemp == nullptr ) | ||||
return temp; | return temp; | ||||
temp = ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); | temp = ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); | ||||
while ( ptemp->getParent() != 0 ) { | while ( ptemp->getParent() != nullptr ) { | ||||
ptemp = ptemp->getParent(); | ptemp = ptemp->getParent(); | ||||
mom = ptemp->getP4(); | mom = ptemp->getP4(); | ||||
temp = boostTo( temp, mom ); | temp = boostTo( temp, mom ); | ||||
temp = temp + ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); | temp = temp + ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); | ||||
} | } | ||||
return temp; | return temp; | ||||
} | } | ||||
EvtParticle* EvtParticle::nextIter( EvtParticle* rootOfTree ) | EvtParticle* EvtParticle::nextIter( EvtParticle* rootOfTree ) | ||||
{ | { | ||||
EvtParticle* bpart; | EvtParticle* bpart; | ||||
EvtParticle* current; | EvtParticle* current; | ||||
current = this; | current = this; | ||||
size_t i; | size_t i; | ||||
if ( _ndaug != 0 ) | if ( _ndaug != 0 ) | ||||
return _daug[0]; | return _daug[0]; | ||||
do { | do { | ||||
bpart = current->_parent; | bpart = current->_parent; | ||||
if ( bpart == 0 ) | if ( bpart == nullptr ) | ||||
return 0; | return nullptr; | ||||
i = 0; | i = 0; | ||||
while ( bpart->_daug[i] != current ) { | while ( bpart->_daug[i] != current ) { | ||||
i++; | i++; | ||||
} | } | ||||
if ( bpart == rootOfTree ) { | if ( bpart == rootOfTree ) { | ||||
if ( i + 1 == bpart->_ndaug ) | if ( i + 1 == bpart->_ndaug ) | ||||
return 0; | return nullptr; | ||||
} | } | ||||
i++; | i++; | ||||
current = bpart; | current = bpart; | ||||
} while ( i >= bpart->_ndaug ); | } while ( i >= bpart->_ndaug ); | ||||
return bpart->_daug[i]; | return bpart->_daug[i]; | ||||
▲ Show 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | if ( _ndaug != 0 ) { | ||||
pdaug->addDaug( this ); | pdaug->addDaug( this ); | ||||
} | } | ||||
} //else | } //else | ||||
} //makeDaughters | } //makeDaughters | ||||
void EvtParticle::setDecayProb( double prob ) | void EvtParticle::setDecayProb( double prob ) | ||||
{ | { | ||||
if ( _decayProb == 0 ) | if ( _decayProb == nullptr ) | ||||
_decayProb = new double; | _decayProb = new double; | ||||
*_decayProb = prob; | *_decayProb = prob; | ||||
} | } | ||||
std::string EvtParticle::getName() const | std::string EvtParticle::getName() const | ||||
{ | { | ||||
std::string theName = _id.getName(); | std::string theName = _id.getName(); | ||||
return theName; | return theName; | ||||
Show All 33 Lines |