Newer
Older
#include <fstream>
#include "PwaUtils/StreamFitParmsBaseNew.hh"
#include "PwaUtils/AbsLhNew.hh"
#include "ErrLogger/ErrLogger.hh"
StreamFitParmsBaseNew::StreamFitParmsBaseNew(std::string& filePath, boost::shared_ptr<AbsLhNew> theLhPtr) :
AbsFitParamStreamer(filePath)
{
theLhPtr->getDefaultParams(_paramVal,_paramErr);
fillParams();
}
StreamFitParmsBaseNew::~StreamFitParmsBaseNew(){;}
void StreamFitParmsBaseNew::fillParams(){
const std::string magSuffix="Mag";
const std::string phiSuffix="Phi";
const std::string massSuffix="Mass";
const std::string widthSuffix="Width";
const std::string gFactorSuffix="gFactor";
const std::string otherSuffix="Other";
fillLamLamAmps(_paramVal.MagLamLams, _paramErr.MagLamLams, magSuffix);
fillLamLamAmps(_paramVal.PhiLamLams, _paramErr.PhiLamLams, phiSuffix);
fillLSAmps(_paramVal.Mags, _paramErr.Mags, magSuffix);
fillLSAmps(_paramVal.Phis, _paramErr.Phis, phiSuffix);
fillDoubles(_paramVal.Masses, _paramErr.Masses, massSuffix);
fillDoubles(_paramVal.Widths, _paramErr.Widths, widthSuffix);
fillDoubles(_paramVal.gFactors, _paramErr.gFactors, gFactorSuffix);
fillDoubles(_paramVal.otherParams, _paramErr.otherParams, otherSuffix);
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
}
void StreamFitParmsBaseNew::fillLamLamAmps(mapStrJPCLamLam& valMap, mapStrJPCLamLam& errMap, const std::string& suffix){
mapStrJPCLamLam::iterator itLamLamMap;
for( itLamLamMap=valMap.begin(); itLamLamMap!=valMap.end(); ++itLamLamMap){
std::map< boost::shared_ptr<const JPClamlam>, double, pawian::Collection::SharedPtrLess >::iterator itLamLam;
for ( itLamLam=itLamLamMap->second.begin(); itLamLam!=itLamLamMap->second.end(); ++itLamLam){
std::string theKey=itLamLam->first->name()+itLamLamMap->first+suffix;
Info << "theKey=\t" << theKey << endmsg;
StringPairMap::const_iterator stringPairIter;
stringPairIter=_stringPairMap.find(theKey);
if ( stringPairIter != _stringPairMap.end() ){
Info << "key\t" << theKey << "\tfound" << endmsg;
double val=stringPairIter->second.first;
Info << "replace val by " << val << endmsg;
double err=stringPairIter->second.second;
Info << "replace err by " << err << endmsg;
valMap[itLamLamMap->first][itLamLam->first] = val;
errMap[itLamLamMap->first][itLamLam->first] = err;
}
}
}
}
void StreamFitParmsBaseNew::fillLSAmps(mapStrJPCLS& valMap, mapStrJPCLS& errMap, const std::string& suffix){
mapStrJPCLS::iterator itLSMap;
for( itLSMap=valMap.begin(); itLSMap!=valMap.end(); ++itLSMap){
std::map< boost::shared_ptr<const JPCLS>, double, pawian::Collection::SharedPtrLess >::iterator itLS;
for ( itLS=itLSMap->second.begin(); itLS!=itLSMap->second.end(); ++itLS){
std::string theKey=itLS->first->name()+itLSMap->first+suffix;
Info << "theKey=\t" << theKey << endmsg;
StringPairMap::const_iterator stringPairIter;
stringPairIter=_stringPairMap.find(theKey);
if ( stringPairIter != _stringPairMap.end() ){
Info << "key\t" << theKey << "\tfound" << endmsg;
double val=stringPairIter->second.first;
Info << "replace val by " << val << endmsg;
double err=stringPairIter->second.second;
Info << "replace err by " << err << endmsg;
valMap[itLSMap->first][itLS->first] = val;
errMap[itLSMap->first][itLS->first] = err;
}
}
}
}
void StreamFitParmsBaseNew::fillDoubles(mapStrDouble& valMap, mapStrDouble& errMap, const std::string& suffix){
mapStrDouble::iterator itMap;
for( itMap=valMap.begin(); itMap!=valMap.end(); ++itMap){
std::string theKey=itMap->first+suffix;
Info << "theKey=\t" << theKey << endmsg;
StringPairMap::const_iterator stringPairIter;
stringPairIter=_stringPairMap.find(theKey);
if ( stringPairIter != _stringPairMap.end() ){
Info << "key\t" << theKey << "\tfound" << endmsg;
double val=stringPairIter->second.first;
Info << "replace val by " << val << endmsg;
double err=stringPairIter->second.second;
Info << "replace err by " << err << endmsg;
valMap[itMap->first] = val;
errMap[itMap->first] = err;
}
}
}
void StreamFitParmsBaseNew::fillParameter(std::map<int, double>& theValMap, std::map<int, double>& theErrMap, std::string& suffix, int index){
StringPairMap::const_iterator stringPairIter=_stringPairMap.find(suffix);
if ( stringPairIter != _stringPairMap.end() ){
theValMap[index]=stringPairIter->second.first;
theErrMap[index]=stringPairIter->second.second;
}
}