MaCh3  2.4.2
Reference Guide
SmearChain.cpp
Go to the documentation of this file.
3 #include "Manager/Manager.h"
4 
8 
12 void SmearChain(const std::string& inputFile, const std::string& config)
13 {
14  MACH3LOG_INFO("File for study: {}", inputFile);
15 
16  YAML::Node Settings = M3OpenConfig(config);
17 
18  // Make the processor
19  auto Processor = std::make_unique<MCMCProcessor>(inputFile);
20  Processor->SetOutputSuffix("_Smear_MCMC");
21  Processor->Initialise();
22 
23  const auto& Smear = Settings["SmearChain"];
24 
25  std::vector<std::string> Names = Get<std::vector<std::string>>(Smear["Smear"][0], __FILE__, __LINE__);
26  std::vector<double> ErrorValue = Get<std::vector<double>>(Smear["Smear"][1], __FILE__, __LINE__);
27 
28  bool SaveUnsmearedBranch = GetFromManager<bool>(Smear["SaveUnsmearedBranch"], false);
29  Processor->SmearChain(Names, ErrorValue, SaveUnsmearedBranch);
30 }
31 
32 int main(int argc, char *argv[]) {
34  if (argc != 3)
35  {
36  MACH3LOG_ERROR("How to use: {} MCMC_Output.root config", argv[0]);
37  throw MaCh3Exception(__FILE__ , __LINE__ );
38  }
39  MACH3LOG_INFO("Producing single fit output");
40  std::string filename = argv[1];
41  std::string config = argv[2];
42  SmearChain(filename, config);
43 
44  return 0;
45 }
#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:61
std::string config
Definition: ProcessMCMC.cpp:30
int main(int argc, char *argv[])
Definition: SmearChain.cpp:32
void SmearChain(const std::string &inputFile, const std::string &config)
Main function creating MCMCProcessor and calling Smear Chain.
Definition: SmearChain.cpp:12
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:589
Custom exception class used throughout MaCh3.