gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool

Base class for defining the required contents of a SubSpectrum object. More...

#include <subspectrum_contents.hpp>

Inheritance diagram for Gambit::SubSpectrumContents:
Collaboration diagram for Gambit::SubSpectrumContents:

Public Member Functions

std::string getName () const
 
std::vector< SpectrumParameterall_parameters () const
 Function to retreive all parameters. More...
 
std::vector< SpectrumParameterall_parameters_with_tag (Par::Tags tag) const
 Function to retreive all parameters matching a certain tag. More...
 
std::vector< SpectrumParameterall_parameters_with_tag_and_shape (Par::Tags tag, std::vector< int > &shape) const
 Function to retrieve all parameters matching a certain tag and shape. More...
 
std::vector< SpectrumParameterall_BSM_parameters () const
 Function to retrieve all parameters whose blockName is not SMINPUTS, YUKAWA, CKMBLOCK, or empty. More...
 
void verify_contents (const SubSpectrum &spec) const
 Function to verify that a SubSpectrum wrapper contains everything that this class says it should. More...
 

Protected Member Functions

void addParameter (const Par::Tags tag, const std::string &name, const std::vector< int > &shape=initVector(1), const std::string &blockname="", const int index=0)
 Add a parameter to the Contents object. More...
 
void setName (const std::string &name)
 Set the name of this Contents object (i.e. the name of the model to which this spectrum data applies) More...
 

Private Attributes

std::vector< SpectrumParameterparameters
 Vector defining what parameters a wrapper must contain. More...
 
std::string my_name
 Name of SubSpectrumContents class (for more helpful error messages) More...
 

Detailed Description

Base class for defining the required contents of a SubSpectrum object.

Definition at line 58 of file subspectrum_contents.hpp.

Member Function Documentation

◆ addParameter()

void Gambit::SubSpectrumContents::addParameter ( const Par::Tags  tag,
const std::string &  name,
const std::vector< int > &  shape = initVector(1),
const std::string &  blockname = "",
const int  index = 0 
)
protected

◆ all_BSM_parameters()

std::vector< SpectrumParameter > Gambit::SubSpectrumContents::all_BSM_parameters ( ) const

Function to retrieve all parameters whose blockName is not SMINPUTS, YUKAWA, CKMBLOCK, or empty.

Function to retrieve all parameters whose blockname is not SMINPUTS, YUKAWA, CKMBLOCK, or empty.

Definition at line 67 of file subspectrum_contents.cpp.

References parameters.

Referenced by Gambit::add_SimpleSpec_to_SLHAea().

68  {
69  std::vector<SpectrumParameter> search_result;
70  for ( std::vector<SpectrumParameter>::const_iterator it=parameters.begin(); it!=parameters.end(); ++it)
71  {
72  if(it->blockname() != "SMINPUTS" || it->blockname() != "YUKAWA" || it->blockname() != "CKMBLOCK" || it->blockname() != "")
73  {
74  search_result.push_back(*it);
75  }
76  }
77  return search_result;
78  }
std::vector< SpectrumParameter > parameters
Vector defining what parameters a wrapper must contain.
Here is the caller graph for this function:

◆ all_parameters()

std::vector< SpectrumParameter > Gambit::SubSpectrumContents::all_parameters ( ) const

◆ all_parameters_with_tag()

std::vector< SpectrumParameter > Gambit::SubSpectrumContents::all_parameters_with_tag ( Par::Tags  tag) const

Function to retreive all parameters matching a certain tag.

Definition at line 45 of file subspectrum_contents.cpp.

References parameters.

Referenced by Gambit::SpecBit::check_perturb_MDM(), Gambit::SpecBit::find_min_lambda_MDM(), Gambit::SpecBit::find_min_lambda_ScalarSingletDM_Z2(), and Gambit::SpecBit::find_min_lambda_ScalarSingletDM_Z3().

