MaCh3  2.6.0
Reference Guide
DiagMCMC.cpp
Go to the documentation of this file.
2 #include "Manager/Manager.h"
3 
9 
13 void DiagMCMC(const std::string& inputFile, const std::string& config)
14 {
15  MACH3LOG_INFO("File for study: {}", inputFile);
16 
17  YAML::Node Settings = M3OpenConfig(config);
18 
19  // Make the processor
20  auto Processor = std::make_unique<MCMCProcessor>(inputFile);
21  Processor->SetOutputSuffix("_MCMC_Diag");
22  //KS:Turn off plotting detector and some other setting
23  Processor->SetExcludedTypes(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedTypes"], {}));
24  Processor->SetExcludedNames(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedNames"], {}));
25  Processor->SetExcludedGroups(GetFromManager<std::vector<std::string>>(Settings["DiagMCMC"]["ExcludedGroups"], {}));
26  Processor->SetPlotRelativeToPrior(GetFromManager<bool>(Settings["DiagMCMC"]["PlotRelativeToPrior"], false));
27  //KS: Use 20 batches for batched means
28  Processor->SetnBatches(GetFromManager<int>(Settings["DiagMCMC"]["nBatches"], 20));
29  Processor->SetnLags(GetFromManager<int>(Settings["DiagMCMC"]["nLags"], 25000));
30  Processor->SetPrintToPDF(GetFromManager<bool>(Settings["PrintToPDF"], true));
31  Processor->Initialise();
32  if(Settings["MaxEntries"]) {
33  Processor->SetEntries(Get<int>(Settings["MaxEntries"], __FILE__, __LINE__));
34  }
35  //KS: finally call main method
36  Processor->DiagMCMC();
37 }
38 
39 int main(int argc, char *argv[]) {
41  if (argc != 3)
42  {
43  MACH3LOG_ERROR("How to use: DiagMCMC MCMC_Output.root config");
44  throw MaCh3Exception(__FILE__ , __LINE__ );
45  }
46  MACH3LOG_INFO("Producing single fit output");
47  std::string filename = argv[1];
48  std::string config = argv[2];
49  DiagMCMC(filename, config);
50 
51  return 0;
52 }
int main(int argc, char *argv[])
Definition: DiagMCMC.cpp:39
void DiagMCMC(const std::string &inputFile, const std::string &config)
Main function creating MCMCProcessor and calling MCMC Diagnostic.
Definition: DiagMCMC.cpp:13
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:37
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:35
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
Definition: MaCh3Logger.h:60
std::string config
Definition: ProcessMCMC.cpp:30
Type GetFromManager(const YAML::Node &node, const 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:329
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:589
Custom exception class used throughout MaCh3.