AnalyzeNus18Systs.C
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////
2 // AnalyzeNus18Systs.C
3 // Mike Wallbank (wallbank@fnal.gov)
4 //
5 // Analyze all systematics for Nus18 analyses.
6 //////////////////////////////////////////////////////////////
7 
9 #include "NuXAna/Analysis/NusSystsMaker.h"
10 
11 using namespace ana;
12 
13 // -------------------------------------------------------------------------------------
15 
16  TH1::AddDirectory(0);
17 
18  // Running options
19  bool fhc = opt.Contains("fhc", TString::kIgnoreCase);
20  bool rhc = opt.Contains("rhc", TString::kIgnoreCase);
21  assert(fhc or rhc);
22 
23  // Open the input file and an output file
24  std::string fileName = inFileName.substr(0, inFileName.find(".root"));
25  std::string saveName = fileName + "Ana.root";
26  TFile* inFile = new TFile(inFileName.c_str(), "READ");
27  TFile* outFile = new TFile(saveName.c_str(), "RECREATE");
28 
29  // Get the syst maker from the file
30  NusSystematicsMaker* nus_systs = NusSystematicsMaker::LoadFrom(inFile, "Nus18Systs").release();
31  //NusSystematics* nus_systs = NusSystematics::LoadFrom(inFile, "Nus18Systs");
32 
33  // Get POT
34  double pot = fhc ? kAna2018FHCPOT : kAna2018RHCPOT;
35 
36  // Run the syst makers
37  nus_systs->Go(kAna2018RHCPOT);
38 
39  // Print the systematics
40  nus_systs->PrintSysts();
41 
42  // Draw the shifted systematics
43  nus_systs->DrawSysts(outFile);
44 
45  // Get the ISysts
46  std::vector<NusISyst*> systs = nus_systs->MakeISysts();
47  for (const auto& syst : systs)
48  std::cout << "Syst " << syst->ShortName() << std::endl;
49 
50  TFile* systfile = TFile::Open("isysts.root", "recreate");
51  for (const auto& syst : systs)
52  syst->SaveTo(systfile, syst->ShortName().c_str());
53 
54  return;
55 
56 }
fileName
Definition: plotROC.py:78
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
const double kAna2018RHCPOT
Definition: Exposures.h:208
ifstream inFile
Definition: AnaPlotMaker.h:34
TFile * outFile
Definition: PlotXSec.C:135
#define pot
inFileName
if we get here, we&#39;re doing the base definitions:
Definition: mkDefs.py:168
OStream cout
Definition: OStream.cxx:6
assert(nhit_max >=nhit_nbins)
void AnalyzeNus18Systs(std::string inFileName, TString opt)
const double kAna2018FHCPOT
Definition: Exposures.h:207
enum BeamMode string