gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
SLHASimpleSpec.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
22 
23 #ifndef __SLHASimpleSpec_hpp__
24 #define __SLHASimpleSpec_hpp__
25 
26 #include "gambit/Elements/spec.hpp"
27 
28 namespace Gambit
29 {
30 
33  {
34  protected:
36  SLHAea::Coll data;
40  std::map<int, int> PDG_translation_map;
41 
42  public:
44  SLHAeaModel();
45  SLHAeaModel(const SLHAea::Coll& input);
47 
49  int slha_version() const;
50 
52  const SLHAea::Coll& get_slhaea() const;
53 
55  const std::map<int, int>& PDG_translator() const;
56 
58  double getdata(const std::string& block, int index) const;
59  double getdata(const std::string& block, int i, int j) const;
60  };
61 
62  template<class Derived>
63  class SLHASimpleSpec : public Spec<Derived>
64  {
65  public:
66  // Grab typedefs from derived wrapper traits class
67  // (only needed because this is a template class, and would have to
68  // qualify the name all over the place in order to use the equivalent
69  // typedef which is inherited from the base class)
72 
73  protected:
74  // Store SLHAea object internally (via wrapper)
75  Model slhawrap;
76 
77  // Dummy placeholder for potential Inputs object
78  Input dummyinput;
79 
80  public:
82 
83  // Constructors/destructors
85  : slhawrap()
86  {}
87 
88  SLHASimpleSpec(const SLHAea::Coll& input_slha)
89  : slhawrap(input_slha)
90  {}
91 
92  virtual ~SLHASimpleSpec() {};
93 
94  // Functions to interface Model and Input objects with the base 'Spec' class
95  // Need both const and non-const versions of it, so that wrapped objects cannot be modified
96  // if the wrapper is const
97  Model& get_Model() { return slhawrap; }
98  Input& get_Input() { return dummyinput; /*unused, but needs to be defined for the interface*/ }
99  const Model& get_Model() const { return slhawrap; }
100  const Input& get_Input() const { return dummyinput; /*unused, but needs to be defined for the interface*/ }
101 
103  void add_to_SLHAea(int, SLHAea::Coll&) const;
104 
106 
108  virtual double GetScale() const
109  {
112  const SLHAea::Coll& data(slhawrap.get_slhaea());
113  double scale = 0.0;
114  try
115  {
116  scale = SLHAea::to<double>(data.at("GAUGE").find_block_def()->at(3));
117  }
118  catch (const std::out_of_range& e)
119  {
120  std::ostringstream errmsg;
121  errmsg << "Could not find block \"GAUGE\" in SLHAea object. Received out_of_range error with message: " << e.what();
122  utils_error().raise(LOCAL_INFO,errmsg.str());
123  }
124  return scale;
125  }
126 
127  virtual void SetScale(double)
128  {
129  // this is actually a bit of a drag since one should go through all the blocks
130  // that have Q defined and set them accordingly. Leave for now.
131  utils_error().raise(LOCAL_INFO,
132  "Call made to SetScale function of SLHASimpleSpec! This is currently not implemented!");
133  }
134 
135  virtual void RunToScaleOverride(double)
136  {
137  utils_error().raise(LOCAL_INFO,
138  "Call made to RunToScale function of SLHASimpleSpec! This is not allowed; this\n"
139  "version of the SubSpectrum wrapper cannot perform RGE It is just a\n"
140  "simple box containing SLHA information read from a file or SLHAea object.\n");
141  }
143 
144  protected:
146 
147  };
148 
150 
152  // NOTE! This is just a kind of catch-all default! Wrappers for particular models
153  // should more carefully extract the model information and perform SLHA2->SLHA1
154  // conversions if required.
155  template<class Derived>
156  void SLHASimpleSpec<Derived>::add_to_SLHAea(int /*slha_version*/, SLHAea::Coll& slha) const
157  {
158  // Get the internal SLHAea data object
159  const SLHAea::Coll& data = get_Model().get_slhaea();
160 
161  // NO version check. Cannot assume that this is required or makes sense for whatever
162  // model this might be. If it does matter, then the wrapper for that model should
163  // replace this function and do the check itself.
164  //int wrapped_slha_version = get_Model().slha_version();
165  //if (slha_version != wrapped_slha_version)
166  //{
167  // std::stringstream x;
168  // x << "Wrapped SLHA file is in SLHA" << wrapped_slha_version << ", but something requested to add it to an SLHAea object in SLHA" << slha_version << " format.";
169  // model_error().raise(LOCAL_INFO, x.str());
170  //}
171 
172  // Make a copy of the internal SLHAea object, remove any SM info from it and add the rest to the slhaea object.
173  // (we will assume that if SM is wanted then it is provided by the SMSimpleSpec wrapper, or similar)
174  SLHAea::Coll data_copy = data;
175  SLHAea::Coll::key_matches target_blocks[4] = { SLHAea::Coll::key_matches("SMINPUTS"), SLHAea::Coll::key_matches("VCKMIN"), SLHAea::Coll::key_matches("UPMNSIN"), SLHAea::Coll::key_matches("MASS") };
176  for (SLHAea::Coll::iterator sblock = slha.begin(); sblock != slha.end(); ++sblock)
177  {
178  for (SLHAea::Coll::iterator dblock = data_copy.begin(); dblock != data_copy.end();)
179  {
180  bool delete_dblock = false;
181  for (int i = 0; i < 3; i++)
182  {
183  if (target_blocks[i](*sblock) and target_blocks[i](*dblock)) delete_dblock = true;
184  }
185  if (delete_dblock) dblock = data_copy.erase(dblock);
186  else ++dblock;
187  }
188  }
189  for (SLHAea::Coll::iterator sblock = slha.begin(); sblock != slha.end();)
190  {
191  if (target_blocks[3](*sblock))
192  {
193  if(slha["MASS"][24].is_data_line()) data_copy["MASS"][24] = slha["MASS"][24];
194  sblock = slha.erase(sblock);
195  }
196  else
197  {
198  ++sblock;
199  }
200  }
201  slha.insert(slha.end(), data_copy.cbegin(), data_copy.cend());
202  }
203 
205 
206 
207 } // end Gambit namespace
208 
209 #endif
Need to forward declare Spec class.
Definition: spec_head.hpp:39
Fully unspecialised MapTypes declaration.
SLHAea::Coll data
SLHAea object.
SLHASimpleSpec(const SLHAea::Coll &input_slha)
EXPORT_SYMBOLS error & utils_error()
Utility errors.
void add_to_SLHAea(int, SLHAea::Coll &) const
Add spectrum information to an SLHAea object.
virtual void SetScale(double)
Manually set the renormalisation scale of parameters somewhat dangerous to allow this but may be need...
SLHAeaModel()
Constructors.
#define LOCAL_INFO
Definition: local_info.hpp:34
const Input & get_Input() const
Some member function definitions from classes in spec_head.hpp.
double getdata(const std::string &block, int index) const
Helper functions to do error checking for SLHAea object contents.
int slha_version() const
Get the SLHA version of the internal SLHAea object.
virtual double GetScale() const
(using bass class version of getSLHAea)
const SLHAea::Coll & get_slhaea() const
Get the internal SLHAea object.
MapTypes< Derived, MapTag::Get > MTget
const std::map< int, int > & PDG_translator() const
PDG code translation map, for special cases where an SLHA file has been read in and the PDG codes cha...
Forward declare base traits class which communicates Model and Input typedefs from the wrapper class ...
Definition: spec_head.hpp:59
SpecTraits< Derived >::Model Model
const Model & get_Model() const
virtual void RunToScaleOverride(double)
Run spectrum to new scale.
int wrapped_slha_version
SLHA version of SLHAea object.
std::map< int, int > PDG_translation_map
PDG translation map (e.g. from SLHA1 to SLHA2 for MSSMskeleton)
TODO: see if we can use this one:
Definition: Analysis.hpp:33
Skeleton "model" class which interacts with an SLHAea object.
SpecTraits< Derived >::Input Input