MakeISysts.C
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////
2 // MakeISysts.C
3 // Jeremy Hewes (jhewes15@fnal.gov)
4 //
5 // Make ISysts from SystMakers for 2019 FHC NC analysis
6 //////////////////////////////////////////////////////////////
7 
9 #include "NuXAna/Analysis/NusSystsMaker.h"
10 
11 using namespace ana;
12 
13 // -------------------------------------------------------------------------------------
14 void MakeISysts(std::string nd_path="/nova/data/users/jhewes15/nus19/systmakers/neardet",
15  std::string nd_file="systsmaker_nc_fhc_2019.root",
16  std::string fd_path="/nova/data/users/jhewes15/nus19/systmakers/fardet",
17  std::string fd_file="systsmaker_nc_fhc_2019.root") {
18 
19  DontAddDirectory guard;
20 
21  std::string ifname = nd_path + "/" + nd_file;
22  std::string ofname = "isysts_neardet.root";
23 
24  TFile* infile = TFile::Open(ifname.c_str(), "read");
25  TFile* outfile = TFile::Open(ofname.c_str(), "recreate");
26 
27  std::string name = "systsmaker_nc_neardet";
28 
29  // Get the syst maker from the file
30  NusSystematicsMaker* nus_systs = NusSystematicsMaker::LoadFrom(infile, "systsmaker_nc_fhc_2019"), nd_path.c_str().release();
31 
32  for (auto syst_maker : nus_systs->GetSystMakers())
33  std::cout << "Name is " << syst_maker.second->GetName() << std::endl;
34 
35  // Run the syst makers
36 
37  nus_systs->Go(12e20);
38 
39  // Print the systematics
40  // nus_systs->PrintSysts();
41 
42  // Get and save the isysts
43  std::vector<NusISyst*> systs = nus_systs->MakeISysts();
44  TDirectory* dir = outfile->mkdir("systmaker_nc_neardet");
45  for (NusISyst* syst : systs)
46  syst->SaveTo(dir, syst->ShortName().c_str());
47 
48  delete nus_systs;
49  delete infile;
50  delete outfile;
51 
52  ifname = fd_path + "/" + fd_file;
53  ofname = "isysts_fardet.root";
54 
55  infile = TFile::Open(ifname.c_str(), "read");
56  outfile = TFile::Open(ofname.c_str(), "recreate");
57 
58  name = "systsmaker_nc_fardet";
59 
60  nus_systs = NusSystematicsMaker::LoadFrom(infile, "systsmaker_nc_fhc_2019"), fd_path.c_str().release();
61 
62  nus_systs->Go(12e20);
63 
64  systs = nus_systs->MakeISysts();
65  dir = outfile->mkdir("systmaker_nc_fardet");
66  for (NusISyst* syst : systs)
67  syst->SaveTo(dir, syst->ShortName().c_str());
68 
69  delete nus_systs;
70  delete infile;
71  delete outfile;
72 
73 }
74 
const XML_Char * name
Definition: expat.h:151
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
string infile
OStream cout
Definition: OStream.cxx:6
void MakeISysts(std::string nd_path="/nova/data/users/jhewes15/nus19/systmakers/neardet", std::string nd_file="systsmaker_nc_fhc_2019.root", std::string fd_path="/nova/data/users/jhewes15/nus19/systmakers/fardet", std::string fd_file="systsmaker_nc_fhc_2019.root")
Definition: MakeISysts.C:14
TDirectory * dir
Definition: macro.C:5
Prevent histograms being added to the current directory.
Definition: UtilsExt.h:46
FILE * outfile
Definition: dump_event.C:13
enum BeamMode string