Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
GeneralModelModifier Class Reference

ModelModifier that rewrites SM templates into a target model. More...

#include <GeneralModelModifier.h>

Inheritance diagram for GeneralModelModifier:
Collaboration diagram for GeneralModelModifier:

Public Member Functions

 GeneralModelModifier (std::string wilson, std::string model, std::string model_path, std::optional< int > model_template_index=std::nullopt)
 Constructs a modifier for a given (Wilson, model) pair and model header.
 
 GeneralModelModifier (std::string wilson, std::string output_model, std::string target_model, std::string model_path, std::optional< int > model_template_index, bool disable_non_sm_particles, bool bsm_split_generation=false, bool full_target_generation=false, bool tree_first_fallback=false)
 Constructs a modifier with a separate output label and target model.
 
void modifyLine (std::string &line) override
 Modifies a single line of source code in place.
 
void addLine (std::ofstream &outputFile, const std::string &currentLine) override
 Writes a (possibly modified) line to the output file.
 
- Public Member Functions inherited from ModelModifier
virtual ~ModelModifier ()=default
 Virtual destructor for safe polymorphic use.
 

Static Public Member Functions

static std::string resolveModelInstantiation (const std::string &model, const std::string &model_path, std::optional< int > model_template_index=std::nullopt)
 Resolve the C++ model instantiation used by generated MARTY code.
 
static std::string modelSignature (const std::string &model, const std::string &model_path, std::optional< int > model_template_index=std::nullopt)
 Build the cache signature written in generated analytical files.
 

Additional Inherited Members

- Protected Attributes inherited from ModelModifier
std::string wilson {}
 Name of the Wilson operator basis used in the model.
 

Detailed Description

ModelModifier that rewrites SM templates into a target model.

Responsibilities:

  • Replace occurrences of SM_Model sm; with the resolved target model class, optionally instantiated with a template index when the target class is templated.
  • Replace suffixes like _SM with the matching model name.
  • Inject the appropriate #include lines for the model header and MARTY's main include.

The model class resolver does not force the historical _Model suffix. Given mty_model_name=THDM, it first looks for class THDM, then case variants, and only then tries THDM_Model and its case variants.

For SM-like generation inside a BSM model, the modifier can keep the output suffix _SM while instantiating the target model class and inserting a MARTY filter that disables every particle not present in SM_Model.

Definition at line 46 of file GeneralModelModifier.h.

Constructor & Destructor Documentation

◆ GeneralModelModifier() [1/2]

GeneralModelModifier::GeneralModelModifier ( std::string  wilson,
std::string  model,
std::string  model_path,
std::optional< int >  model_template_index = std::nullopt 
)

Constructs a modifier for a given (Wilson, model) pair and model header.

Parameters
wilsonName of the Wilson basis (stored in the base class).
modelModel name (e.g. "THDM").
model_pathPath to the corresponding model header file.
model_template_indexOptional template index used when the resolved model class is templated, e.g. THDM_Model<2>.

Definition at line 51 of file GeneralModelModifier.cpp.

◆ GeneralModelModifier() [2/2]

GeneralModelModifier::GeneralModelModifier ( std::string  wilson,
std::string  output_model,
std::string  target_model,
std::string  model_path,
std::optional< int >  model_template_index,
bool  disable_non_sm_particles,
bool  bsm_split_generation = false,
bool  full_target_generation = false,
bool  tree_first_fallback = false 
)

Constructs a modifier with a separate output label and target model.

Parameters
wilsonName of the Wilson basis.
output_modelModel label used in generated libraries/files, e.g. SM.
target_modelModel class name to instantiate, e.g. THDM.
model_pathPath to the target model header.
model_template_indexOptional template index for target templated models.
disable_non_sm_particlesIf true, insert a MARTY filter disabling all particles of the target model that are not present in SM_Model.

Definition at line 67 of file GeneralModelModifier.cpp.

Member Function Documentation

◆ addLine()

void GeneralModelModifier::addLine ( std::ofstream &  outputFile,
const std::string &  currentLine 
)
overridevirtual

Writes a (possibly modified) line to the output file.

Default behavior simply writes currentLine followed by a newline. Derived classes can override this to inject additional lines before or after the current one, depending on addBefore.

Parameters
outputFileOutput stream to write to.
currentLineLine to be written.

Reimplemented from ModelModifier.

Definition at line 411 of file GeneralModelModifier.cpp.

◆ modelSignature()

std::string GeneralModelModifier::modelSignature ( const std::string &  model,
const std::string &  model_path,
std::optional< int >  model_template_index = std::nullopt 
)
static

Build the cache signature written in generated analytical files.

Definition at line 120 of file GeneralModelModifier.cpp.

◆ modifyLine()

void GeneralModelModifier::modifyLine ( std::string &  line)
overridevirtual

Modifies a single line of source code in place.

Implementations may, for example, replace occurrences of "SM" with another model name, or adjust class templates.

Parameters
lineThe line of code to modify.

Implements ModelModifier.

Definition at line 376 of file GeneralModelModifier.cpp.

◆ resolveModelInstantiation()

std::string GeneralModelModifier::resolveModelInstantiation ( const std::string &  model,
const std::string &  model_path,
std::optional< int >  model_template_index = std::nullopt 
)
static

Resolve the C++ model instantiation used by generated MARTY code.

Examples: SM, SM_Model, THDM<2>, THDM_Model<2>.

Definition at line 100 of file GeneralModelModifier.cpp.


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