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

High-level interface to MARTY-based code generation and execution. More...

#include <MartyInterface.h>

Public Member Functions

 MartyInterface (std::shared_ptr< ICoreAPI< Model > > core_api, std::shared_ptr< IMartyParameterProxy< std::string, LhaID > > sm_proxy, std::shared_ptr< IInterpreterPortsFactory > ports, std::shared_ptr< IMartyParameterProxy< std::string, LhaID > > bsm_proxy=nullptr)
 Constructs a MartyInterface with explicit dependencies.
 
 MartyInterface ()
 Default constructor wiring default implementations.
 
void generate (std::string wilson, std::string model, std::string model_path)
 Generates a non-numeric MARTY-powered C++ template.
 
void generate (std::string wilson, std::string output_model, std::string target_model, std::string model_path, bool sm_like_filter, bool bsm_split_generation=false, bool full_target_generation=false)
 Generates code with a separate output label and target model.
 
void compile_run (std::string wilson, std::string model)
 Compiles and runs the non-numeric generated code.
 
void generate_numlib (std::string wilson, std::string model)
 Generates the numeric library wrapper for a given (Wilson, model) pair.
 
void generate_numlib (std::string wilson, std::string output_model, std::string target_model, bool bsm_split_generation=false, bool full_target_generation=false)
 Generates the numeric wrapper while resolving parameters against a target model that may differ from the output/cache label.
 
void compile_run_libs (std::string wilson, std::string model, double Q_match)
 Compiles and runs the numeric libraries.
 
void calculate (std::string wilson, std::string model, double Q_match, std::string model_path)
 Convenience shortcut to generate, compile, and run the full pipeline.
 
void calculate (std::string wilson, std::string output_model, std::string target_model, double Q_match, std::string model_path, bool sm_like_filter, bool bsm_split_generation=false, bool full_target_generation=false)
 Full pipeline with a separate output label and target model.
 
std::string calculate_isolated (std::string wilson, std::string output_model, std::string target_model, double Q_match, std::string model_path, bool sm_like_filter, bool bsm_split_generation=false, bool full_target_generation=false)
 Thread-safe calculation using invocation-local parameter and CSV files.
 
std::unordered_set< InterpretedParamget_dependencies (std::string wilson)
 Retrieves the set of parameter dependencies for a given Wilson basis.
 
std::set< std::string > get_special_blocks ()
 Returns the special blocks handled with custom logic.
 

Detailed Description

High-level interface to MARTY-based code generation and execution.

MartyInterface orchestrates the following steps:

It can be constructed either with explicit dependencies (core API, parameter proxies, interpreter ports) or using the default constructor, which wires default implementations together.

Definition at line 58 of file MartyInterface.h.

Constructor & Destructor Documentation

◆ MartyInterface() [1/2]

MartyInterface::MartyInterface ( std::shared_ptr< ICoreAPI< Model > >  core_api,
std::shared_ptr< IMartyParameterProxy< std::string, LhaID > >  sm_proxy,
std::shared_ptr< IInterpreterPortsFactory ports,
std::shared_ptr< IMartyParameterProxy< std::string, LhaID > >  bsm_proxy = nullptr 
)
inline

Constructs a MartyInterface with explicit dependencies.

Parameters
core_apiShared pointer to the core API exposing the active Model.
sm_proxyProxy used to access SM parameters (blocks, LHA IDs).
portsFactory used to build interpreter ports (resolvers, mapping adapters).
bsm_proxyOptional proxy for BSM parameters; may be null if not needed.

Definition at line 68 of file MartyInterface.h.

◆ MartyInterface() [2/2]

MartyInterface::MartyInterface ( )

Default constructor wiring default implementations.

Internally:

Definition at line 244 of file MartyInterface.cpp.

Member Function Documentation

◆ calculate() [1/2]

void MartyInterface::calculate ( std::string  wilson,
std::string  model,
double  Q_match,
std::string  model_path 
)

Convenience shortcut to generate, compile, and run the full pipeline.

Orchestrates:

Parameters
wilsonWilson basis name.
modelModel name.
Q_matchMatching scale for numeric libraries.
model_pathPath to the C++ model header.

Definition at line 367 of file MartyInterface.cpp.

◆ calculate() [2/2]

void MartyInterface::calculate ( std::string  wilson,
std::string  output_model,
std::string  target_model,
double  Q_match,
std::string  model_path,
bool  sm_like_filter,
bool  bsm_split_generation = false,
bool  full_target_generation = false 
)