46  {
47  std::vector<SpectrumParameter> search_result;
48  for( std::vector<SpectrumParameter>::const_iterator it=parameters.begin(); it!=parameters.end(); ++it )
49  {
50  if(it->tag() == tag) search_result.push_back(*it);
51  }
52  return search_result;
53  }
std::vector< SpectrumParameter > parameters
Vector defining what parameters a wrapper must contain.
Here is the caller graph for this function:

◆ all_parameters_with_tag_and_shape()

std::vector< SpectrumParameter > Gambit::SubSpectrumContents::all_parameters_with_tag_and_shape ( Par::Tags  tag,
std::vector< int > &  shape 
) const

Function to retrieve all parameters matching a certain tag and shape.

Definition at line 56 of file subspectrum_contents.cpp.

References parameters.

57  {
58  std::vector<SpectrumParameter> search_result;
59  for( std::vector<SpectrumParameter>::const_iterator it=parameters.begin(); it!=parameters.end(); ++it )
60  {
61  if(it->tag() == tag and it->shape() == shape) search_result.push_back(*it);
62  }
63  return search_result;
64  }
std::vector< SpectrumParameter > parameters
Vector defining what parameters a wrapper must contain.

◆ getName()

std::string Gambit::SubSpectrumContents::getName ( ) const
inline

Definition at line 72 of file subspectrum_contents.hpp.

References Gambit::SpectrumParameter::my_name, and Gambit::SpectrumParameter::shape().

72 {return my_name;}
std::string my_name
Name of SubSpectrumContents class (for more helpful error messages)
Here is the call graph for this function:

◆ setName()

void Gambit::SubSpectrumContents::setName ( const std::string &  name)
protected

◆ verify_contents()

void Gambit::SubSpectrumContents::verify_contents ( const SubSpectrum spec) const

Function to verify that a SubSpectrum wrapper contains everything that this class says it should.

Verify that the supplied SubSpectrum object conforms to the requirements specified by the Contents class.

Definition at line 82 of file subspectrum_contents.cpp.

References all_parameters(), Gambit::SubSpectrum::has(), LOCAL_INFO, my_name, and Gambit::utils_error().

