a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
libmode_header.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 HEPfit Collaboration
3  *
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
15 #include <iostream>
16 #include <HEPfit.h>
17 #include <InputParameters.h>
18 
19 int main(int argc, char** argv)
20 {
21  try {
22 
23  /* Define the name of the model to be used. */
24  std::string ModelName = "NPEpsilons";
25 
26  /* Create an object of the class InputParameters. */
27  InputParameters IP;
28 
29  /* Read a map for the mandatory model parameters. (Default values in InputParameters.h) */
30  std::map<std::string, double> DPars_IN = IP.getInputParameters(ModelName);
31 
32  /* Change the default values of the mandatory model parameters if necessary. */
33  /* This can also be done with DPars after creating an object of ComputeObservables. */
34  DPars_IN["mcharm"] = 1.3;
35  DPars_IN["mub"] = 4.2;
36 
37  /* Create objects of the classes ModelFactory and ThObsFactory */
38  ModelFactory ModelF;
39  ThObsFactory ThObsF;
40 
41  /* Set the flags for the model being used, if necessary. */
42  std::map<std::string, std::string> DFlags;
43  DFlags["epsilon2SM"] = "TRUE";
44  DFlags["epsilonbSM"] = "TRUE";
45 
46  /* Create an object of the class ComputeObservables. */
47  ComputeObservables CO(ModelF, ThObsF, ModelName, DPars_IN, DFlags);
48 
49  /* Add the observables to be returned. */
50  CO.AddObservable("Mw");
51  CO.AddObservable("GammaZ");
52  CO.AddObservable("AFBbottom");
53 
54  /* Remove a previously added observables if necessary. */
55  //CO.RemoveObservable("AFBbottom");
56 
57  /* Get the map of observables if necessary. */
58  std::map<std::string, double> DObs = CO.getObservables();
59 
60  /* Define a map for the parameters to be varied. */
61  std::map<std::string, double> DPars;
62 
63  for (int i = 0; i < 2; i++) {
64 
65  /* Vary the parameters that need to be varied in the analysis. */
66  DPars["epsilon_1"] = 0. + i * 0.01;
67  DPars["epsilon_3"] = 0. + i * 0.01;
68 
69  /* Get the map of observables with the parameter values defined above. */
70  DObs = CO.compute(DPars);
71 
72  std::cout << "\nParameters[" << i + 1 << "]:"<< std::endl;
73  for (std::map<std::string, double>::iterator it = DPars.begin(); it != DPars.end(); it++) {
74  std::cout << it->first << " = " << it->second << std::endl;
75  }
76  std::cout << "\nObservables[" << i + 1 << "]:" << std::endl;
77  for (std::map<std::string, double>::iterator it = DObs.begin(); it != DObs.end(); it++) {
78  std::cout << it->first << " = " << it->second << std::endl;
79  }
80  }
81 
82  return EXIT_SUCCESS;
83  } catch (const std::runtime_error& e) {
84  std::cerr << e.what() << std::endl;
85  return EXIT_FAILURE;
86  }
87 }
ModelFactory
A class for.
Definition: ModelFactory.h:25
main
int main(int argc, char **argv)
Definition: libmode_header.cpp:19
ComputeObservables::getObservables
std::map< std::string, double > getObservables()
A method to get the map of observables.
Definition: ComputeObservables.h:99
ThObsFactory
A class for.
Definition: ThObsFactory.h:26
ComputeObservables
A class for providing access to the computation of observables without a Monte Carlo run.
Definition: ComputeObservables.h:35
InputParameters::getInputParameters
std::map< std::string, double > getInputParameters(std::string &ModelName)
A method that returns the map of the mandatory model parameters given the model name.
Definition: InputParameters.h:39
InputParameters
A class for defining the default values of the mandatory parameters of the model being used on the li...
Definition: InputParameters.h:19
ComputeObservables::compute
std::map< std::string, double > compute(std::map< std::string, double > DP)
The method used to compute observables.
Definition: ComputeObservables.cpp:122
InputParameters.h
ComputeObservables::AddObservable
void AddObservable(std::string ObsName)
A method to remove an observable from the list of observables.
Definition: ComputeObservables.cpp:147