make_michel.C
Go to the documentation of this file.
1 // Macro to generate 2018 nue FHC analysis root file for MichelDecomp plots
2 
3 
4 #include "OscLib/OscCalcDumb.h"
5 
6 #include "CAFAna/Vars/Vars.h"
10 
11 #include "CAFAna/Cuts/Cuts.h"
12 #include "CAFAna/Cuts/SpillCuts.h"
16 #include "CAFAna/Cuts/TruthCuts.h"
17 #include "CAFAna/Cuts/NueCutsSecondAna.h"
18 #include "CAFAna/Core/Spectrum.h"
20 
21 #include "CAFAna/Analysis/SALoaders.h"
30 
31 #include "CAFAna/Systs/Systs.h"
32 #include "CAFAna/Core/SystShifts.h"
33 
34 
35 #include "Utilities/func/MathUtil.h"
36 
37 #include "TCanvas.h"
38 #include "TH2.h"
39 #include "TFile.h"
40 #include "TLegend.h"
41 #include "TProfile.h"
42 #include "TRandom3.h"
44 
45 #include <iostream>
46 #include <cmath>
47 
48 using namespace ana;
49 
51 {
52  HistAxis NumuAxis("CCE", Binning::Simple(50,0,5), kCCE);
53  const Var Wei = kXSecCVWgt2018 * kPPFXFluxCVWgt;
54 
55  // FHC
56  SpectrumLoader lNDData("prod_caf_R17-09-05-prod4recopreview.f_nd_numi_fhc_full_v1_addShortSimpleCVN_goodruns");
57  SpectrumLoader lNDMC("prod_caf_R17-11-14-prod4reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1");
58 
59  SpectrumLoader lFDnonswap("prod_caf_R17-11-14-prod4reco.d_fd_genie_nonswap_fhc_nova_v08_full_v1");
60  SpectrumLoader lFDfluxswap("prod_caf_R17-11-14-prod4reco.d_fd_genie_fluxswap_fhc_nova_v08_full_v1");
61  SpectrumLoader lFDtauswap("prod_caf_R17-11-14-prod4reco.d_fd_genie_tau_fhc_nova_v08_full_v1");
62 
65 
66  lFDnonswap.SetSpillCut(kStandardSpillCuts);
67  lFDfluxswap.SetSpillCut(kStandardDQCuts);
68  lFDtauswap.SetSpillCut(kStandardSpillCuts);
69 
70  struct HistDef
71  {
73  HistAxis axis;
74  };
75 
76  const HistDef def = {"cvn2d", {"CVN 2D", kNue2018Binning, kNue2018AnaBin}};
77 
79 
80  IDecomp* cheatDCMP;
81  IDecomp* michelDCMP;
82  IDecomp* michelbenDCMP;
83  BENDecomp* benDCMP;
84  ProportionalDecomp* propDCMP;
85 
86  const HistAxis& axis = def.axis;
87 
88  // Michel decomp with decomp as input
89  cheatDCMP = new CheatDecomp(lNDMC, axis, NueND, kNoShift, Wei);
90  michelDCMP = new MichelDecomp(lNDMC, lNDData, axis, NueND, cheatDCMP, kNoShift, kNoShift, Wei);
91 
92  // COMBO Decomp = Michel+BEN decomp
93  benDCMP = new BENDecomp(lNDMC, lNDData, axis, NueND, kNoShift, kNoShift, Wei);
94  michelbenDCMP = new MichelDecomp(lNDMC, lNDData, axis, NueND, benDCMP, kNoShift, kNoShift, Wei);
95 
96  // Proportional decomp
97  propDCMP = new ProportionalDecomp(lNDMC, lNDData, axis, NueND, kNoShift, kNoShift, Wei);
98 
99  lNDMC.Go();
100  lNDData.Go();
101 
102  lFDnonswap.Go();
103  lFDfluxswap.Go();
104  lFDtauswap.Go();
105 
106  TFile* file = new TFile("nue_dcmp.root","recreate");
107  TDirectory* d = file->mkdir("nue_decomps");
108 
109  michelDCMP->SaveTo(d, "michelcheatDCMP");
110  michelbenDCMP->SaveTo(d, "michelbenDCMP");
111  propDCMP->SaveTo(d, "propDCMP");
112 
113  file->Close();
114 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
std::string name
Definition: NuePlotLists.h:12
void SetSpillCut(const SpillCut &cut)
const Cut kNue2018CVNCut([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2018RHCCVNCut(sr);else return kNue2018FHCCVNCut(sr);})
Definition: NueCuts2018.h:49
const Cut kNue2018NDPresel
Definition: NueCuts2018.h:145
void make_michel()
Definition: make_michel.C:50
const Var kNue2018AnaBin([](const caf::SRProxy *sr){int selBin=kNue2018SelectionBin(sr);float nuE=kNueEnergy2018(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 Ana2018, official Binning.
Definition: NueCuts2018.h:171
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
Definition: SpillCuts.h:16
const Var kCCE
Definition: NumuVars.h:21
Float_t d
Definition: plot.C:236
virtual void Go() override
Load all the registered spectra.
const Binning kNue2018Binning
Definition: NueCuts2018.cxx:92
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 kXSecCVWgt2018
Definition: XsecTunes.h:49
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