a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
libmode_config.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 
18 int main(int argc, char** argv)
19 {
20  try {
21 
22  if(argc != 2){
23  /* Print usage and exit. */
24  std::cout << "\nusage: " << argv[0] << " ModelConf.conf\n" << std::endl;
25  return EXIT_SUCCESS;
26  }
27 
28  /* Define the model configuration file. */
29  /* Here it is passed as the first argument to the executable. */
30  /* The model configuration file provides the default values of */
31  /* the mandatory model parameters. */
32  std::string ModelConf = argv[1];
33 
34  /* Define a map for the parameters to be varied. */
35  std::map<std::string, double> DPars;
36 
37  /* Create objects of the classes ModelFactory and ThObsFactory */
38  ModelFactory ModelF;
39  ThObsFactory ThObsF;
40 
41  /* register user-defined model named ModelName defined in class ModelClass using the following syntax: */
42  /* ModelF.addModelToFactory(ModelName, boost::factory<ModelClass*>() ) */
43 
44  /* register user-defined ThObservable named ThObsName defined in class ThObsClass using the following syntax: */
45  /* ThObsF.addObsToFactory(ThObsName, boost::factory<ThObsClass*>() )*/
46 
47  /* Create an object of the class ComputeObservables. */
48  ComputeObservables CO(ModelF, ThObsF, ModelConf);
49 
50  /* Add the observables to be returned. */
51  CO.AddObservable("Mw");
52  CO.AddObservable("GammaZ");
53  CO.AddObservable("AFBbottom");
54 
55  /* Remove a previously added observable if necessary. */
56  //CO.RemoveObservable("AFBbottom");
57 
58  /* Set the flags for the model being used, if necessary. */
59  /* Flags should be initially set in the config files but can be changed here */
60  /* The flags have to correspond to the model specified in the model config file. */
61  std::map<std::string, std::string> DFlags;
62  // DFlags["FLAG"] = "TRUE";
63  CO.setFlags(DFlags);
64 
65  /* Get the map of observables if necessary. */
66  std::map<std::string, double> DObs = CO.getObservables();
67 
68  for (int i = 0; i < 2; i++) {
69 
70  /* Vary the parameters that need to be varied in the analysis. */
71  DPars["Mz"] = 91.1875 + 0.0001 * i;
72  DPars["AlsMz"] = 0.1184 + 0.000001 * i;
73 
74  /* Get the map of observables with the parameter values defined above. */
75  DObs = CO.compute(DPars);
76 
77  std::cout << "\nParameters[" << i + 1 << "]:"<< std::endl;
78  for (std::map<std::string, double>::iterator it = DPars.begin(); it != DPars.end(); it++) {
79  std::cout << it->first << " = " << it->second << std::endl;
80  }
81  std::cout << "\nObservables[" << i + 1 << "]:" << std::endl;
82  for (std::map<std::string, double>::iterator it = DObs.begin(); it != DObs.end(); it++) {
83  std::cout << it->first << " = " << it->second << std::endl;
84  }
85  }
86 
87  return EXIT_SUCCESS;
88  } catch (const std::runtime_error& e) {
89  std::cerr << e.what() << std::endl;
90  return EXIT_FAILURE;
91  }
92 }
ModelFactory
A class for.
Definition: ModelFactory.h:25
main
int main(int argc, char **argv)
Definition: libmode_config.cpp:18
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::setFlags
void setFlags(std::map< std::string, std::string > DFlags_i)
This method sets the necessary flag for the requested model.
Definition: ComputeObservables.cpp:107
ComputeObservables
A class for providing access to the computation of observables without a Monte Carlo run.
Definition: ComputeObservables.h:35
ComputeObservables::compute
std::map< std::string, double > compute(std::map< std::string, double > DP)
The method used to compute observables.
Definition: ComputeObservables.cpp:122
ComputeObservables::AddObservable
void AddObservable(std::string ObsName)
A method to remove an observable from the list of observables.
Definition: ComputeObservables.cpp:147