IPrediction.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "CAFAna/Core/Spectrum.h"
7 
8 class TDirectory;
9 
10 namespace ana
11 {
12  /// Enumeration of neutrino transition modes
13  namespace Flavors{
14  enum Flavors_t{
15  kNuEToNuE = 1<<0, ///< \f$\nu_e\to\nu_e\f$ ('beam \f$\nu_e \f$')
16  kNuEToNuMu = 1<<1, ///< \f$\nu_e\to\nu_\mu\f$ ('\f$\nu_\mu\f$ appearance')
17  kNuEToNuTau = 1<<2, ///< \f$\nu_e\to\nu_\tau\f$
18  kNuMuToNuE = 1<<3, ///< \f$\nu_\mu\to\nu_e\f$ ('\f$\nu_e\f$ appearance')
19  kNuMuToNuMu = 1<<4, ///< \f$\nu_\mu\to\nu_\mu\f$ ('\f$\nu_\mu\f$ survival')
20  kNuMuToNuTau = 1<<5, ///< \f$\nu_\mu\to\nu_\tau\f$
21 
22  kAllNuE = kNuEToNuE | kNuMuToNuE, ///< All \f$\nu_e\f$
23  kAllNuMu = kNuEToNuMu | kNuMuToNuMu, ///< All \f$\nu_\mu\f$
24  kAllNuTau = kNuEToNuTau | kNuMuToNuTau, ///< All \f$\nu_\tau\f$
25 
26  kAll = kAllNuE | kAllNuMu | kAllNuTau ///< All neutrinos, any flavor
27  };
28 
30  {
31  // The default definition returns an int. We don't want that
32  return Flavors_t(int(a) | int(b));
33  }
34  }
35 
36  /// Enumeration for interaction currents (CC/NC)
37  namespace Current{
38  enum Current_t{
39  kCC = 1<<0, ///< Charged-current interactions
40  kNC = 1<<1, ///< Neutral-current interactions
41 
42  kBoth = kCC | kNC ///< Interactions of both types
43  };
44  }
45 
46  /// Enumeration for neutrino sign (neutrino/antineutrino)
47  namespace Sign{
48  enum Sign_t{
49  kNu = 1<<0, ///< Neutrinos-only
50  kAntiNu = 1<<1, ///< Antineutrinos-only
51 
52  kBoth = kNu | kAntiNu ///< Both neutrinos and antineutrinos
53  };
54  }
55 
56  /// Standard interface to all prediction techniques
58  {
59  public:
60  virtual ~IPrediction(){}
61 
62  virtual Spectrum PredictUnoscillated() const;
63 
64  virtual Spectrum Predict(osc::IOscCalculator * calc) const = 0;
65  virtual SpectrumStan Predict(osc::IOscCalculatorStan * calc) const;
66 
67  virtual Spectrum PredictSyst(osc::IOscCalculator* calc, const SystShifts& syst) const;
68  virtual SpectrumStan PredictSyst(osc::IOscCalculatorStan* calc, const SystShifts& syst) const;
69 
70  virtual Spectrum PredictComponent(osc::IOscCalculator* calc,
71  Flavors::Flavors_t flav,
73  Sign::Sign_t sign) const = 0;
74 
75  virtual SpectrumStan PredictComponent(osc::IOscCalculatorStan* calc,
76  Flavors::Flavors_t flav,
77  Current::Current_t curr,
78  Sign::Sign_t sign) const;
79 
80  virtual Spectrum PredictComponentSyst(osc::IOscCalculator* calc,
81  const SystShifts& syst,
82  Flavors::Flavors_t flav,
83  Current::Current_t curr,
84  Sign::Sign_t sign) const;
85  virtual SpectrumStan PredictComponentSyst(osc::IOscCalculatorStan* calc,
86  const SystShifts& syst,
87  Flavors::Flavors_t flav,
88  Current::Current_t curr,
89  Sign::Sign_t sign) const;
90 
91  // no Stan version needed -- we've got autodiff
92  virtual void Derivative(osc::IOscCalculator* calc,
93  const SystShifts& shift,
94  double pot,
95  std::unordered_map<const ISyst*, std::vector<double>>& dchi) const
96  {
97  // Implementing this function is optional. If you don't implement it,
98  // this default implementation will be used, which signals to callers
99  // that your Prediction doesn't implement this feature.
100  dchi.clear();
101  }
102 
103  virtual OscillatableSpectrum ComponentCC(int from, int to) const
104  {std::cout << "WARNING! ComponentCC is unimplemented in IPrediction" << std::endl; abort();}
105 
106  // todo: we are discarding autodiff for any prediction that uses these by having it only return Spectrum,
107  // but I haven't thought of a good solution that doesn't require an alternate method name
108  // nc
109  virtual Spectrum ComponentNCTotal() const
110  {std::cout << "WARNING! ComponentNCTotal is unimplemented in IPrediction" << std::endl; abort();}
111  virtual Spectrum ComponentNC() const
112  {std::cout << "WARNING! ComponentNC is unimplemented in IPrediction" << std::endl; abort();}
113  virtual Spectrum ComponentNCAnti() const
114  {std::cout << "WARNING! ComponentNCAnti is unimplemented in IPrediction" << std::endl; abort();}
115  //end nc
116 
117  virtual void SaveTo(TDirectory* dir) const;
118  };
119 
120 }
virtual Spectrum ComponentNC() const
Definition: IPrediction.h:111
osc::OscCalculatorDumb calc
Oscillation analysis framework, runs over CAF files outside of ART.
Antineutrinos-only.
Definition: IPrediction.h:50
General interface to oscillation calculators.
Definition: FwdDeclare.h:15
(&#39; appearance&#39;)
Definition: IPrediction.h:18
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
(&#39;beam &#39;)
Definition: IPrediction.h:15
virtual void Derivative(osc::IOscCalculator *calc, const SystShifts &shift, double pot, std::unordered_map< const ISyst *, std::vector< double >> &dchi) const
Definition: IPrediction.h:92
virtual ~IPrediction()
Definition: IPrediction.h:60
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:37
void SaveTo(const osc::IOscCalculator &x, TDirectory *dir)
Charged-current interactions.
Definition: IPrediction.h:39
const double a
virtual Spectrum ComponentNCAnti() const
Definition: IPrediction.h:113
#define pot
Neutrinos-only.
Definition: IPrediction.h:49
def sign(x)
Definition: canMan.py:204
OStream cout
Definition: OStream.cxx:6
(&#39; survival&#39;)
Definition: IPrediction.h:19
virtual Spectrum ComponentNCTotal() const
Definition: IPrediction.h:109
TDirectory * dir
Definition: macro.C:5
Flavors_t operator|(Flavors_t a, Flavors_t b)
Definition: IPrediction.h:29
virtual OscillatableSpectrum ComponentCC(int from, int to) const
Definition: IPrediction.h:103
string syst
Definition: plotSysts.py:176
const hit & b
Definition: hits.cxx:21
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
All neutrinos, any flavor.
Definition: IPrediction.h:26
(&#39; appearance&#39;)
Definition: IPrediction.h:16
Spectrum with true energy information, allowing it to be oscillated