9 #include <boost/property_tree/ptree.hpp> 10 #include <boost/property_tree/xml_parser.hpp> 27 using boost::property_tree::ptree;
30 read_xml(filename,top,2);
33 ptree& uncorrelated = top.get_child(
"pars.uncorrelated");
35 for(; it!=uncorrelated.end(); ++it){
38 double cv=it->second.get<
double>(
"cv");
39 double err=it->second.get<
double>(
"err");
45 ptree& uncorrelated_list = top.get_child(
"pars.uncorrelated_list");
46 it = uncorrelated_list.begin();
47 for(; it!=uncorrelated_list.end(); ++it){
56 std::stringstream ss(cvs_string);
57 std::vector<Parameter> tmp_par;
59 std::stringstream sID;
62 name = it->first +
"_" + nameID;
69 std::stringstream sserr(errs_string);
79 ptree& correlated = top.get_child(
"pars.correlated");
80 it = correlated.begin();
81 for(; it!=correlated.end(); ++it){
88 std::stringstream ss(cvs_string);
94 std::stringstream sID;
97 name = it->first +
"_" +nameID;
102 TMatrixD mcov(ii,ii);
104 std::stringstream ssmx(covmx_string);
108 mcov(idx/ii,idx%ii) =
err;
138 double cvfactor = 1.0;
139 if(universe==-1)cvfactor = 0.0;
140 int univ_seed =
baseSeed + universe;
141 r3->SetSeed(univ_seed);
146 double sigma_pc_pip =
r3->Gaus(0.0,1.0);
147 double sigma_pc_pim =
r3->Gaus(0.0,1.0);
148 double sigma_pc_kap =
r3->Gaus(0.0,1.0);
149 double sigma_pc_kam =
r3->Gaus(0.0,1.0);
150 double sigma_pc_p =
r3->Gaus(0.0,1.0);
151 double sigma_pc_n =
r3->Gaus(0.0,1.0);
155 for(;it!=table_uncorr_pars.end();++it){
156 double sigma =
r3->Gaus(0.0,1.0);
158 if((it->first).find(
"ThinTarget_pC_pip_sys")<10)sigma = sigma_pc_pip;
159 if((it->first).find(
"ThinTarget_pC_pim_sys")<10)sigma = sigma_pc_pim;
160 if((it->first).find(
"ThinTargetLowxF_pC_kap_sys")<10)sigma = sigma_pc_kap;
161 if((it->first).find(
"ThinTargetLowxF_pC_kam_sys")<10)sigma = sigma_pc_kam;
162 if((it->first).find(
"ThinTarget_pC_p_sys")<10) sigma = sigma_pc_p;
163 if((it->first).find(
"ThinTarget_pC_n_sys")<10) sigma = sigma_pc_n;
175 bool isPosDef=decomp->Decompose();
176 TMatrixD MxU = decomp->GetU();
180 int nmat = MxV.GetNcols();
181 TVectorD vsigma(nmat);
182 for(
int jj=0;jj<nmat;jj++){
183 vsigma[jj]=cvfactor*(
r3->Gaus(0.0,1.0));
185 TVectorD vecDShift = MxV*vsigma;
190 for(;it_tb != tb.end();++it_tb){
192 std::string snID = tmp_name.substr((it_tb->first).rfind(
"_")+1,(it_tb->first).length());
193 std::stringstream ssID(snID);
196 double new_val = it_tb->second + vecDShift[nID];
213 for(;it!=table_pars.end();it++){
220 const boost::interprocess::flat_map<std::string, double>& corr_table_pars =
correlated_par_tables[ii].getMap();
221 it = corr_table_pars.begin();
222 for(;it != corr_table_pars.end();it++){
A list/table of parameter names and values.
static CentralValuesAndUncertainties * instance
const boost::interprocess::flat_map< std::string, double > & getMap() const
std::pair< std::string, double > Parameter
std::vector< ParameterTable > correlated_par_tables
std::vector< TMatrixD > covariance_matrices
ParameterTable calculateParsForUniverse(int universe)
Calculate a table of randomly varied parameters for a particular universe i. The universe number is u...
ParameterTable uncorrelated_pars
void addUncorrelated(Parameter &cv_par, double uncertainty)
Add a parameter with its central value and its uncertainty. The parameter is specified as uncorrelate...
void err(const char *fmt,...)
boost::interprocess::flat_map< std::string, double > uncorrelated_errors
static CentralValuesAndUncertainties * getInstance()
A class to manage parameter central values and their uncertanities.
ParameterTable getCVPars()
Get the central value parameters.
void addCorrelated(ParameterTable &cv_pars, TMatrixD &cov_mx)
Add a set of parameters with correlated uncertainties. The central values of the parameters must be p...
void setParameter(Parameter p)
add a parameter to the table or, if already there, reset its value
void readFromXML(const char *filename)
Read a xml file name to parse the parameters.
CentralValuesAndUncertainties()
void setBaseSeed(int val)
Set a beggining/base seed to be used in generating random parameter shifts for the many universe meth...