MaCh3  2.8.0
Reference Guide
Public Member Functions | List of all members
M3::SmearModule Class Reference

Allows you to smear contour. For example after performing sets of study one finds out that used sets of uncertainty doesn't fully cover analysis need. Then one can smear additionally contour. More...

#include <CLI/Modules/SmearModule.hpp>

Inheritance diagram for M3::SmearModule:
[legend]
Collaboration diagram for M3::SmearModule:
[legend]

Public Member Functions

virtual ~SmearModule ()
 Destructor. More...
 
MaCh3ArgumentParser * get_parser () override
 Get the argument parser for this module. More...
 
void SmearChain (const std::string &inputFile, const std::string &config)
 
int Run () override
 Execute the MCMC diagnostics. More...
 
- Public Member Functions inherited from M3::PluginBase
virtual ~PluginBase ()=default
 
- Public Member Functions inherited from M3::IPlugin
virtual ~IPlugin ()=default
 

Additional Inherited Members

- Protected Attributes inherited from M3::PluginBase
std::unique_ptr< MaCh3ArgumentParser > m_parser
 Argument parser for this plugin. More...
 

Detailed Description

Allows you to smear contour. For example after performing sets of study one finds out that used sets of uncertainty doesn't fully cover analysis need. Then one can smear additionally contour.

Definition at line 10 of file SmearModule.hpp.

Constructor & Destructor Documentation

◆ ~SmearModule()

M3::SmearModule::~SmearModule ( )
virtualdefault

Destructor.

Member Function Documentation

◆ get_parser()

MaCh3ArgumentParser * M3::SmearModule::get_parser ( )
overridevirtual

Get the argument parser for this module.

Returns
Pointer to the configured MaCh3ArgumentParser

Implements M3::IPlugin.

Definition at line 12 of file SmearModule.cpp.

12  {
13  m_parser = std::make_unique<MaCh3ArgumentParser>("smear", "1.0", argparse::default_arguments::help);
14  m_parser->add_description("Tool for smearing MCMC chains.");
15  m_parser->add_argument("mcmc-output")
16  .help("MCMC chain root file.")
17  .metavar("MCMC_CHAIN")
18  .required();
19  m_parser->add_argument("config")
20  .help("Config file.")
21  .metavar("CONFIG")
22  .required();
23  return m_parser.get();
24 }
std::unique_ptr< MaCh3ArgumentParser > m_parser
Argument parser for this plugin.
Definition: plugin.hpp:47

◆ Run()

int M3::SmearModule::Run ( )
overridevirtual

Execute the MCMC diagnostics.

Returns
Exit code (0 on success)

Implements M3::IPlugin.

Definition at line 45 of file SmearModule.cpp.

45  {
47  MACH3LOG_INFO("Producing single fit output");
48  std::string filename = m_parser->get<std::string>("mcmc-output");
49  std::string config = m_parser->get<std::string>("config");
50  SmearChain(filename, config);
51 
52  return 0;
53 }
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:35
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
Definition: MaCh3Logger.h:60
void SmearChain(const std::string &inputFile, const std::string &config)
Definition: SmearModule.cpp:26

◆ SmearChain()

void M3::SmearModule::SmearChain ( const std::string &  inputFile,
const std::string &  config 
)

Definition at line 26 of file SmearModule.cpp.

26  {
27  MACH3LOG_INFO("File for study: {}", inputFile);
28 
29  YAML::Node Settings = M3OpenConfig(config);
30 
31  // Make the processor
32  auto Processor = std::make_unique<MCMCProcessor>(inputFile);
33  Processor->SetOutputSuffix("_Smear_MCMC");
34  Processor->Initialise();
35 
36  const auto& Smear = Settings["SmearChain"];
37 
38  std::vector<std::string> Names = Get<std::vector<std::string>>(Smear["Smear"][0], __FILE__, __LINE__);
39  std::vector<double> ErrorValue = Get<std::vector<double>>(Smear["Smear"][1], __FILE__, __LINE__);
40 
41  bool SaveUnsmearedBranch = GetFromManager<bool>(Smear["SaveUnsmearedBranch"], false, __FILE__ , __LINE__);
42  Processor->SmearChain(Names, ErrorValue, SaveUnsmearedBranch);
43 }
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:589

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