83  {
84  const std::vector<SpectrumParameter> required_parameters = all_parameters();
85 
86  for(std::vector<SpectrumParameter>::const_iterator it = required_parameters.begin();
87  it != required_parameters.end(); ++it)
88  {
89  const Par::Tags tag = it->tag();
90  const std::string name = it->name();
91  const std::vector<int> shape = it->shape();
92 
93  // Deal with empty shape case
94  if(shape.size()==0)
95  {
96  // ERROR, please use length 1 vector for scalar case
97  std::ostringstream errmsg;
98  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
99  errmsg << "Encountered a required parameter ("<<Par::toString.at(tag)<<", "<<name<<") with shape.size()==0. This is not allowed; if you want this parameter to be considered a scalar, please set the shape to '1', i.e. std::vector<int> shape = initVector(1). Please fix this parameter in the SubSpectrumContents class." << std::endl;
100  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
101  }
102  // Check scalar case
103  else if(shape.size()==1 and shape[0]==1)
104  {
105  if(not spec.has(tag,name))
106  {
107  // ERROR, Required parameter not found
108  std::ostringstream errmsg;
109  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
110  errmsg << "Required scalar-valued parameter ("<<Par::toString.at(tag)<<", "<<name<<") is not accessible via subspectrum->get(Par::"<<Par::toString.at(tag)<<", \""<<name<<"\"). Please fix the relevant SubSpectrum wrapper class so that this parameter can be accessed." << std::endl;
111  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
112  }
113  }
114  // Check vector case
115  else if(shape.size()==1 and shape[0]>1)
116  {
117  if(shape[0]<0)
118  {
119  // ERROR, asked for negative length vector
120  std::ostringstream errmsg;
121  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
122  errmsg << "Encountered a vector-valued required parameter ("<<Par::toString.at(tag)<<", "<<name<<") with negative required length ("<<shape[0]<<")! This is invalid; Please fix this parameter in the SubSpectrumContents class so that the required length is a positive number." << std::endl;
123  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
124  }
125  else
126  {
127  for(int i = 1; i<=shape[0]; ++i) {
128  if(not spec.has(tag,name,i))
129  {
130  // ERROR, Required parameter not found
131  std::ostringstream errmsg;
132  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
133  errmsg << "An entry of the required vector-valued parameter ("<<Par::toString.at(tag)<<", "<<name<<") with required length "<<shape[0]<<" is not accessible via subspectrum->get(Par::"<<Par::toString.at(tag)<<", \""<<name<<"\", "<<i<<"). Please fix the relevant SubSpectrum wrapper class so that this parameter can be accessed. Keep in mind that you may need to override index_offset() to align the expected indices." << std::endl;
134  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
135  }
136  }
137  }
138  }
139  // Check matrix case
140  else if(shape.size()==2)
141  {
142  if(shape[0]<0 or shape[1]<0)
143  {
144  // ERROR, asked for negative matrix dimensions
145  std::ostringstream errmsg;
146  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
147  errmsg << "Encountered a matrix-valued required parameter ("<<Par::toString.at(tag)<<", "<<name<<") with at least one negative required dimension (dims = ["<<shape[0]<<", "<<shape[1]<<"])! This is invalid; Please fix the shape settings for this parameter in the SubSpectrumContents so that they are positive numbers." << std::endl;
148  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
149  }
150  else
151  {
152  for(int i = 1; i<=shape[0]; ++i) {
153  for(int j = 1; j<=shape[0]; ++j) {
154  if(not spec.has(tag,name,i,j))
155  {
156  // ERROR, Required parameter not found
157  std::ostringstream errmsg;
158  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
159  errmsg << "An entry of the required matrix-valued parameter ("<<Par::toString.at(tag)<<", "<<name<<") with required dimensions ("<<shape[0]<<", "<<shape[1]<<") is not accessible via subspectrum->get(Par::"<<Par::toString.at(tag)<<", \""<<name<<"\", "<<i<<", "<<j<<"). Please fix the relevant SubSpectrum wrapper class so that this parameter can be accessed. Keep in mind that you may need to override index_offset() to align the expected indices." << std::endl;
160  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
161  }
162  }
163  }
164  }
165  }
166  // Deal with all other cases
167  else
168  {
169  // ERROR invalid shape
170  std::ostringstream errmsg;
171  errmsg << "Error while verifying contents of SubSpectrum object against SubSpectrumContents object with name \""<<my_name<<"\" !" << std::endl;
172  errmsg << "The specified shape for the required parameter ("<<Par::toString.at(tag)<<", "<<name<<") is invalid. The length of the shape vector is only permitted to be 1 or 2 (received shape vector was "<<shape<<"). Please fix this parameter entry in the SubSpectrumContents class."<<std::endl;
173  utils_error().forced_throw(LOCAL_INFO,errmsg.str());
174  }
175  }
176  // End constructor
177  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
std::string my_name
Name of SubSpectrumContents class (for more helpful error messages)
std::vector< SpectrumParameter > all_parameters() const
Function to retreive all parameters.
Here is the call graph for this function:

Member Data Documentation

◆ my_name

std::string Gambit::SubSpectrumContents::my_name
private

Name of SubSpectrumContents class (for more helpful error messages)

Definition at line 65 of file subspectrum_contents.hpp.

Referenced by setName(), and verify_contents().

◆ parameters

std::vector<SpectrumParameter> Gambit::SubSpectrumContents::parameters
private

Vector defining what parameters a wrapper must contain.

Definition at line 62 of file subspectrum_contents.hpp.

Referenced by addParameter(), all_BSM_parameters(), all_parameters(), all_parameters_with_tag(), and all_parameters_with_tag_and_shape().


The documentation for this class was generated from the following files: