bdtstudyspectrums.C
Go to the documentation of this file.
1 
2 
3 #ifdef __CINT__
4 
6 
7 {
8 
9  std::cout << "Sorry, you must run in compiled mode" << std::endl;
10 
11 }
12 
13 #else
14 
15 ///////////////////////////
16 
17 ////////CAFAna libraries///
18 
19 #include "CAFAna/Cuts/Cuts.h"
20 
21 #include "CAFAna/Analysis/Plots.h"
22 
23 #include "CAFAna/Core/SpectrumLoaderMockData.h"
24 
26 
28 
29 #include "CAFAna/Core/Spectrum.h"
30 
32 
33 #include "CAFAna/Vars/Vars.h"
34 
36 
37 ////////////////////////////
38 
39 
40 
41 ////Plotting Libraries/////
42 
43 #include "TCanvas.h"
44 
45 #include "TH2.h"
46 
47 #include "TH1.h"
48 
49 #include "TFitResultPtr.h"
50 
51 #include "TLegend.h"
52 #include "/nova/app/users/acedeno/tag_releasesS18-06-14/CAFAna/Vars/NDNCPi0Xsec.h"
53 //////////////////////////
54 
55  ///////NCPi0 Headers//////
59 /////////////////////////
60 
61 
62 using namespace ana;
63 
64 
66 
67 {
68 
69  /*********************************************************************************************************************/
70 
71  //Enviroment variables and wildcards work
72 
73  //const std::string MC = "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1";
74  const std::string MC = "CVN_Prong_Prod4_ND_NuMI_MC_2view_Genielike_FlatFlux_CAFs"
75  ; //const std::string Numi = "prod_caf_R17-03-01-prod3reco.d_nd_numi_fhc_full_v1_goodruns";
76 
77  /*********************************************************************************************************************/
78 
79  //Create loader for each 'data' type
80 
81 
82 
83  SpectrumLoader mcloader(MC);
84 
85  //SpectrumLoader dataloader(Numi);
86 
87 
88  ///////////MC///////////////
89 
90  /////////First most energetic prong of shower length in a 3 prong event//////////////
91 
92  ///Spectrum w/ PreSelection = kIsFiducial + kContainment cut (All Monte Carlo)///
93 
94  //Spectrum ndMC("BDTG",BDTGBins, mcloader, kNCPi0BDTID, kIsPreSel);
95 
96  /// w/Presel & (BDTG Variable)/////
97  Spectrum ndMC3PRem("BDTG",BDTGBins,mcloader,kNCPi0BDTID,k2ProngPreSel);
98  Spectrum ndNCPi0Rem("BDTG",BDTGBins,mcloader,kNCPi0BDTID,kIsNCPi02PRem);
99  Spectrum ndCCPi0Rem("BDTG",BDTGBins, mcloader,kNCPi0BDTID,kIsCCPi02PRem);
100  Spectrum ndNCNonPi0Rem("BDTG",BDTGBins,mcloader,kNCPi0BDTID, kIsNCNonPi02PRem);
101  Spectrum ndNCPi0LRem("BDTG",BDTGBins,mcloader,kNCPi0BDTID,kIsNCPi0L2PRem);
102  Spectrum ndCCNonPi0Rem("BDTG",BDTGBins,mcloader,kNCPi0BDTID,kIsCCNonPi02PRem);
103 
104 
105  /*********************************************************************************************************************/
106 
107  // Once all spectra are registered, loop through input files, extracting variable values and filling histograms.
108 
109  //Total POT is accumulated and used to set spectra POT.
110 
111 
112 
113  mcloader.Go();
114 
115  //dataloader.Go();
116 
117 
118 
119  /*********************************************************************************************************************/
120  TFile *out = new TFile("BDTSpectrum_GenieLikedataset.root","RECREATE");
121 
122 
123  //ndNumi.SaveTo(out->mkdir("ndNumi"));
124 
125  ndMC3PRem.SaveTo(out->mkdir("ndMC3PRem"));
126  ndNCPi0Rem.SaveTo(out->mkdir("ndNCPi0Rem"));
127  ndCCPi0Rem.SaveTo(out->mkdir("ndCCPi0Rem"));
128  ndNCNonPi0Rem.SaveTo(out->mkdir("ndNCNonPi0Rem"));
129  ndNCPi0LRem.SaveTo(out->mkdir("ndNCPi0LRem"));
130  ndCCNonPi0Rem.SaveTo(out->mkdir("ndCCNonPi0Rem"));
131 
132  std::cout<<"\nOutput saved to " << out->GetName()<<std::endl;
133 
134  out->Close();
135 
136  return;
137 
138 
139 
140 }
141 
142 #endif
const Var kNCPi0BDTID
Definition: NDNCPi0Xsec.h:23
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kIsCCPi02PRem
Definition: ncpi0Cuts.h:910
const Cut kIsCCNonPi02PRem
Definition: ncpi0Cuts.h:882
const Cut k2ProngPreSel
Definition: ncpi0Cuts.h:863
const Cut kIsNCNonPi02PRem
Definition: ncpi0Cuts.h:883
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
void bdtstudyspectrums()
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const Cut kIsNCPi0L2PRem
Definition: ncpi0Cuts.h:909
OStream cout
Definition: OStream.cxx:6
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Cut kIsNCPi02PRem
Definition: ncpi0Cuts.h:908
const Binning BDTGBins
Definition: ncpi0Bins.h:55
enum BeamMode string