ExtrapSterile.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include "CAFAna/Core/Cut.h"
9 #include "CAFAna/Core/Ratio.h"
10 #include "CAFAna/Cuts/TruthCuts.h"
11 
12 class TDirectory;
13 
14 namespace ana
15 {
16  // This file implements a sterile neutrino compatible extrapolation.
17  // If multiple sterile extrapolations are written,
18  // This file will need to contain an generic sterile extrapolation,
19  // class IExtrapSterile: public IExtrap
20  // The individual sterile extrapolations will inherit from this
21 
22  /// A ModularExtrap compatible with sterile oscillations.
23  /// Only extrapolates one sample.
25  {
26  /// Sets up all components to use FD MC--internal use only.
27  /** Use a named constructor to create a ModularExtrapSterile. */
29  SpectrumLoaderBase& farMCswapLoader,
30  SpectrumLoaderBase& farMCnonswapLoader,
31  SpectrumLoaderBase& farMCtauswapLoader,
32  const HistAxis& axis,
33  const Cut& fdcut,
34  const SystShifts& shiftMC,
35  const Var& weight
36  );
37 
38  public:
39  /// Creates a NC disappearance extrapolation.
40  /** NCSurvDecomp and NCNDcut are for survival components selected as NCs.
41  NumuOscDecomp and NumuNDCut are for components oscillated from numus,
42  which then get selected as NCs. */
45  const IDecomp& NCSurvDecomp,
46  const IDecomp& NumuOscDecomp,
47  const HistAxis& axis,
48  const HistAxis& axisNumuND,
49  const Cut& fdcut,
50  const Cut& NCNDcut,
51  const Cut& NumuNDcut,
52  const SystShifts& shiftMC = kNoShift,
53  const Var& weight = kUnweighted
54  );
55 
56  /// Creates a NC disappearance extrapolation with individual spectrum loaders.
57  /** NCSurvDecomp and NCNDcut are for survival components selected as NCs.
58  NumuOscDecomp and NumuNDCut are for components oscillated from numus,
59  which then get selected as NCs. */
61  SpectrumLoaderBase& nearMCLoader,
62  SpectrumLoaderBase& farMCswapLoader,
63  SpectrumLoaderBase& farMCnonswapLoader,
64  SpectrumLoaderBase& farMCtauswapLoader,
65  const IDecomp& NCSurvDecomp,
66  const IDecomp& NumuOscDecomp,
67  const HistAxis& axis,
68  const HistAxis& axisNumuND,
69  const Cut& fdcut,
70  const Cut& NCNDcut,
71  const Cut& NumuNDcut,
72  const SystShifts& shiftMC = kNoShift,
73  const Var& weight = kUnweighted
74  );
75 
76  /// Creates a NC disappearance "extrapolation" by returning FD MC.
78  Loaders& loaders,
79  const HistAxis& axis,
80  const Cut& fdcut,
81  const SystShifts& shiftMC = kNoShift,
82  const Var& weight = kUnweighted
83  );
84 
85  /// Creates a NC disappearance "extrapolation" by returning FD MC,
86  /// using individual SpectrumLoaders
88  SpectrumLoaderBase& farMCswapLoader,
89  SpectrumLoaderBase& farMCnonswapLoader,
90  SpectrumLoaderBase& farMCtauswapLoader,
91  const HistAxis& axis,
92  const Cut& fdcut,
93  const SystShifts& shiftMC = kNoShift,
94  const Var& weight = kUnweighted
95  );
96 
97  // Prevent copying because we own objects on the free store.
102  virtual ~ModularExtrapSterile() = default;
103 
104  void SaveTo(TDirectory* dir, const std::string& name) const override;
105  static std::unique_ptr<ModularExtrapSterile> LoadFrom(TDirectory* dir, const std::string& name);
106 
107  /// Return the oscillatable NC component
109 
110  /// Override the ModularExtrap method
111  Spectrum NCTotalComponent() override;
112 
113  /// Return the proportion of NCs that originate as a given neutrino flavor/sign
114  Ratio NCNueProportion() const;
115  Ratio NCAntiNueProportion() const;
116  Ratio NCNumuProportion() const;
117  Ratio NCAntiNumuProportion() const;
118 
119  protected:
120  /// Constructor necessary for loading an extrapolation from file
122 
123  std::unique_ptr<Spectrum> fNCNueNumerator;
124  std::unique_ptr<Spectrum> fNCAntiNueNumerator;
125  std::unique_ptr<Spectrum> fNCNumuNumerator;
126  std::unique_ptr<Spectrum> fNCAntiNumuNumerator;
127  std::unique_ptr<Spectrum> fNCDenominator;
128  };
129 
130  /// Adapted from TruthCuts.h,
131  /// these cuts select NC events discerning neutrino flavor.
132  class NCFlavSel
133  {
134  public:
135  NCFlavSel(int pdg, int pdgorig) : fPdg(pdg), fPdgOrig(pdgorig)
136  {
137  }
138 
139  bool operator()(const caf::SRProxy* sr) const;
140  protected:
141  int fPdg, fPdgOrig;
142  };
143 
144  /// Select NC \f$ \nu_e\to\nu_e \f$
145  const Cut kNCBeamNue(NCFlavSel(12, 12));
146  /// Select NC \f$ \nu_\mu\to\nu_e \f$
147  const Cut kNCNueApp(NCFlavSel(12, 14));
148  /// Select NC \f$ \nu_\mu\to\nu_\mu \f$
149  const Cut kNCBeamNumu(NCFlavSel(14, 14));
150  /// Select NC \f$ \nu_e\to\nu_\mu \f$
151  const Cut kNCNumuApp(NCFlavSel(14, 12));
152  /// Select NC \f$ \nu_\mu\to\nu_\tau \f$
153  const Cut kNCTauFromMu(NCFlavSel(16, 14));
154  /// Select NC \f$ \nu_e\to\nu_\tau \f$
155  const Cut kNCTauFromE(NCFlavSel(16, 12));
156 }
const XML_Char * name
Definition: expat.h:151
const Cut kNCTauFromMu(NCFlavSel(16, 14))
Select NC .
std::unique_ptr< Spectrum > fNCNueNumerator
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
virtual ~ModularExtrapSterile()=default
Ratio NCAntiNumuProportion() const
const Var weight
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
std::unique_ptr< Spectrum > fNCNumuNumerator
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
std::unique_ptr< Spectrum > fNCAntiNumuNumerator
void load(std::string lib)
Definition: load_libs.C:3
Ratio NCNueProportion() const
Return the proportion of NCs that originate as a given neutrino flavor/sign.
const Cut kNCTauFromE(NCFlavSel(16, 12))
Select NC .
OscillatableSpectrum OscNCComponent() const
Return the oscillatable NC component.
std::unique_ptr< Spectrum > fNCDenominator
Ratio NCNumuProportion() const
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Cut kNCBeamNue(NCFlavSel(12, 12))
Select NC .
ModularExtrapSterile(SpectrumLoaderBase &farMCswapLoader, SpectrumLoaderBase &farMCnonswapLoader, SpectrumLoaderBase &farMCtauswapLoader, const HistAxis &axis, const Cut &fdcut, const SystShifts &shiftMC, const Var &weight)
Sets up all components to use FD MC–internal use only.
Ratio NCAntiNueProportion() const
NCFlavSel(int pdg, int pdgorig)
caf::StandardRecord * sr
const Cut kNCBeamNumu(NCFlavSel(14, 14))
Select NC .
const Cut kNCNueApp(NCFlavSel(12, 14))
Select NC .
Spectrum NCTotalComponent() override
Override the ModularExtrap method.
Represent the ratio between two spectra.
Definition: Ratio.h:8
const SystShifts kNoShift
Definition: SystShifts.cxx:22
Base class for the various types of spectrum loader.
TDirectory * dir
Definition: macro.C:5
std::unique_ptr< Spectrum > fNCAntiNueNumerator
std::vector< Loaders * > loaders
Definition: syst_header.h:386
Standard interface to all decomposition techniques.
Definition: IDecomp.h:13
static std::unique_ptr< ModularExtrapSterile > LoadFrom(TDirectory *dir, const std::string &name)
ModularExtrapSterile & operator=(const ModularExtrapSterile &)=delete
void SaveTo(TDirectory *dir, const std::string &name) const override
Spectrum with true energy information, allowing it to be oscillated
const Cut kNCNumuApp(NCFlavSel(14, 12))
Select NC .
Extrapolate each component using a separate ModularExtrapComponent.
Definition: ModularExtrap.h:23
static ModularExtrapSterile NCDisappearance(Loaders &loaders, const IDecomp &NCSurvDecomp, const IDecomp &NumuOscDecomp, const HistAxis &axis, const HistAxis &axisNumuND, const Cut &fdcut, const Cut &NCNDcut, const Cut &NumuNDcut, const SystShifts &shiftMC=kNoShift, const Var &weight=kUnweighted)
Creates a NC disappearance extrapolation.
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:96
static ModularExtrapSterile TrivialExtrapNC(Loaders &loaders, const HistAxis &axis, const Cut &fdcut, const SystShifts &shiftMC=kNoShift, const Var &weight=kUnweighted)
Creates a NC disappearance "extrapolation" by returning FD MC.
enum BeamMode string