gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
SpecBit_tests.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
19 
20 #include "gambit/Utils/gambit_module_headers.hpp"
24 #define IN_SPECBIT // Output tests to logger() rather than std::cout when run through SpecBit.
26 
27 // Flexible SUSY stuff (should not be needed by the rest of gambit)
29 #include "flexiblesusy/src/ew_input.hpp"
30 #include "flexiblesusy/src/numerics2.hpp"
31 
32 namespace Gambit
33 {
34 
35  namespace SpecBit
36  {
37  using namespace LogTags;
38  using namespace flexiblesusy;
39 
41  #define QUERYMODELS(MODEL) std::find(Pipe::Models->begin(), Pipe::Models->end(), MODEL) != Pipe::Models->end()
42 
45  {
46  typedef CMSSM_interface<ALGORITHM1> MI;
47  static MI::Model FS_model; //start with empty flexiblesusy object
48  // Or could use flexiblesusy classes directly; these two are equivalent in this case:
49  //static CMSSM_slha<Two_scale> FS_model; //start with empty flexiblesusy object
50 
51  // Create model interface class (leaving input stuff with default values)
52  MI model_interface(FS_model);
53 
54  // Create SubSpectrum object to wrap flexiblesusy object
55  static MSSMSpec<MI> mssm(FS_model);
56 
57  // I think these objects should only get created once since they are static...
58  // ...and they should be destructed automatically when the program ends.
59 
60  setup(mssm.model_interface.model); //fill with some parameters
61  mssm.model_interface.model.calculate_DRbar_parameters(); //calculated DRbar masses
62  mssm.model_interface.model.calculate_pole_masses();//now calculate pole masses
63 
64  // Check contents
65  logger() << "This is specbit_tests. Checking SubSpectrum object contents..." << std::endl;
66  if(TestMssmParGets(mssm, mssm.model_interface.model)==false){
67  logger() << "TestMssmParGets fail." << std::endl;
68  return;
69  }
70  if(TestMssmPoleGets(mssm, mssm.model_interface.model)==false){
71  logger() << "TestMssmPoleGets fail." << std::endl;
72  return;
73  }
74  //So now we have a mssm1 model object filled, as it will be
75  //stored in Gambit after the spectrum generator has run
76  // mssm.mass2_par_mapping(); //call mapping - this needs to be changed.
77 
78  mssm_manipulate(mssm); //function can manipulate knowing the model
79 
80  // Store result for gambit to use
81  result = &mssm;
82  }
83 
85  void specbit_test_func1 (double &result)
86  {
87  // Access the pipes for this function to get model and parameter information
88  using namespace Pipes::specbit_test_func1;
89  std::cout << "Running specbit_test_func1" << std::endl;
90  std::cout << "Retrieving Spectrum*" << std::endl;
91  /*TAG*/ Spectrum spec = *Dep::MSSM_spectrum;
92 
93  std::cout << "Running spec_manipulate" << std::endl;
94  // Clone the UV Spectum object so we can access a non-const version
95  std::unique_ptr<SubSpectrum> spec2 = spec->get_UV()->clone();
96 
97  spec_manipulate(*spec2); //function can manipulate without knowing model.
98  }
99 
101  void specbit_test_func2 (double &result)
102  {
103  std::cout << "Running specbit_test_func2" << std::endl;
104 
105  // TESTING
106  // Direct access to flexiblesusy function, for testing
107  std::cout << "Creating CMSSM_slha<Two_scale> object" << std::endl;
108  CMSSM_slha<Two_scale> FS_model; //start with empty flexiblesusy object
109 
110  // Create model interface class (leaving input stuff with default values)
111  std::cout << "Creating CMSSM_interface<Two_scale> object" << std::endl;
112  CMSSM_interface<Two_scale> model_interface(FS_model);
113 
114  // Create SubSpectrum object to wrap flexiblesusy object
115  std::cout << "Creating MSSMSpec<CMSSM_interface<Two_scale>> object" << std::endl;
116  MSSMSpec<CMSSM_interface<Two_scale>> mssm(model_interface);
117 
118  // Test run functions
119  std::cout << "SubSpectrum via MSSMSpec" << std::endl;
120  std::cout << "mssm.GetScale() ="
121  << mssm.GetScale() << std::endl;
122  std::cout << "mHd2 = "
123  << mssm.get_mass2_parameter("mHd2") << std::endl;
124  std::cout << "mHu2 = "
125  << mssm.get_mass2_parameter("mHu2") << std::endl;
126 
127  // Do it again using a SubSpectrum base pointer
128  SubSpectrum* spec = &mssm;
129  std::cout << "SubSpectrum via SubSpectrum*" << std::endl;
130  std::cout << "spec->GetScale() ="
131  << spec->GetScale() << std::endl;
132  std::cout << "mHd2 = "
133  << spec->get_mass2_parameter("mHd2") << std::endl;
134  std::cout << "mHu2 = "
135  << spec->get_mass2_parameter("mHu2") << std::endl;
136 
137  // Fill the model and do it again
138  std::cout << "SubSpectrum via SubSpectrum* (filled)" << std::endl;
139  setup(mssm.model_interface.model);
140  std::cout << "spec->GetScale() ="
141  << spec->GetScale() << std::endl;
142  std::cout << "mHd2 = "
143  << spec->get_mass2_parameter("mHd2") << std::endl;
144  std::cout << "mHu2 = "
145  << spec->get_mass2_parameter("mHu2") << std::endl;
146 
147  }
148 
150  void specbit_test_func3 (double &result)
151  {
152  // Requests a SubSpectrum object of capability SM_spectrum; test what we can retrieve from this
153  using namespace Pipes::specbit_test_func3;
154  const SubSpectrum* spec = *Dep::SM_subspectrum; //Test retrieve pointer to Spectrum object
155 
156  std::unique_ptr<SubSpectrum> spec2 = spec->clone();
157 
158  SM_checks(*spec2); // Run some tests on standard model parameters
159  logger() << EOM;
160  result = 0;
161  }
162 
164  void specbit_test_Spectrum (double &result)
165  {
166  using namespace Pipes::specbit_test_Spectrum;
167  /*TAG*/ Spectrum matched_spectra = *Dep::MSSM_spectrum;
168  const SubSpectrum* sm = *Dep::SM_subspectrum;
169  bool noRGE = runOptions->getValueOrDef<bool>(0,"noRGE"); // don't test running on skeleton Spectrum wrappers
170  logger() << "Running specbit_test_Spectrum with noRGE="<<noRGE<<std::endl;
171  logger() << EOM;
172  Spectrum_test(matched_spectra,sm,noRGE); // Run consistency tests on Spectrum contents vs SMInputs
173  logger() << EOM;
174  result = 0;
175  }
176 
178  void specbit_test_show_SMInputs(double &result)
179  {
180  using namespace Pipes::specbit_test_show_SMInputs;
181  const SMInputs sminputs = *Dep::SMINPUTS;
182  logger() << "Contents of SMInputs struct:" << std::endl;
183  logger() << "alphainv: " << sminputs.alphainv << std::endl;
184  logger() << "GF : " << sminputs.GF << std::endl;
185  logger() << "alphaS : " << sminputs.alphaS << std::endl;
186  logger() << "mZ : " << sminputs.mZ << std::endl;
187  logger() << "mE : " << sminputs.mE << std::endl;
188  logger() << "mMu : " << sminputs.mMu << std::endl;
189  logger() << "mTau : " << sminputs.mTau << std::endl;
190  logger() << "mNu1 : " << sminputs.mNu1 << std::endl;
191  logger() << "mNu2 : " << sminputs.mNu2 << std::endl;
192  logger() << "mNu3 : " << sminputs.mNu3 << std::endl;
193  logger() << "mD : " << sminputs.mD << std::endl;
194  logger() << "mU : " << sminputs.mU << std::endl;
195  logger() << "mS : " << sminputs.mS << std::endl;
196  logger() << "mCmC : " << sminputs.mCmC << std::endl;
197  logger() << "mBmB : " << sminputs.mBmB << std::endl;
198  logger() << "mT : " << sminputs.mT << std::endl;
199  logger() << EOM;
200  result = 0;
201  }
202 
204  void test_Singlet_spectrum(bool &result)
205  {
206  using namespace Pipes::test_Singlet_spectrum;
207  /*TAG*/ Spectrum spec = *Dep::SingletDM_spectrum;
208  logger() << "Parameters from SingletDM_spectrum:" << std::endl;
209  logger() << "Higgs pole mass : " << spec->get_Pole_Mass("h0_1") << std::endl;
210  logger() << "Higgs VEV : " << spec->get_UV()->get_mass_parameter("v0") << std::endl;
211  logger() << "Singlet pole mass: " << spec->get_Pole_Mass("S") << std::endl;
212  logger() << EOM;
213 
214  logger() << "Parameters directly from ModelParameters functors:" << std::endl;
215  logger() << "Higgs pole mass : " << *Param.at("mH") << std::endl;
216  logger() << "Higgs VEV : " << *Param.at("vev") << std::endl;
217  logger() << "Singlet pole mass: " << *Param.at("mass") << std::endl;
218  logger() << EOM;
219 
220  result = 0;
221 
222  }
223 
224  } // end namespace SpecBit
225 } // end namespace Gambit
226 
Rollcall header for module SpecBit.
virtual std::unique_ptr< SubSpectrum > clone() const =0
Clone the SubSpectrum object.
MSSM derived version of SubSpectrum class.
bool TestMssmParGets(SubSpectrum *spec, M FSmssm)
virtual double GetScale() const
Returns the renormalisation scale of parameters.
Definition: MSSMSpec.hpp:198
bool TestMssmPoleGets(SubSpectrum *spec, M FSmssm)
virtual double GetScale() const
Returns the renormalisation scale of parameters.
Flexiblesusy model header includes for SpecBit.
void specbit_test_show_SMInputs(double &result)
Display SMInputs values.
void specbit_test_func1(double &result)
Function to test out SpecBit features.
void SM_checks(Gambit::SubSpectrum &SM)
void test_Singlet_spectrum(bool &result)
Check that the SingletDM spectrum object is working.
void mssm_manipulate(Gambit::SpecBit::MSSMSpec< M > &mssm)
void specbit_test_func2(double &result)
Function to test out SpecBit features.
const Logging::endofmessage EOM
Explicit const instance of the end of message struct in Gambit namespace.
Definition: logger.hpp:100
void setup(Model &mssm)
EXPORT_SYMBOLS Logging::LogMaster & logger()
Function to retrieve a reference to the Gambit global log object.
Definition: logger.cpp:95
void spec_manipulate(Gambit::SubSpectrum &spec)
Test functions for Spectrum object.
void specbit_test_Spectrum(double &result)
Test out consistency of Spectrum object (and pre-extracted SM SubSpectrum*)
Virtual base class for interacting with spectrum generator output.
Definition: subspectrum.hpp:87
void specbit_test_func3(double &result)
Function to test out SpecBit features.
void make_test_spectrum(SubSpectrum *&result)
Create a spectrum object for testing purposes.
void Spectrum_test(Spectrum matched_spectra, const SubSpectrum *smin, bool SLHAonly=0)
Spectrum Spectrum Spectrum Spectrum Spectrum Spectrum Spectrum Spectrum SMINPUTS
TODO: see if we can use this one:
Definition: Analysis.hpp:33
"Standard Model" (low-energy) plus high-energy model container class
Definition: spectrum.hpp:110
Container class for Standard Model input information (defined as in SLHA2)
Definition: sminputs.hpp:29