All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Flux.cxx
Go to the documentation of this file.
2 
3 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
4 
5 #include "TH1.h"
6 
7 namespace ana
8 {
9  //----------------------------------------------------------------------
10  bool IsCCQEOnArgon(const caf::SRTrueInteractionProxy* nu, int pdg)
11  {
12  // It doesn't matter exactly what process we choose, so long as it
13  // corresponds to one of the modes GENIE considers as a top-level
14  // cross-section. Here we go for CC QE on Argon.
15  return nu->pdg == pdg && nu->iscc &&
16  nu->genie_mode == caf::kQE && nu->genie_inttype == caf::kCCQE &&
17  nu->targetPDG == 1000180400 /* Argon 40 */ &&
18  !nu->ischarm;
19  }
20 
21  //----------------------------------------------------------------------
22  bool IsNCQEOnArgon(const caf::SRTrueInteractionProxy* nu, int pdg)
23  {
24  // This process works for very low neutrino energy where the muon mass
25  // becomes relevant.
26  return nu->pdg == pdg && !nu->iscc &&
27  nu->genie_mode == caf::kQE && nu->genie_inttype == caf::kNCQE &&
28  nu->targetPDG == 1000180400 /* Argon 40 */ &&
29  !nu->ischarm &&
30  nu->hitnuc == 2112;
31  }
32 
33  //----------------------------------------------------------------------
34  const Var kInvXSec([](const caf::SRSliceProxy* sr)
35  {
36  // GENIE uses GeV internally. We ultimately want a flux
37  // in m^-2
38  const double GeV2perm2 = 2.56819e31;
39 
40  return GeV2perm2/sr->truth.xsec;
41  });
42 
43  //----------------------------------------------------------------------
44  // TODO can this operate completely in true interaction mode? Right now we
45  // are folding in a slicing efficiency
47  {
48  return Cut([pdg](const caf::SRSliceProxy* slc)
49  {
50  if(slc->truth.index < 0) return false;
51  return IsCCQEOnArgon(&slc->truth, pdg);
52  });
53  }
54 
55  //----------------------------------------------------------------------
57  const Binning& bins,
58  const Cut& fidvol,
59  int pdg)
60  : Spectrum("", bins, loader, SIMPLEVAR(truth.E),
61  SIMPLEVAR(truth.index) >= 0 && IsCCQEOnArgonCut(pdg) && fidvol,
63  fPdg(pdg)
64  {
65  }
66 
67  //----------------------------------------------------------------------
68  TH1D* FluxTimesNuclei::ToTH1(double exposure,
69  Color_t col,
70  Style_t style,
71  EBinType bintype)
72  {
73  TH1D* ret = Spectrum::ToTH1(exposure, col, style, kPOT, bintype);
74  ret->GetXaxis()->SetTitle("True neutrino energy (GeV)");
75 
76  std::string ytitle = "Flux #times nuclei (";
77  switch(fPdg){
78  case +12: ytitle += "#nu_e"; break;
79  case -12: ytitle += "#bar{#nu}_e"; break;
80  case +14: ytitle += "#nu_{#mu}"; break;
81  case -14: ytitle += "#bar{#nu}_{#mu}"; break;
82  }
83 
84  ytitle += "/ m^{2}";
85  if(bintype == kBinDensity) ytitle += " / GeV";
86  ytitle += ")";
87  ret->GetYaxis()->SetTitle(ytitle.c_str());
88  return ret;
89  }
90 }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
var pdg
Definition: selectors.fcl:14
tuple loader
Definition: demo.py:7
Divide bin contents by bin widths.
process_name E
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EBinType bintype=kBinContent)
Definition: Flux.cxx:68
def style
Definition: util.py:237
process_name opflashCryoW ana
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:73
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
const Var kInvXSec([](const caf::SRSliceProxy *sr){const double GeV2perm2=2.56819e31;return GeV2perm2/sr->truth.xsec;})
FluxTimesNuclei(SpectrumLoaderBase &loader, const Binning &bins, const Cut &fidvol, int pdg)
pdg PDG code for neutrino, -14,-12,+12,14
Definition: Flux.cxx:56
const SystShifts kNoShift
Definition: SystShifts.h:61
Base class for the various types of spectrum loader.
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:82
bool IsNCQEOnArgon(const caf::SRTrueInteractionProxy *nu, int pdg)
Definition: Flux.cxx:22
bool IsCCQEOnArgon(const caf::SRTrueInteractionProxy *nu, int pdg)
Definition: Flux.cxx:10
neutral current quasi-elastic
Definition: SREnums.h:87
charged current quasi-elastic
Definition: SREnums.h:86
Template for Cut and SpillCut.
Definition: Cut.h:16
BEGIN_PROLOG SN nu
Cut IsCCQEOnArgonCut(int pdg)
Definition: Flux.cxx:46