int main(int argc, char** argv) { try { /* Define the name of the model to be used. */ std::string ModelName = "NPEpsilons"; /* Create an object of the class InputParameters. */ InputParameters IP; /* Read a map for the mandatory model parameters. (Default values in InputParameters.h) */ std::map<std::string, double> DPars_IN = IP.getInputParameters(ModelName); /* Change the default values of the mandatory model parameters if necessary. */ /* This can also be done with DPars after creating an object of ComputeObservables. */ DPars_IN["mcharm"] = 1.3; DPars_IN["mub"] = 4.2; /* Create objects of the classes ModelFactory and ThObsFactory */ ModelFactory ModelF; ThObsFactory ThObsF; /* Create an object of the class ComputeObservables. */ ComputeObservables CO(ModelF, ThObsF, ModelName, DPars_IN); /* Add the observables to be returned. */ CO.AddObservable("Mw"); CO.AddObservable("GammaZ"); CO.AddObservable("AFBbottom"); /* Remove a previously added observables if necessary. */ //CO.RemoveObservable("AFBbottom"); /* Set the flags for the model being used, if necessary. */ std::map<std::string, std::string> DFlags; DFlags["epsilon2SM"] = "TRUE"; DFlags["epsilonbSM"] = "TRUE"; CO.setFlags(DFlags); /* Get the map of observables if necessary. */ std::map<std::string, double> DObs = CO.getObservables(); /* Define a map for the parameters to be varied. */ std::map<std::string, double> DPars; for (int i = 0; i < 2; i++) { /* Vary the parameters that need to be varied in the analysis. */ DPars["epsilon_1"] = 0. + i * 0.01; DPars["epsilon_3"] = 0. + i * 0.01; /* Get the map of observables with the parameter values defined above. */ DObs = CO.compute(DPars); std::cout << "\nParameters[" << i + 1 << "]:"<< std::endl; for (std::map<std::string, double>::iterator it = DPars.begin(); it != DPars.end(); it++) { std::cout << it->first << " = " << it->second << std::endl; } std::cout << "\nObservables[" << i + 1 << "]:" << std::endl; for (std::map<std::string, double>::iterator it = DObs.begin(); it != DObs.end(); it++) { std::cout << it->first << " = " << it->second << std::endl; } } return EXIT_SUCCESS; } catch (const std::runtime_error& e) { std::cerr << e.what() << std::endl; return EXIT_FAILURE; } }
double hepfit_call(double *theta, int nDims, double *phi, int nDerived, int index){ std::string selected_pars[nDims] = {"mtop","AlsMz"}; std::string selected_obsvs[nDerived] = {"Mw"}; std::string ModelName = "StandardModel"; /* Create an object of the class InputParameters. */ InputParameters IP; /* Read a map for the mandatory model parameters. (Default values in InputParameters.h) */ std::map<std::string, double> DPars_IN = IP.getInputParameters(ModelName); /* Create objects of the classes ModelFactory and ThObsFactory */ ModelFactory ModelF; ThObsFactory ThObsF; /* Create an object of the class ComputeObservables. */ ComputeObservables CO(ModelF, ThObsF, ModelName, DPars_IN); /* Add the observables to be returned. */ CO.AddObservable( selected_obsvs[0] ); /* Set the flags for the model being used, if necessary. */ // std::map<std::string, std::string> DFlags; // DFlags["epsilon2SM"] = "TRUE"; // CO.setFlags(DFlags); /* Get the map of observables */ std::map<std::string, double> DObs = CO.getObservables(); /* Define a map for the parameters to be varied. */ std::map<std::string, double> DPars; /* Vary the parameters that need to be varied in the analysis. */ // to be obtained from sampler: PolyChord or MultiNest for(int i = 0; i < nDims; i++){ DPars[ selected_pars[i] ] = theta[i]; std::cout << "DPars[ "<< selected_pars[i] << " ] = " << DPars[ selected_pars[i] ]; } /* Get the map of observables with the parameter values defined above. */ DObs = CO.compute(DPars); for (int i = 0; i < nDerived; i++){ phi[i] = DObs[ selected_obsvs[i] ]; std::cout << "DObs[ "<< selected_obsvs[i] << " ] = " << DObs[ selected_obsvs[i] ] << std::endl; } //@@@@ HEPfit should have option for return log-likelihood ?? // compute and retrun log likelihood // Observable: Mw = 80.3613 +- 0.03, say double Mw = 80.3613; double Mw_err = 0.03; double MwPredicted = phi[0]; double chi = (MwPredicted - Mw) / ( sqrt(2.) * Mw_err ); std::cout << "log-likelihood = " << - chi * chi - log( Mw_err * sqrt(2.0 * M_PI) ); return - chi * chi - log( Mw_err * sqrt(2.0 * M_PI) ); }