diff --git a/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.cc b/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.cc index 0871c18fe585e2f9738cb75a1a34b722abb652b6..076d9f84f143c2a88fa2d42c2bc215b5a24973e9 100644 --- a/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.cc +++ b/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.cc @@ -30,6 +30,8 @@ AbsPsi2STo2K2PiGamLh::~AbsPsi2STo2K2PiGamLh() double AbsPsi2STo2K2PiGamLh::calcLogLh(const param2K2PiGam& theParamVal){ + _currentFitParms=theParamVal; + double logLH=0.; double logLH_data=0.; @@ -56,7 +58,7 @@ double AbsPsi2STo2K2PiGamLh::calcLogLh(const param2K2PiGam& theParamVal){ Info << "current LH = " << logLH << endmsg; - _currentFitParms=theParamVal; + _cashedFitParms=theParamVal; return logLH; } @@ -1732,5 +1734,83 @@ void AbsPsi2STo2K2PiGamLh::print(std::ostream& os) const{ void AbsPsi2STo2K2PiGamLh::copyCurrentVals(AbsPsi2STo2K2PiGamLh* theLh){ - theLh->_currentFitParms=_currentFitParms; + theLh->_cashedFitParms=_cashedFitParms; +} + +bool AbsPsi2STo2K2PiGamLh::compAmpParms( std::vector<unsigned int>& ampVec){ + + bool result=false; + std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; + + std::vector<unsigned int>::const_iterator itAmps; + for ( itAmps=ampVec.begin(); itAmps!=ampVec.end(); ++itAmps){ + std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParams2K2PiGam.jpclsVec(*itAmps); + + for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){ + std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapNew=_fitParams2K2PiGam.ampMap(_currentFitParms, *itAmps); + std::pair<double, double> tmpParamNew=currentMapNew[(*itJPCLS)]; + + std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapOld=_fitParams2K2PiGam.ampMap(_cashedFitParms, *itAmps); + std::pair<double, double> tmpParamOld=currentMapOld[(*itJPCLS)]; + + if(fabs(tmpParamNew.first-tmpParamOld.first)>1e-10){ + DebugMsg <<"\t Amplitude of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.first <<" != " << tmpParamOld.first << endmsg; + return result; + } + if(fabs(tmpParamNew.second-tmpParamOld.second)>1e-10){ + DebugMsg <<"\t Phase of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.second <<" != " << tmpParamOld.second << endmsg; + return result; + } + + } + } + result=true; + return result; +} + + +bool AbsPsi2STo2K2PiGamLh::compMassParms( std::vector<unsigned int>& massVec){ + + bool result=false; + + std::vector<unsigned int>::const_iterator itMasses; + for ( itMasses=massVec.begin(); itMasses!=massVec.end(); ++itMasses){ + std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(_cashedFitParms, *itMasses); + std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(_currentFitParms, *itMasses); + + if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ + DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; + return result; + } + + if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ + DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; + return result; + } + } + + result=true; + return result; +} + +bool AbsPsi2STo2K2PiGamLh::compFlatteParms(){ + bool result=false; + + if(fabs(_cashedFitParms.Flatf980-_currentFitParms.Flatf980)>1e-10){ + DebugMsg <<"\t Flatf980 " << " are not equal\t" << _cashedFitParms.Flatf980 <<" != " << _currentFitParms.Flatf980 << endmsg; + return result; + } + + if(fabs(_cashedFitParms.Flatf980gPiPi-_currentFitParms.Flatf980gPiPi)>1e-10){ + DebugMsg <<"\t Flatf980gPiPi " << " are not equal\t" << _cashedFitParms.Flatf980gPiPi <<" != " << _currentFitParms.Flatf980gPiPi << endmsg; + return result; + } + + if(fabs(_cashedFitParms.Flatf980gKK-_currentFitParms.Flatf980gKK)>1e-10){ + DebugMsg <<"\t Flatf980gKK " << " are not equal\t" << _cashedFitParms.Flatf980gKK <<" != " << _currentFitParms.Flatf980gKK << endmsg; + return result; + } + + result=true; + return result; } diff --git a/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.hh b/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.hh index d3d4fb2901ec35e29fc5dbe19cf48283ca11dd6e..b8c78fe3cad27c5fc8cdda42bca5b17de91de824 100644 --- a/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.hh +++ b/Examples/Psi2STo2K2PiGam/AbsPsi2STo2K2PiGamLh.hh @@ -142,6 +142,11 @@ protected: // virtual void copyCurrentVals(AbsPsi2STo2K2PiGamLh* theLh)=0; void copyCurrentVals(AbsPsi2STo2K2PiGamLh* theLh); + bool compAmpParms( std::vector<unsigned int>& ampVec); + bool compMassParms( std::vector<unsigned int>& massVec); + bool compFlatteParms(); + + param2K2PiGam _cashedFitParms; param2K2PiGam _currentFitParms; private: diff --git a/Examples/Psi2STo2K2PiGam/Hyp1Lh.cc b/Examples/Psi2STo2K2PiGam/Hyp1Lh.cc index ee5debcba4872c99c28c2dd0d846b75b7c8bcd7f..cc52337ce19846ff0c7cc937abe9e665ee8590c5 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp1Lh.cc +++ b/Examples/Psi2STo2K2PiGam/Hyp1Lh.cc @@ -51,7 +51,7 @@ Hyp1Lh::~Hyp1Lh() complex<double> Hyp1Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2PiGamData::Psi2STo2K2PiGamEvtData* theData){ if (_evtCounter==0){ - _equalParameter=equalParams(_currentFitParms, theParamVal); + _equalParameter=equalParams(); DebugMsg << "equal parameter: "<< _equalParameter << endmsg; @@ -477,65 +477,15 @@ void Hyp1Lh::copyCurrentVals(Hyp1Lh* theLh){ } -bool Hyp1Lh::equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew){ - bool result=false; - std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; - - std::vector<unsigned int>::const_iterator itAmps; - for ( itAmps=_ampVec.begin(); itAmps!=_ampVec.end(); ++itAmps){ - std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParams2K2PiGam.jpclsVec(*itAmps); - - for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){ - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapNew=_fitParams2K2PiGam.ampMap(theParamValNew, *itAmps); - std::pair<double, double> tmpParamNew=currentMapNew[(*itJPCLS)]; - - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapOld=_fitParams2K2PiGam.ampMap(theParamValOld, *itAmps); - std::pair<double, double> tmpParamOld=currentMapOld[(*itJPCLS)]; - - if(fabs(tmpParamNew.first-tmpParamOld.first)>1e-10){ - DebugMsg <<"\t Amplitude of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.first <<" != " << tmpParamOld.first << endmsg; - return result; - } - - if(fabs(tmpParamNew.second-tmpParamOld.second)>1e-10){ - DebugMsg <<"\t Phase of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.second <<" != " << tmpParamOld.second << endmsg; - return result; - } - - } - } +bool Hyp1Lh::equalParams(){ - std::vector<unsigned int>::const_iterator itMasses; - for ( itMasses=_massVec.begin(); itMasses!=_massVec.end(); ++itMasses){ - std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(theParamValOld, *itMasses); - std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(theParamValNew, *itMasses); - - if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ - DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; - return result; - } - - if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ - DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; - return result; - } - } - - if(fabs(theParamValOld.Flatf980-theParamValNew.Flatf980)>1e-10){ - DebugMsg <<"\t Flatf980 " << " are not equal\t" << theParamValOld.Flatf980 <<" != " << theParamValNew.Flatf980 << endmsg; - return result; - } - - if(fabs(theParamValOld.Flatf980gPiPi-theParamValNew.Flatf980gPiPi)>1e-10){ - DebugMsg <<"\t Flatf980gPiPi " << " are not equal\t" << theParamValOld.Flatf980gPiPi <<" != " << theParamValNew.Flatf980gPiPi << endmsg; - return result; - } + bool result=true; + std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; - if(fabs(theParamValOld.Flatf980gKK-theParamValNew.Flatf980gKK)>1e-10){ - DebugMsg <<"\t Flatf980gKK " << " are not equal\t" << theParamValOld.Flatf980gKK <<" != " << theParamValNew.Flatf980gKK << endmsg; - return result; - } + if (!compAmpParms( _ampVec )) return false; + if (!compMassParms(_massVec)) return false; + if (!compFlatteParms()) return false; - result=true; return result; + } diff --git a/Examples/Psi2STo2K2PiGam/Hyp1Lh.hh b/Examples/Psi2STo2K2PiGam/Hyp1Lh.hh index 5ca70e25e80d411e05644d35493861cb720d8f93..5c1ab3584f5bcfc16fed137953c59d3c8f468794 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp1Lh.hh +++ b/Examples/Psi2STo2K2PiGam/Hyp1Lh.hh @@ -80,7 +80,7 @@ private: unsigned int _evtCounter; bool _equalParameter; - bool equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew); + bool equalParams(); }; diff --git a/Examples/Psi2STo2K2PiGam/Hyp4Lh.cc b/Examples/Psi2STo2K2PiGam/Hyp4Lh.cc index d192b1f84382b0b12caa75872e1d8b9744f9348f..6ccd8c6be61591fb656bd0cd7d33121259d1ef6c 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp4Lh.cc +++ b/Examples/Psi2STo2K2PiGam/Hyp4Lh.cc @@ -21,6 +21,9 @@ Hyp4Lh::Hyp4Lh(boost::shared_ptr<const Psi2STo2K2PiGamEvtList> theEvtList, const ,_f1710f_2_1950Hyp4(true) ,_doHyp4(true) ,_nFitParams(0) + ,_f980FlatteRemain(false) + ,_evtCounter(0) + ,_equalParameter(false) { setUp(hypMap); } @@ -40,6 +43,9 @@ Hyp4Lh::Hyp4Lh( boost::shared_ptr<AbsPsi2STo2K2PiGamLh> theLhPtr, const std::map ,_f1710f_2_1950Hyp4(true) ,_doHyp4(true) ,_nFitParams(0) + ,_f980FlatteRemain(false) + ,_evtCounter(0) + ,_equalParameter(false) { setUp(hypMap); } @@ -56,6 +62,22 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 if(!_doHyp4) return result; + if (_evtCounter==0){ + _equalParameter=equalParams(); + + DebugMsg << "equal parameter: "<< _equalParameter << endmsg; + + } + + if(_equalParameter){ + result+=_currentResultHyp4[_evtCounter]; + _evtCounter++; + return result; + } + + + complex<double> currentResult(0.,0.); + double f1370Mass=theParamVal.Bwf1370.first; double f1370Width=theParamVal.Bwf1370.second; @@ -76,8 +98,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_gKK=theParamVal.Flatf980gKK; //Chi_c0 decay to f0(980) f0(1370) -> (pi0 pi0) (K K) - result+=chiTof980_pif0_kAmp(theData, ChiTof980_pif1370_k, f980_Mass, f980_gPiPi, f980_gKK, f1370Mass, f1370Width); - result+=chiTof980_kf0_piAmp(theData, ChiTof980_kf1370_pi, f980_Mass, f980_gKK, f980_gPiPi, f1370Mass, f1370Width); + currentResult+=chiTof980_pif0_kAmp(theData, ChiTof980_pif1370_k, f980_Mass, f980_gPiPi, f980_gKK, f1370Mass, f1370Width); + currentResult+=chiTof980_kf0_piAmp(theData, ChiTof980_kf1370_pi, f980_Mass, f980_gKK, f980_gPiPi, f1370Mass, f1370Width); } double f1500Mass=theParamVal.Bwf1500.first; @@ -91,9 +113,9 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_gKK=theParamVal.Flatf980gKK; //Chi_c0 decay to f0(980) f0(1500) -> (pi0 pi0) (K K) - result+=chiTof980_pif0_kAmp(theData, ChiTof980_pif1500_k, f980_Mass, f980_gPiPi, f980_gKK, f1500Mass, f1500Width); + currentResult+=chiTof980_pif0_kAmp(theData, ChiTof980_pif1500_k, f980_Mass, f980_gPiPi, f980_gKK, f1500Mass, f1500Width); //Chi_c0 decay to f0(980) f0(1500) -> (K K) (pi0 pi0) - result+=chiTof980_kf0_piAmp(theData, ChiTof980_kf1500_pi, f980_Mass, f980_gKK, f980_gPiPi, f1500Mass, f1500Width); + currentResult+=chiTof980_kf0_piAmp(theData, ChiTof980_kf1500_pi, f980_Mass, f980_gKK, f980_gPiPi, f1500Mass, f1500Width); } if (_f1710f1370Hyp4){ @@ -102,8 +124,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f1710Mass=theParamVal.Bwf1710.first; double f1710Width=theParamVal.Bwf1710.second; - result+=chiTof0_pif0_kAmp(theData, ChiTof1710_pif1370_k, f1710Mass, f1710Width, f1370Mass, f1370Width); - result+=chiTof0_pif0_kAmp(theData, ChiTof1710_kf1370_pi, f1370Mass, f1370Width, f1710Mass, f1710Width); + currentResult+=chiTof0_pif0_kAmp(theData, ChiTof1710_pif1370_k, f1710Mass, f1710Width, f1370Mass, f1370Width); + currentResult+=chiTof0_pif0_kAmp(theData, ChiTof1710_kf1370_pi, f1370Mass, f1370Width, f1710Mass, f1710Width); } if(_f980f_2_1270Hyp4){ @@ -115,8 +137,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_gKK=theParamVal.Flatf980gKK; double f_2_1270Mass=theParamVal.Bwf_2_1270.first; double f_2_1270Width=theParamVal.Bwf_2_1270.second; - result+=chiTof980_pif2_kAmp(theData, f980_pif_2_1270_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1270Mass, f_2_1270Width); - result+=chiTof980_kf2_piAmp(theData, f980_kf_2_1270_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1270Mass, f_2_1270Width); + currentResult+=chiTof980_pif2_kAmp(theData, f980_pif_2_1270_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1270Mass, f_2_1270Width); + currentResult+=chiTof980_kf2_piAmp(theData, f980_kf_2_1270_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1270Mass, f_2_1270Width); } if (_f980f_2_1430Hyp4){ @@ -126,8 +148,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_Mass=theParamVal.Flatf980; double f980_gPiPi=theParamVal.Flatf980gPiPi; double f980_gKK=theParamVal.Flatf980gKK; - result+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1430Mass, f_2_1430Width); - result+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1430Mass, f_2_1430Width); + currentResult+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1430Mass, f_2_1430Width); + currentResult+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1430Mass, f_2_1430Width); } if (_f980f_2_1525Hyp4){ @@ -137,8 +159,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_Mass=theParamVal.Flatf980; double f980_gPiPi=theParamVal.Flatf980gPiPi; double f980_gKK=theParamVal.Flatf980gKK; - result+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1525Mass, f_2_1525Width); - result+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1525Mass, f_2_1525Width); + currentResult+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1525Mass, f_2_1525Width); + currentResult+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1525Mass, f_2_1525Width); } if (_f980f_2_1950Hyp4){ @@ -148,16 +170,16 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f980_Mass=theParamVal.Flatf980; double f980_gPiPi=theParamVal.Flatf980gPiPi; double f980_gKK=theParamVal.Flatf980gKK; - result+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1950Mass, f_2_1950Width); - result+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1950Mass, f_2_1950Width); + currentResult+=chiTof980_pif2_kAmp(theData, ChiTof980_pif2_k, f980_Mass, f980_gPiPi, f980_gKK, f_2_1950Mass, f_2_1950Width); + currentResult+=chiTof980_kf2_piAmp(theData, ChiTof980_kf2_pi, f980_Mass, f980_gKK, f980_gPiPi, f_2_1950Mass, f_2_1950Width); } if (_f1500f_2_1525Hyp4){ std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiTof1500_pif2_k=theParamVal.f1500_pif_2_1525_k; std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > ChiTof1500_kf2_pi=theParamVal.f1500_kf_2_1525_pi; - result+=chiTof0_pif2_kAmp(theData, ChiTof1500_pif2_k, f1500Mass, f1500Width, f_2_1525Mass, f_2_1525Width); - result+=chiTof2_pif0_kAmp(theData, ChiTof1500_kf2_pi, f_2_1525Mass, f_2_1525Width, f1500Mass, f1500Width); + currentResult+=chiTof0_pif2_kAmp(theData, ChiTof1500_pif2_k, f1500Mass, f1500Width, f_2_1525Mass, f_2_1525Width); + currentResult+=chiTof2_pif0_kAmp(theData, ChiTof1500_kf2_pi, f_2_1525Mass, f_2_1525Width, f1500Mass, f1500Width); } if (_f1710f_2_1430Hyp4){ @@ -167,8 +189,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f1710Mass=theParamVal.Bwf1710.first; double f1710Width=theParamVal.Bwf1710.second; - result+=chiTof0_pif2_kAmp(theData, ChiTof1710_pif2_k, f1710Mass, f1710Width, f_2_1430Mass, f_2_1430Width); - result+=chiTof2_pif0_kAmp(theData, ChiTof1710_kf2_pi, f_2_1430Mass, f_2_1430Width, f1710Mass, f1710Width); + currentResult+=chiTof0_pif2_kAmp(theData, ChiTof1710_pif2_k, f1710Mass, f1710Width, f_2_1430Mass, f_2_1430Width); + currentResult+=chiTof2_pif0_kAmp(theData, ChiTof1710_kf2_pi, f_2_1430Mass, f_2_1430Width, f1710Mass, f1710Width); } if (_f1710f_2_1950Hyp4){ @@ -178,8 +200,8 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double f1710Mass=theParamVal.Bwf1710.first; double f1710Width=theParamVal.Bwf1710.second; - result+=chiTof0_pif2_kAmp(theData, ChiTof1710_pif2_k, f1710Mass, f1710Width, f_2_1950Mass, f_2_1950Width); - result+=chiTof2_pif0_kAmp(theData, ChiTof1710_kf2_pi, f_2_1950Mass, f_2_1950Width, f1710Mass, f1710Width); + currentResult+=chiTof0_pif2_kAmp(theData, ChiTof1710_pif2_k, f1710Mass, f1710Width, f_2_1950Mass, f_2_1950Width); + currentResult+=chiTof2_pif0_kAmp(theData, ChiTof1710_kf2_pi, f_2_1950Mass, f_2_1950Width, f1710Mass, f1710Width); } if (_sigmaf1370Hyp4){ @@ -188,10 +210,13 @@ complex<double> Hyp4Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 double sigmaMass=theParamVal.BwSigma.first; double sigmaWidth=theParamVal.BwSigma.second; - result+=chiTof0_pif0_kAmp(theData, ChiToSigmaf1370, sigmaMass, sigmaWidth, f1370Mass, f1370Width); + currentResult+=chiTof0_pif0_kAmp(theData, ChiToSigmaf1370, sigmaMass, sigmaWidth, f1370Mass, f1370Width); } + _currentResultHyp4[_evtCounter]=currentResult; + _evtCounter++; + result+=currentResult; return result; } @@ -515,6 +540,20 @@ void Hyp4Lh::setUp(const std::map<const std::string, bool>& hypMap){ if (_f980f_2_1950Hyp4 || _f1710f_2_1950Hyp4) _massVec.push_back(paramEnum2K2PiGam::f_2_1950); if (_f980f_2_1525Hyp4 || _f1500f_2_1525Hyp4) _massVec.push_back(paramEnum2K2PiGam::f_2_1525); + // fill all other resonances + if (_sigmaf1370Hyp4){ + _massVecRemain.push_back(paramEnum2K2PiGam::sigma); + } + + if (_f1710f1370Hyp4 || _f1710f_2_1430Hyp4 || _f1710f_2_1950Hyp4){ + _massVecRemain.push_back(paramEnum2K2PiGam::f1710); + } + + if(_f980f1370Hyp4 || _f980f1500Hyp4 || _f980f_2_1270Hyp4 || _f980f_2_1430Hyp4 || _f980f_2_1525Hyp4 || _f980f_2_1950Hyp4){ + _f980FlatteRemain=true; + } + + std::vector<unsigned int>::iterator ampIt; for (ampIt=_ampVec.begin(); ampIt!=_ampVec.end(); ++ampIt){ std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParams2K2PiGam.jpclsVec(*ampIt); @@ -526,3 +565,33 @@ void Hyp4Lh::setUp(const std::map<const std::string, bool>& hypMap){ _nFitParams+=2; } } + + + +void Hyp4Lh::copyCurrentVals(Hyp4Lh* theLh){ + Hyp1Lh::copyCurrentVals(theLh); + std::map<unsigned int, complex<double> > newResult; + std::map<unsigned int, complex<double> >::iterator it; + for (it= _currentResultHyp4.begin(); it!= _currentResultHyp4.end(); ++it){ + newResult[it->first]=it->second; + } + theLh->_currentResultHyp4=newResult; + +} + + + +bool Hyp4Lh::equalParams(){ + + bool result=true; + std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; + + if (!compAmpParms( _ampVec )) return false; + if (!compMassParms(_massVec)) return false; + if (!compMassParms(_massVecRemain)) return false; + if(_f980FlatteRemain){ + if (!compFlatteParms()) return false; + } + return result; + +} diff --git a/Examples/Psi2STo2K2PiGam/Hyp4Lh.hh b/Examples/Psi2STo2K2PiGam/Hyp4Lh.hh index 70f8e730eecb96e626be60386a007751d2ed574f..6dab536a2138746be7f09c6b8b71e2583c75d438 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp4Lh.hh +++ b/Examples/Psi2STo2K2PiGam/Hyp4Lh.hh @@ -64,12 +64,21 @@ protected: bool _doHyp4; virtual complex<double> chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2PiGamData::Psi2STo2K2PiGamEvtData* theData); + virtual void copyCurrentVals(Hyp4Lh* theLh); + std::map<unsigned int, complex<double> > _currentResultHyp4; + private: unsigned int _nFitParams; std::vector<unsigned int> _ampVec; std::vector<unsigned int> _massVec; + std::vector<unsigned int> _massVecRemain; + bool _f980FlatteRemain; void setUp(const std::map<const std::string, bool>& hypMap); + unsigned int _evtCounter; + bool _equalParameter; + + bool equalParams(); }; #endif diff --git a/Examples/Psi2STo2K2PiGam/Hyp5Lh.cc b/Examples/Psi2STo2K2PiGam/Hyp5Lh.cc index be36dcfb4a2718aec1710f26fcd609b5b5f00376..c82308fbc7b89a9697e5a8f49794e424b7973576 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp5Lh.cc +++ b/Examples/Psi2STo2K2PiGam/Hyp5Lh.cc @@ -59,7 +59,7 @@ complex<double> Hyp5Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 if (!_doHyp5) return result; if (_evtCounter==0){ - _equalParameter=equalParams(_currentFitParms, theParamVal); + _equalParameter=equalParams(); DebugMsg << "equal parameter: "<< _equalParameter << endmsg; @@ -464,7 +464,7 @@ void Hyp5Lh::setUp(const std::map<const std::string, bool>& hypMap){ void Hyp5Lh::copyCurrentVals(Hyp5Lh* theLh){ - Hyp1Lh::copyCurrentVals(theLh); + Hyp4Lh::copyCurrentVals(theLh); std::map<unsigned int, complex<double> > newResult; std::map<unsigned int, complex<double> >::iterator it; for (it= _currentResultHyp5.begin(); it!= _currentResultHyp5.end(); ++it){ @@ -476,85 +476,17 @@ void Hyp5Lh::copyCurrentVals(Hyp5Lh* theLh){ -bool Hyp5Lh::equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew){ - bool result=false; - std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; - - std::vector<unsigned int>::const_iterator itAmps; - for ( itAmps=_ampVec.begin(); itAmps!=_ampVec.end(); ++itAmps){ - std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParams2K2PiGam.jpclsVec(*itAmps); - - for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){ - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapNew=_fitParams2K2PiGam.ampMap(theParamValNew, *itAmps); - std::pair<double, double> tmpParamNew=currentMapNew[(*itJPCLS)]; - - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapOld=_fitParams2K2PiGam.ampMap(theParamValOld, *itAmps); - std::pair<double, double> tmpParamOld=currentMapOld[(*itJPCLS)]; - - if(fabs(tmpParamNew.first-tmpParamOld.first)>1e-10){ - DebugMsg <<"\t Amplitude of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.first <<" != " << tmpParamOld.first << endmsg; - return result; - } - if(fabs(tmpParamNew.second-tmpParamOld.second)>1e-10){ - DebugMsg <<"\t Phase of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.second <<" != " << tmpParamOld.second << endmsg; - return result; - } - - } - } - - std::vector<unsigned int>::const_iterator itMasses; - for ( itMasses=_massVec.begin(); itMasses!=_massVec.end(); ++itMasses){ - std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(theParamValOld, *itMasses); - std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(theParamValNew, *itMasses); - - if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ - DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; - return result; - } - - if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ - DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; - return result; - } - } - - - for ( itMasses=_massVecRemain.begin(); itMasses!=_massVecRemain.end(); ++itMasses){ - std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(theParamValOld, *itMasses); - std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(theParamValNew, *itMasses); - - if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ - DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; - return result; - } - - if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ - DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; - return result; - } - } - +bool Hyp5Lh::equalParams(){ + bool result=true; + std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; + if (!compAmpParms( _ampVec )) return false; + if (!compMassParms(_massVec)) return false; + if (!compMassParms(_massVecRemain)) return false; if(_f980FlatteRemain){ - if(fabs(theParamValOld.Flatf980-theParamValNew.Flatf980)>1e-10){ - DebugMsg <<"\t Flatf980 " << " are not equal\t" << theParamValOld.Flatf980 <<" != " << theParamValNew.Flatf980 << endmsg; - return result; - } - - if(fabs(theParamValOld.Flatf980gPiPi-theParamValNew.Flatf980gPiPi)>1e-10){ - DebugMsg <<"\t Flatf980gPiPi " << " are not equal\t" << theParamValOld.Flatf980gPiPi <<" != " << theParamValNew.Flatf980gPiPi << endmsg; - return result; - } - - if(fabs(theParamValOld.Flatf980gKK-theParamValNew.Flatf980gKK)>1e-10){ - DebugMsg <<"\t Flatf980gKK " << " are not equal\t" << theParamValOld.Flatf980gKK <<" != " << theParamValNew.Flatf980gKK << endmsg; - return result; + if (!compFlatteParms()) return false; } - - } - - result=true; return result; + } diff --git a/Examples/Psi2STo2K2PiGam/Hyp5Lh.hh b/Examples/Psi2STo2K2PiGam/Hyp5Lh.hh index ae2ac15e80dfa86ca671606ce9b3cc6719f53632..803d812a5ef015befa1cb15e38a95fa619b3775f 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp5Lh.hh +++ b/Examples/Psi2STo2K2PiGam/Hyp5Lh.hh @@ -78,7 +78,7 @@ private: unsigned int _evtCounter; bool _equalParameter; - bool equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew); + bool equalParams(); }; #endif diff --git a/Examples/Psi2STo2K2PiGam/Hyp9Lh.cc b/Examples/Psi2STo2K2PiGam/Hyp9Lh.cc index 3b10147c2acad24da0ac3f5ee8c428bb2e23af92..5f514915fe364dbb7730c6110da53407058d767f 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp9Lh.cc +++ b/Examples/Psi2STo2K2PiGam/Hyp9Lh.cc @@ -72,7 +72,7 @@ complex<double> Hyp9Lh::chi0DecAmps(const param2K2PiGam& theParamVal, Psi2STo2K2 if (!_doHyp9) return result; if (_evtCounter==0){ - _equalParameter=equalParams(_currentFitParms, theParamVal); + _equalParameter=equalParams(); DebugMsg << "equal parameter: "<< _equalParameter << endmsg; @@ -720,85 +720,15 @@ void Hyp9Lh::copyCurrentVals(Hyp9Lh* theLh){ } -bool Hyp9Lh::equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew){ - bool result=false; +bool Hyp9Lh::equalParams(){ + bool result=true; std::vector< boost::shared_ptr<const JPCLS> >::const_iterator itJPCLS; - std::vector<unsigned int>::const_iterator itAmps; - for ( itAmps=_ampVec.begin(); itAmps!=_ampVec.end(); ++itAmps){ - std::vector< boost::shared_ptr<const JPCLS> > JPCLSs=_fitParams2K2PiGam.jpclsVec(*itAmps); - - for ( itJPCLS=JPCLSs.begin(); itJPCLS!=JPCLSs.end(); ++itJPCLS){ - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapNew=_fitParams2K2PiGam.ampMap(theParamValNew, *itAmps); - std::pair<double, double> tmpParamNew=currentMapNew[(*itJPCLS)]; - - std::map< boost::shared_ptr<const JPCLS>, pair<double, double>, pawian::Collection::SharedPtrLess > currentMapOld=_fitParams2K2PiGam.ampMap(theParamValOld, *itAmps); - std::pair<double, double> tmpParamOld=currentMapOld[(*itJPCLS)]; - - if(fabs(tmpParamNew.first-tmpParamOld.first)>1e-10){ - DebugMsg <<"\t Amplitude of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.first <<" != " << tmpParamOld.first << endmsg; - return result; - } - if(fabs(tmpParamNew.second-tmpParamOld.second)>1e-10){ - DebugMsg <<"\t Phase of " << paramEnum2K2PiGam::name(*itAmps) << " are not equal\t" << tmpParamNew.second <<" != " << tmpParamOld.second << endmsg; - return result; - } - - } - } - - std::vector<unsigned int>::const_iterator itMasses; - for ( itMasses=_massVec.begin(); itMasses!=_massVec.end(); ++itMasses){ - std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(theParamValOld, *itMasses); - std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(theParamValNew, *itMasses); - - if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ - DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; - return result; - } - - if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ - DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; - return result; - } - } - - - for ( itMasses=_massVecRemain.begin(); itMasses!=_massVecRemain.end(); ++itMasses){ - std::pair<double, double> tmpParamOld=_fitParams2K2PiGam.massPair(theParamValOld, *itMasses); - std::pair<double, double> tmpParamNew=_fitParams2K2PiGam.massPair(theParamValNew, *itMasses); - - if(fabs(tmpParamOld.first-tmpParamNew.first)>1e-10){ - DebugMsg <<"\t Mass of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.first <<" != " << tmpParamNew.first << endmsg; - return result; - } - - if(fabs(tmpParamOld.second-tmpParamNew.second)>1e-10){ - DebugMsg <<"\t Width of " << paramEnum2K2PiGam::name(*itMasses) << " are not equal\t" << tmpParamOld.second <<" != " << tmpParamNew.second << endmsg; - return result; - } - } - - - + if (!compAmpParms( _ampVec )) return false; + if (!compMassParms(_massVec)) return false; + if (!compMassParms(_massVecRemain)) return false; if(_f980FlatteRemain){ - if(fabs(theParamValOld.Flatf980-theParamValNew.Flatf980)>1e-10){ - DebugMsg <<"\t Flatf980 " << " are not equal\t" << theParamValOld.Flatf980 <<" != " << theParamValNew.Flatf980 << endmsg; - return result; + if (!compFlatteParms()) return false; } - - if(fabs(theParamValOld.Flatf980gPiPi-theParamValNew.Flatf980gPiPi)>1e-10){ - DebugMsg <<"\t Flatf980gPiPi " << " are not equal\t" << theParamValOld.Flatf980gPiPi <<" != " << theParamValNew.Flatf980gPiPi << endmsg; - return result; - } - - if(fabs(theParamValOld.Flatf980gKK-theParamValNew.Flatf980gKK)>1e-10){ - DebugMsg <<"\t Flatf980gKK " << " are not equal\t" << theParamValOld.Flatf980gKK <<" != " << theParamValNew.Flatf980gKK << endmsg; - return result; - } - - } - - result=true; return result; } diff --git a/Examples/Psi2STo2K2PiGam/Hyp9Lh.hh b/Examples/Psi2STo2K2PiGam/Hyp9Lh.hh index 1fdb0869385fce904b02b20b2fc818fbedb6ad5d..217e90f4a2c7f06a9be9b4e0698ba0a60ce6c768 100644 --- a/Examples/Psi2STo2K2PiGam/Hyp9Lh.hh +++ b/Examples/Psi2STo2K2PiGam/Hyp9Lh.hh @@ -86,7 +86,7 @@ private: unsigned int _evtCounter; bool _equalParameter; - bool equalParams(param2K2PiGam& theParamValOld, param2K2PiGam theParamValNew); + bool equalParams(); }; #endif diff --git a/Examples/Psi2STo2K2PiGam/MPsi2STo2K2PiGamFcn.cc b/Examples/Psi2STo2K2PiGam/MPsi2STo2K2PiGamFcn.cc index 7dda04d0c2388615fdc7be3c6931623c9e159843..b85633edf7a0020baeeb1f87088dcdbdfe24b087 100644 --- a/Examples/Psi2STo2K2PiGam/MPsi2STo2K2PiGamFcn.cc +++ b/Examples/Psi2STo2K2PiGam/MPsi2STo2K2PiGamFcn.cc @@ -39,16 +39,16 @@ double MPsi2STo2K2PiGamFcn::operator()(const std::vector<double>& par) const if ( _fcnCounter==1 || _fcnCounter%10 == 0) { - mutex1.lock(); DebugMsg << "logLh= " << result <<endmsg; - tmpAbsLh->printCurrentFitResult(theFitParmValTmp); + tmpAbsLh->printCurrentFitResult(theFitParmValTmp); + mutex1.lock(); _psi2STo2K2PiGamLhPtr.reset(); _psi2STo2K2PiGamLhPtr=tmpAbsLh; mutex1.unlock(); } - if ( _fcnCounter%100 == 0) { - mutex1.lock(); + if ( _fcnCounter%100 == 0) { + mutex1.lock(); std::ofstream theStream ( "currentResult.dat"); std::string theSuffix="Val"; tmpAbsLh->dumpCurrentResult(theStream, theFitParmValTmp, theSuffix);