MaCh3  2.6.1
Reference Guide
RHat.cpp
Go to the documentation of this file.
1 // MaCh3 includes
3 
25 
26 // *******************
27 
28 // *******************
29 int main(int argc, char *argv[]) {
30 // *******************
33 
34  std::vector<std::string> MCMCFile;
35  int Nchains = 0;
36  if (argc < 2)
37  {
38  MACH3LOG_ERROR("Wrong arguments");
39  MACH3LOG_ERROR("./RHat NThin MCMCchain_1.root MCMCchain_2.root MCMCchain_3.root ... [how many you like]");
40  throw MaCh3Exception(__FILE__ , __LINE__ );
41  }
42 
43  int NThin = atoi(argv[1]);
44 
45  //KS Gelman suggests to diagnose on more than one chain
46  for (int i = 2; i < argc; i++)
47  {
48  MCMCFile.push_back(std::string(argv[i]));
49  MACH3LOG_INFO("Adding file: {}", MCMCFile.back());
50  Nchains++;
51  }
52 
53  if(Nchains == 1)
54  {
55  MACH3LOG_WARN("Gelman is going to be sad :(. He suggested you should use more than one chain (at least 4). Code works fine for one chain, however, estimator might be biased.");
56  MACH3LOG_WARN("Multiple chains are more likely to reveal multimodality and poor adaptation or mixing:");
57  }
58  MACH3LOG_INFO("Diagnosing {} chains", Nchains);
59  auto RHatCalc = std::make_unique<RHatCalculator>(false, MCMCFile, NThin);
60  RHatCalc->RunDiagnostic();
61 
62  return 0;
63 }
#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
#define MACH3LOG_WARN
Definition: MaCh3Logger.h:36
int main(int argc, char *argv[])
Definition: RHat.cpp:29
Custom exception class used throughout MaCh3.
void MaCh3Welcome()
KS: Prints welcome message with MaCh3 logo.
Definition: Monitor.cpp:13