Changeset View
Changeset View
Standalone View
Standalone View
src/LauResonanceMaker.cc
Show First 20 Lines • Show All 626 Lines • ▼ Show 20 Lines | |||||
LauBlattWeisskopfFactor* LauResonanceMaker::getParentBWFactor(Int_t resSpin, LauBlattWeisskopfFactor::BarrierType barrierType) | LauBlattWeisskopfFactor* LauResonanceMaker::getParentBWFactor(Int_t resSpin, LauBlattWeisskopfFactor::BarrierType barrierType) | ||||
{ | { | ||||
LauBlattWeisskopfFactor* bwFactor(0); | LauBlattWeisskopfFactor* bwFactor(0); | ||||
// Look up the category in the category information map | // Look up the category in the category information map | ||||
BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( LauBlattWeisskopfFactor::Parent ); | BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( LauBlattWeisskopfFactor::Parent ); | ||||
if ( factor_iter != bwFactors_.end() ) { | if ( factor_iter == bwFactors_.end() ) { | ||||
// If the category is currently undefined we need to create it | |||||
bwFactor = new LauBlattWeisskopfFactor( resSpin, 4.0, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent ); | |||||
std::cerr<<"WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"<<std::endl; | |||||
BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[LauBlattWeisskopfFactor::Parent]; | |||||
categoryInfo.bwFactor_ = bwFactor; | |||||
categoryInfo.defaultRadius_ = bwFactor->getRadiusParameter()->value(); | |||||
categoryInfo.radiusFixed_ = kTRUE; | |||||
} else { | |||||
// If it exists, we can check if the factor object has been created | // If it exists, we can check if the factor object has been created | ||||
BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second; | BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second; | ||||
if ( categoryInfo.bwFactor_ != 0 ) { | if ( categoryInfo.bwFactor_ != 0 ) { | ||||
// If so, simply clone it | // If so, simply clone it | ||||
bwFactor = categoryInfo.bwFactor_->createClone( resSpin, barrierType ); | bwFactor = categoryInfo.bwFactor_->createClone( resSpin, barrierType ); | ||||
} else { | |||||
// Otherwise we need to create it, using the default value if it has been set | |||||
if ( categoryInfo.defaultRadius_ >= 0.0 ) { | |||||
bwFactor = new LauBlattWeisskopfFactor( resSpin, categoryInfo.defaultRadius_, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent ); | |||||
} else { | |||||
bwFactor = new LauBlattWeisskopfFactor( resSpin, 4.0, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent ); | |||||
tlatham: Could here create it with some hard-coded default, e.g. 4.0, for the radius and print a warning… | |||||
Done Inline ActionsSure thing. Isn't Parent created by default in the constructor? johndan: Sure thing. Isn't `Parent` created by default in the constructor? | |||||
Done Inline ActionsIndeed, at the moment it is created on line 75. However, it's not impossible that that might be removed in future, so it seems prudent to handle the case where it isn't found. tlatham: Indeed, at the moment it is created on line 75. However, it's not impossible that that might… | |||||
std::cerr<<"WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"<<std::endl; | |||||
} | } | ||||
} | categoryInfo.bwFactor_ = bwFactor; | ||||
if ( bwFactor==0 ) { | // Set whether the radius should be fixed/floated | ||||
std::cerr<<"ERROR in LauResonanceMaker::getParentBWFactor : No parent Blatt-Weisskopf factor found to be cloned for K-matrix."<<std::endl; | LauParameter* radius = bwFactor->getRadiusParameter(); | ||||
radius->fixed( categoryInfo.radiusFixed_ ); | |||||
} | } | ||||
} | |||||
return bwFactor; | return bwFactor; | ||||
Done Inline ActionsI think this can be dropped now? tlatham: I think this can be dropped now?
Otherwise it all looks good to me :) | |||||
} | } | ||||
LauBlattWeisskopfFactor* LauResonanceMaker::getBWFactor( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const LauResonanceInfo* resInfo ) | LauBlattWeisskopfFactor* LauResonanceMaker::getBWFactor( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const LauResonanceInfo* resInfo ) | ||||
{ | { | ||||
LauBlattWeisskopfFactor* bwFactor(0); | LauBlattWeisskopfFactor* bwFactor(0); | ||||
// If this is an independent factor, create it and add it to the list of independent factors, then return it | // If this is an independent factor, create it and add it to the list of independent factors, then return it | ||||
if ( bwCategory == LauBlattWeisskopfFactor::Indep ) { | if ( bwCategory == LauBlattWeisskopfFactor::Indep ) { | ||||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |
Could here create it with some hard-coded default, e.g. 4.0, for the radius and print a warning that it's being created with such a default value, instead of an error that you can't create it at all.
Similarly, should probably handle the case that you don't find the Parent category in the category information map, cf. lines 677-684.