MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
DiagMCMC.cpp
Go to the documentation of this file.
2
3#include "Manager/Manager.h"
4
8void DiagMCMC(const std::string& inputFile, const std::string& config)
9{
10 MACH3LOG_INFO("File for study: {}", inputFile);
11
12 YAML::Node Settings = M3OpenConfig(config);
13
14 // Make the processor
15 auto Processor = std::make_unique<MCMCProcessor>(inputFile);
16 Processor->SetOutputSuffix("_MCMC_Diag");
17 //KS:Turn off plotting detector and some other setting
18 Processor->SetExcludedTypes(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedTypes"], {}));
19 Processor->SetExcludedNames(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedNames"], {}));
20 Processor->SetPlotRelativeToPrior(GetFromManager<bool>(Settings["DiagMCMC"]["PlotRelativeToPrior"], false));
21 //KS: Use 20 batches for batched means
22 Processor->SetnBatches(GetFromManager<int>(Settings["DiagMCMC"]["nBatches"], 20));
23 Processor->SetnLags(GetFromManager<int>(Settings["DiagMCMC"]["nLags"], 25000));
24 Processor->SetPrintToPDF(GetFromManager<bool>(Settings["PrintToPDF"], true));
25 Processor->Initialise();
26
27 //KS: finally call main method
28 Processor->DiagMCMC();
29}
30
31int main(int argc, char *argv[]) {
33 if (argc != 3)
34 {
35 MACH3LOG_ERROR("How to use: DiagMCMC MCMC_Output.root config");
36 throw MaCh3Exception(__FILE__ , __LINE__ );
37 }
38 MACH3LOG_INFO("Producing single fit output");
39 std::string filename = argv[1];
40 std::string config = argv[2];
41 DiagMCMC(filename, config);
42
43 return 0;
44}
int main(int argc, char *argv[])
Definition: DiagMCMC.cpp:31
void DiagMCMC(const std::string &inputFile, const std::string &config)
Main function creating MCMCProcessor and calling MCMC Diagnostic.
Definition: DiagMCMC.cpp:8
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:25
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:23
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
Definition: MaCh3Logger.h:30
std::string config
Definition: ProcessMCMC.cpp:30
Type GetFromManager(const YAML::Node &node, Type defval, const std::string File="", const int Line=1)
Get content of config file if node is not found take default value specified.
Definition: YamlHelper.h:298
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:560
Custom exception class for MaCh3 errors.