make_decomp.C
Go to the documentation of this file.
1 // Macro to generate 20202 nue FHC analysis root file for Michel/BEN and Prop decomps/plots
2 
3 #include "CAFAna/Vars/Vars.h"
8 
9 #include "CAFAna/Cuts/Cuts.h"
10 #include "CAFAna/Cuts/SpillCuts.h"
13 #include "CAFAna/Cuts/TruthCuts.h"
14 #include "CAFAna/Core/Spectrum.h"
16 
17 
26 
27 #include "CAFAna/Systs/Systs.h"
28 #include "CAFAna/Core/SystShifts.h"
30 
31 
32 
33 
34 #include "Utilities/func/MathUtil.h"
35 
36 #include "TCanvas.h"
37 #include "TH2.h"
38 #include "TFile.h"
39 #include "TLegend.h"
40 #include "TProfile.h"
41 #include "TRandom3.h"
43 
44 #include <iostream>
45 #include <cmath>
46 
47 using namespace ana;
48 
50 {
51  HistAxis NumuAxis("CCE", Binning::Simple(50,0,5), kCCE);
52 
53 
54 
55  //===========Prod5 Defs and weights===============================================
56 
57  const Var Wei = kXSecCVWgt2020* kPPFXFluxCVWgt;
58 
59 
60  //FHC
61  //SpectrumLoader lNDData("defname: prod_caf_R19-11-18-prod5reco.d.f.h.l_nd_numi_fhc_full_v1_goodruns");
62  //SpectrumLoader lNDMC("defname: prod_caf_R19-11-18-prod5reco.d.h.l_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1");
63 
64  //FHC Concats
65  SpectrumLoader lNDData("defname: prod_sumdecaf_R19-11-18-prod5reco.d.f.h.l_nd_numi_fhc_full_v1_goodruns_nue2020");
66  SpectrumLoader lNDMC("defname: prod_sumdecaf_R19-11-18-prod5reco.d.h.l_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_nue2020");
67 
70 
71 
72  struct HistDef
73  {
75  HistAxis axis;
76  };
77 
78  const HistDef def = {"cvn2d", {"CVN 2D", kNue2020Binning, kNue2020AnaBin}};
79 
80  Cut NueND = kNue2020ND;
81 
82 
83 
84 
85 
86  IDecomp* cheatDCMP;
87  IDecomp* michelDCMP;
88  IDecomp* michelbenDCMP;
89  BENDecomp* benDCMP;
90  BENDecomp* benDCMPFix;
91  ProportionalDecomp* propDCMP;
92  IDecomp* michelpropDCMP;
93 
94  const HistAxis& axis = def.axis;
95 
96  // Michel decomp with decomp as input
97  cheatDCMP = new CheatDecomp(lNDMC, axis, NueND, kNoShift, Wei);
98  michelDCMP = new MichelDecomp(lNDMC, lNDData, axis, NueND, cheatDCMP, kNoShift, kNoShift, Wei);
99 
100  // COMBO Decomp = Michel+BEN decomp. This is used with FHC for the analysis. Others are used for studies/verifications.
101  benDCMPFix = new BENDecomp(lNDMC, lNDData, axis, NueND, kNoShift, kNoShift, Wei);
102  benDCMP = new BENDecomp (BENDecomp::kCalcKaonScale, lNDMC, lNDData,kNue2020Axis, NueND, kNoShift, kNoShift, Wei);
103  michelbenDCMP = new MichelDecomp(lNDMC, lNDData, axis, NueND, benDCMP, kNoShift, kNoShift, Wei);
104 
105  // Proportional decomp - to be used with RHC for the analysis
106  propDCMP = new ProportionalDecomp(lNDMC, lNDData, axis, NueND, kNoShift, kNoShift, Wei);
107  michelpropDCMP = new MichelDecomp(lNDMC, lNDData, axis, NueND, propDCMP, kNoShift, kNoShift, Wei);
108 
109 
110  lNDMC.Go();
111  lNDData.Go();
112 
113  TFile* file = new TFile("nue_dcmp.root","recreate");
114  TDirectory* d = file->mkdir("nue_decomps");
115 
116  michelDCMP->SaveTo(d, "michelcheatDCMP");
117  michelbenDCMP->SaveTo(d, "michelbenDCMP");
118  propDCMP->SaveTo(d, "propDCMP");
119  benDCMPFix->SaveTo(d, "benDCMPFix");
120  benDCMP->SaveTo(d, "benDCMP");
121  michelpropDCMP->SaveTo(d, "michelpropDCMP");
122  file->Close();
123 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void make_decomp()
Definition: make_decomp.C:49
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
std::string name
Definition: NuePlotLists.h:12
void SetSpillCut(const SpillCut &cut)
const Cut kNue2020ND
Definition: NueCuts2020.h:178
const Binning kNue2020Binning
const HistAxis kNue2020Axis("NuE Energy / Analysis Bin", kNue2020Binning, kNue2020AnaBin)
Use this Axis for Ana2020, official Axis.
Definition: NueCuts2020.h:195
const Var kCCE
Definition: NumuVars.h:21
Float_t d
Definition: plot.C:236
void SaveTo(TDirectory *dir, const std::string &name) const override
Definition: BENDecomp.cxx:387
virtual void Go() override
Load all the registered spectra.
HistAxis axis
Definition: NuePlotLists.h:13
const SystShifts kNoShift
Definition: SystShifts.cxx:21
void SaveTo(TDirectory *dir, const std::string &name) const override
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Splits Data proportionally according to MC.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kNue2020AnaBin([](const caf::SRProxy *sr){int selBin=kNue2020SelectionBin(sr);float nuE=kNueEnergy2020(sr);int nuEBin=nuE/0.5;assert(nuEBin<=8 &&"An event with nuE > 4.5 should never happen");int anaBin=9 *selBin+nuEBin;return anaBin;})
Use this Analysis Binning for Ana2020, official Binning.
Definition: NueCuts2020.h:191
Standard interface to all decomposition techniques.
Definition: IDecomp.h:13
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
virtual void SaveTo(TDirectory *dir, const std::string &name) const =0
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:114
Just return the ND truth spectra as the decomposition.
Definition: CheatDecomp.h:10
const Var kXSecCVWgt2020
Definition: XsecTunes.h:106