Full pipeline with a separate output label and target model.

Definition at line 371 of file MartyInterface.cpp.

◆ calculate_isolated()

std::string MartyInterface::calculate_isolated ( std::string  wilson,
std::string  output_model,
std::string  target_model,
double  Q_match,
std::string  model_path,
bool  sm_like_filter,
bool  bsm_split_generation = false,
bool  full_target_generation = false 
)

Thread-safe calculation using invocation-local parameter and CSV files.

Generated analytical/numeric artifacts remain shared and read-only after construction, while each evaluation receives its own run directory. The returned CSV path is owned by the caller and may be removed after reading.

Definition at line 539 of file MartyInterface.cpp.

◆ compile_run()

void MartyInterface::compile_run ( std::string  wilson,
std::string  model 
)

Compiles and runs the non-numeric generated code.

Uses GppCompilerStrategy to:

  • compile the generated C++ file,
  • run the resulting executable, unless a compiled binary already exists.
Parameters
wilsonName of the Wilson basis.
modelModel name.

Definition at line 252 of file MartyInterface.cpp.

◆ compile_run_libs()

void MartyInterface::compile_run_libs ( std::string  wilson,
std::string  model,
double  Q_match 
)

Compiles and runs the numeric libraries.

Uses MakeCompilerStrategy to:

  • build the numeric library in the appropriate directory,
  • run it using a given matching scale Q_match.
Parameters
wilsonWilson basis name.
modelModel name.
Q_matchMatching scale passed to the numeric executable.

Definition at line 357 of file MartyInterface.cpp.

◆ generate() [1/2]

void MartyInterface::generate ( std::string  wilson,
std::string  model,
std::string  model_path 
)

Generates a non-numeric MARTY-powered C++ template.

This creates a C++ file (e.g. for calling a Wilson calculator) by:

Parameters
wilsonName of the Wilson basis.
modelTarget model name (e.g. "SM", "THDM").
model_pathFilesystem path to the model header used in the template.

Definition at line 264 of file MartyInterface.cpp.

◆ generate() [2/2]

void MartyInterface::generate ( std::string  wilson,
std::string  output_model,
std::string  target_model,
std::string  model_path,
bool  sm_like_filter,
bool  bsm_split_generation = false,
bool  full_target_generation = false 
)

Generates code with a separate output label and target model.

This is used for SM-like contributions in an extended model: output files and libraries keep the SM label, but the generated code instantiates the target BSM model and may filter out non-SM particles.

Definition at line 268 of file MartyInterface.cpp.

◆ generate_numlib() [1/2]

void MartyInterface::generate_numlib ( std::string  wilson,
std::string  model 
)

Generates the numeric library wrapper for a given (Wilson, model) pair.

This step:

Parameters
wilsonWilson basis name.
modelModel name.
Q_matchMatching scale (GeV) used later by libraries (currently forwarded to compilation stage).

Definition at line 309 of file MartyInterface.cpp.

◆ generate_numlib() [2/2]

void MartyInterface::generate_numlib ( std::string  wilson,
std::string  output_model,
std::string  target_model,
bool  bsm_split_generation = false,
bool  full_target_generation = false 
)

Generates the numeric wrapper while resolving parameters against a target model that may differ from the output/cache label.

This is needed for SM-like calculations inside a BSM model: generated files keep the SM label, but the analytic expression may still depend on target-model parameters such as THDM beta.

Definition at line 313 of file MartyInterface.cpp.

◆ get_dependencies()

std::unordered_set< InterpretedParam > MartyInterface::get_dependencies ( std::string  wilson)

Retrieves the set of parameter dependencies for a given Wilson basis.

The dependencies are discovered via numeric template generation, and correspond to the set of InterpretedParam used in the numeric code.

Parameters
wilsonWilson basis name.
Returns
Set of interpreted parameters required for this basis.
Exceptions
Ifthe wilson key is unknown in the internal cache, a logged error is emitted and the behavior is undefined.

Definition at line 877 of file MartyInterface.cpp.

◆ get_special_blocks()

std::set< std::string > MartyInterface::get_special_blocks ( )

Returns the special blocks handled with custom logic.

These are the block names for which SMParamSetter applies special formulas instead of simply reading values from the parameter proxies.

Typical examples include:

  • "KIN" : kinetic terms,
  • "WEIN" : Weinberg angle,
  • "Finite", "REGPROP", "BETA", etc.
Returns
A set containing all special block names.

Definition at line 902 of file MartyInterface.cpp.


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