MaCh3  2.2.3
Reference Guide
DiagMCMC.cpp
Go to the documentation of this file.
2 
3 #include "Manager/Manager.h"
4 
8 void 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->SetExcludedGroups(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedGroups"], {}));
21  Processor->SetPlotRelativeToPrior(GetFromManager<bool>(Settings["DiagMCMC"]["PlotRelativeToPrior"], false));
22  //KS: Use 20 batches for batched means
23  Processor->SetnBatches(GetFromManager<int>(Settings["DiagMCMC"]["nBatches"], 20));
24  Processor->SetnLags(GetFromManager<int>(Settings["DiagMCMC"]["nLags"], 25000));
25  Processor->SetPrintToPDF(GetFromManager<bool>(Settings["PrintToPDF"], true));
26  Processor->Initialise();
27  if(Settings["MaxEntries"]) {
28  Processor->SetEntries(Get<int>(Settings["MaxEntries"], __FILE__, __LINE__));
29  }
30  //KS: finally call main method
31  Processor->DiagMCMC();
32 }
33 
34 int main(int argc, char *argv[]) {
36  if (argc != 3)
37  {
38  MACH3LOG_ERROR("How to use: DiagMCMC MCMC_Output.root config");
39  throw MaCh3Exception(__FILE__ , __LINE__ );
40  }
41  MACH3LOG_INFO("Producing single fit output");
42  std::string filename = argv[1];
43  std::string config = argv[2];
44  DiagMCMC(filename, config);
45 
46  return 0;
47 }
int main(int argc, char *argv[])
Definition: DiagMCMC.cpp:34
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:27
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:25
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
Definition: MaCh3Logger.h:51
std::string config
Definition: ProcessMCMC.cpp:29
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:299
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:561
Custom exception class for MaCh3 errors.