diff --git a/PwaUtils/AbsXdecAmp.cc b/PwaUtils/AbsXdecAmp.cc index 8fdcf0de30fdb8aa3b51d6be8122b6cbc7017e63..5d3b92f0fd73620a8e58460be6a3bc2f6e103863 100644 --- a/PwaUtils/AbsXdecAmp.cc +++ b/PwaUtils/AbsXdecAmp.cc @@ -64,6 +64,7 @@ AbsXdecAmp::AbsXdecAmp(std::shared_ptr<AbsDecay> theDec, ChannelID channelID) : ,_enabledlamFsDaughter2(false) ,_J(theDec->motherJPC()->J) ,_isFormationAmp(false) + ,_withDecayAmps(true) { if(theDec->type() =="FormationDecay"){ _isFormationAmp=true; @@ -72,6 +73,7 @@ AbsXdecAmp::AbsXdecAmp(std::shared_ptr<AbsDecay> theDec, ChannelID channelID) : else{ _jpcDecsName=_JPCPtr->jpcname()+"To"+theDec->daughter1Part()->name()+"_"+theDec->daughter2Part()->name(); } + if(_daughter1IsStable && _daughter2IsStable) _withDecayAmps=false; } AbsXdecAmp::~AbsXdecAmp() diff --git a/PwaUtils/AbsXdecAmp.hh b/PwaUtils/AbsXdecAmp.hh index 7a448df06aa0d95e70ae5eba5b045173a6b7ff47..96f2c56764e03679d302136e245b6ca6f1e9fb0f 100644 --- a/PwaUtils/AbsXdecAmp.hh +++ b/PwaUtils/AbsXdecAmp.hh @@ -130,5 +130,6 @@ protected: intUShortShortComplFloatMap _cachedAmpIdMap; // std::map<std::thread::id, std::map<unsigned short, complex<float> > > _cachedDynIdMap; std::map<unsigned short, complex<float> > _cachedDynIdMap; + bool _withDecayAmps; virtual void initialize(); }; diff --git a/PwaUtils/TensorDecAmps.cc b/PwaUtils/TensorDecAmps.cc index 61836dfb86cb8f6fdb6147f2c2d23b104dca9076..b2928f984808bc885e6ebcd649b61f41cfcc2b5e 100644 --- a/PwaUtils/TensorDecAmps.cc +++ b/PwaUtils/TensorDecAmps.cc @@ -106,7 +106,7 @@ complex<double> TensorDecAmps::XdecAmp(const Spin& lamX, EvtData* theData, AbsXd result=lsLoop(grandmaAmp, lamX, theData, _lam1MinProj, _lam1MaxProj, _lam2MinProj, - _lam2MaxProj, true); + _lam2MaxProj, _withDecayAmps); if ( _cacheAmps){ // _cachedAmpMap[evtNo][_absDyn->grandMaKey(grandmaAmp)][currentSpinIndex]=result; @@ -140,9 +140,9 @@ complex<double> TensorDecAmps::lsLoop(AbsXdecAmp* grandmaAmp, Spin lamX, EvtData complex<double> tmpResult(0.,0.); for(Spin lambda1=lam1Min; lambda1<=lam1Max; ++lambda1){ for(Spin lambda2=lam2Min; lambda2<=lam2Max; ++lambda2){ - Id3StringType IdLamXLam1Lam2=FunctionUtils::spin3Index(lamX, lambda1, lambda2); - complex<double> amp = theMagExpi*current3SpinMap.at(IdLamXLam1Lam2); - if(withDecs) amp *=dAmps.at(lambda1 - lam1Min).at(lambda2 - lam2Min); + Id3StringType IdLamXLam1Lam2=FunctionUtils::spin3Index(lamX, lambda1, lambda2); + complex<double> amp = theMagExpi*current3SpinMap.at(IdLamXLam1Lam2); + if(withDecs) amp *=dAmps.at(lambda1 - lam1Min).at(lambda2 - lam2Min); tmpResult+=amp; } } @@ -159,34 +159,6 @@ complex<double> TensorDecAmps::lsLoop(AbsXdecAmp* grandmaAmp, Spin lamX, EvtData } -// void TensorDecAmps::getDefaultParams(fitParCol& fitVal, fitParCol& fitErr){ - -// std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > currentMagValMap; -// std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > currentPhiValMap; -// std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > currentMagErrMap; -// std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > currentPhiErrMap; - -// std::vector< std::shared_ptr<const LScomb> >::const_iterator itLS; -// for(itLS=_LSs.begin(); itLS!=_LSs.end(); ++itLS){ -// currentMagValMap[*itLS]=_factorMag; -// currentPhiValMap[*itLS]=0.; -// currentMagErrMap[*itLS]=_factorMag/3.; -// currentPhiErrMap[*itLS]=0.3; -// } - -// fitVal.MagsLS[_key]=currentMagValMap; -// fitVal.PhisLS[_key]=currentPhiValMap; -// fitErr.MagsLS[_key]=currentMagErrMap; -// fitErr.PhisLS[_key]=currentPhiErrMap; - -// _absDyn->getDefaultParams(fitVal, fitErr); - - -// if(!_daughter1IsStable) _decAmpDaughter1->getDefaultParams(fitVal, fitErr); -// if(!_daughter2IsStable) _decAmpDaughter2->getDefaultParams(fitVal, fitErr); -// } - - void TensorDecAmps::fillDefaultParams(std::shared_ptr<AbsPawianParameters> fitPar){ std::vector< std::shared_ptr<const LScomb> >::const_iterator itLS; @@ -220,9 +192,11 @@ void TensorDecAmps::fillParamNameList(){ for(itLS=_LSs.begin(); itLS!=_LSs.end(); ++itLS){ std::string magName=(*itLS)->name()+_key+"Mag"; _paramNameList.push_back(magName); + _lsMagNameMap[*itLS]=magName; std::string phiName=(*itLS)->name()+_key+"Phi"; _paramNameList.push_back(phiName); + _lsPhiNameMap[*itLS]=phiName; } } @@ -235,16 +209,9 @@ void TensorDecAmps::updateFitParams(std::shared_ptr<AbsPawianParameters> fitPar) std::vector< std::shared_ptr<const LScomb> >::const_iterator itLS; for(itLS=_LSs.begin(); itLS!=_LSs.end(); ++itLS){ //magnitude - std::string magName=(*itLS)->name()+_key+"Mag"; - std::string phiName=(*itLS)->name()+_key+"Phi"; - double theMag=fabs(fitPar->Value(magName)); - double thePhi=fitPar->Value(phiName); - - _currentParamMags[*itLS]=theMag; - _currentParamPhis[*itLS]=thePhi; - - complex<double> expi(cos(thePhi), sin(thePhi)); - _currentParamMagExpi[*itLS]=theMag*expi; + double theMag=fabs(fitPar->Value(_lsMagNameMap.at(*itLS))); + double thePhi=fitPar->Value(_lsPhiNameMap.at(*itLS)); + _currentParamMagExpi[*itLS]=std::polar(theMag, thePhi); } _absDyn->updateFitParams(fitPar); diff --git a/PwaUtils/TensorDecAmps.hh b/PwaUtils/TensorDecAmps.hh index f41d9abd58a92fa8f629eea685e8768651baa4f7..bb9d822f705289ab7e0c8ed50cec555d8855f672 100644 --- a/PwaUtils/TensorDecAmps.hh +++ b/PwaUtils/TensorDecAmps.hh @@ -74,12 +74,10 @@ public: protected: std::vector< std::shared_ptr<const LScomb> > _LSs; double _factorMag; - std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > _currentParamMags; - std::map< std::shared_ptr<const LScomb>, double, pawian::Collection::SharedPtrLess > _currentParamPhis; + std::map< std::shared_ptr<const LScomb>, std::string, pawian::Collection::SharedPtrLess > _lsMagNameMap; + std::map< std::shared_ptr<const LScomb>, std::string, pawian::Collection::SharedPtrLess > _lsPhiNameMap; std::map< std::shared_ptr<const LScomb>, complex<double>, pawian::Collection::SharedPtrLess > _currentParamMagExpi; - // std::map<std::thread::id, std::map<Spin, complex<double> > > _cachedDynLSMap; std::map<unsigned short, std::map<Spin, complex<double> > > _cachedDynIdLSMap; - virtual complex<double> lsLoop(AbsXdecAmp* grandmaAmp, Spin lamX, EvtData* theData, Spin lam1Min, Spin lam1Max, Spin lam2Min, Spin lam2Max, bool withDecs); private: