gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
slhaea_helpers.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
23 
24 #ifndef __slha_helpers_hpp__
25 #define __slha_helpers_hpp__
26 
30 
31 #include "SLHAea/slhaea.h"
32 
33 
34 namespace Gambit
35 {
37  class SubSpectrum;
38 
40  typedef SLHAea::Coll SLHAstruct;
41 
43  SLHAstruct read_SLHA(str slha);
44 
46  double SLHAea_get(const SLHAstruct& slha, const str& block, const int index);
47 
49  double SLHAea_get(const SLHAstruct& slha, const str& block, const int index, const double defvalue);
50 
52  void SLHAea_add_block(SLHAstruct&, const str& name, const double scale = -1);
53 
55  void SLHAea_delete_block(SLHAstruct& slha, const std::string& block);
56 
58  bool SLHAea_block_exists(SLHAstruct& slha, const str& block);
60  bool SLHAea_check_block(SLHAstruct& slha, const str& block);
62  bool SLHAea_check_block(SLHAstruct& slha, const str& block, const int index); /*, const bool overwrite)*/
63  bool SLHAea_check_block(SLHAstruct& slha, const str& block, const int index1, const int index2);
64 
66  void SLHAea_add_GAMBIT_SPINFO(SLHAstruct& slha /*modify*/);
67 
70  void SLHAea_add(SLHAstruct& slha /*modify*/, const str& block, const int index, const double value,
71  const str& comment="", const bool overwrite=false);
72  void SLHAea_add(SLHAstruct& slha /*modify*/, const str& block, const int index, const str& value,
73  const str& comment="", const bool overwrite=false);
74  void SLHAea_add(SLHAstruct& slha /*modify*/, const str& block, const int index, const int value,
75  const str& comment="", const bool overwrite=false);
76  // two index version
77  void SLHAea_add(SLHAstruct& slha /*modify*/, const str& block, const int index1, const int index2,
78  const double& value, const str& comment, const bool overwrite=false);
80 
82  template<typename T>
83  void SLHAea_add_matrix(SLHAstruct& slha /*modify*/, const str& block, const std::vector<T>& matrix,
84  const int rows, const int cols, const str& comment="", const bool overwrite=false)
85  {
86  if (SLHAea_check_block(slha, block, 1, overwrite)) return;
87  std::ostringstream commentwhash;
88  if (comment != "") commentwhash << "# " << comment;
89  for (int i = 0; i < rows; i++) for (int j = 0; j < cols; j++)
90  {
91  slha[block][""] << i+1 << j+1 << matrix.at(i*rows + j) << commentwhash.str();
92  }
93  return;
94  }
95 
97  void SLHAea_add_from_subspec(SLHAstruct& slha /*modify*/, const str local_info, const SubSpectrum& subspec,
98  const Par::Tags partype, const std::pair<int, int>& pdg_pair, const str& block, const str& comment,
99  const bool error_if_missing = true, const double rescale = 1.0);
100 
102  void SLHAea_add_from_subspec(SLHAstruct& slha /*modify*/, const str local_info, const SubSpectrum& subspec,
103  const Par::Tags partype, const str& name, const str& block, const int slha_index,
104  const str& comment, const bool error_if_missing = true, const double rescale = 1.0);
105 
107  void SLHAea_add_from_subspec(SLHAstruct& slha /*modify*/, const str local_info, const SubSpectrum& subspec,
108  const Par::Tags partype, const str& name, const int index1, const int index2, const str& block,
109  const int slha_index1, const int slha_index2, const str& comment, const bool error_if_missing = true, const double rescale = 1.0);
110 
111 }
112 
113 #endif //defined __slhaea_helpers_hpp__
114 
115 
116 
void SLHAea_add_block(SLHAstruct &, const str &name, const double scale=-1)
Add a new block to an SLHAea object, with our without a scale.
SLHAstruct read_SLHA(str slha)
Read an SLHA file in to an SLHAea object with some error-checking.
General small utility classes, typedefs, etc.
T * matrix(const int xN)
Definition: random_tools.hpp:9
void SLHAea_add_GAMBIT_SPINFO(SLHAstruct &slha)
Write the SPINFO block with GAMBIT name and version number.
void SLHAea_add(SLHAstruct &slha, const str &block, const int index, const double value, const str &comment="", const bool overwrite=false)
Add an entry to an SLHAea object (if overwrite=false, only if it doesn&#39;t already exist) ...
SLHAea::Coll SLHAstruct
Less confusing name for SLHAea container class.
bool SLHAea_block_exists(SLHAstruct &slha, const str &block)
Check if a block exists in an SLHAea object.
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Virtual base class for interacting with spectrum generator output.
Definition: subspectrum.hpp:87
void SLHAea_delete_block(SLHAstruct &slha, const std::string &block)
Delete an entire block from an SLHAea object, if it exists (actually just the first block matching th...
Exception objects required for standalone compilation.
void SLHAea_add_matrix(SLHAstruct &slha, const str &block, const std::vector< T > &matrix, const int rows, const int cols, const str &comment="", const bool overwrite=false)
Add a whole matrix to an SLHAea object if it doesn&#39;t already exist.
double SLHAea_get(const SLHAstruct &slha, const str &block, const int index)
Get an entry from an SLHAea object as a double, with some error checking.
Helpers for using the spectrum and subspectrum classes.
void SLHAea_add_from_subspec(SLHAstruct &slha, const str local_info, const SubSpectrum &subspec, const Par::Tags partype, const std::pair< int, int > &pdg_pair, const str &block, const str &comment, const bool error_if_missing=true, const double rescale=1.0)
Add an entry from a subspectrum getter to an SLHAea object; SLHA index given by pdg code...
TODO: see if we can use this one:
Definition: Analysis.hpp:33
bool SLHAea_check_block(SLHAstruct &slha, const str &block)
Check if a block exists in an SLHAea object, add it if not.