All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
helper_pur_slc_cumulative.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "helper.h"
4 
5 using namespace ana;
6 
7 // These are examples of useful structs to
8 // use when making a bunch of Spectra
9 struct PlotDef {
10  std::string suffix = "";
11  std::string label = "";
12  Binning bins = Binning::Simple(3, 0, 3);
13  Var var = kCounting;
14 };
15 
16 const Binning kBDTBinning = Binning::Simple(40, 0, 1.0);
19 const Binning kGapBinning = Binning::Simple(20, 0, 20);
22 const Binning kLengthBinning = Binning::Simple(42, -5.01, 200);
23 const Binning kPEBinning = Binning::Simple(70, 0., 1400);
24 const Binning kTimeBinning = Binning::Simple(70, -3500, 3500);
25 const Binning kFlashBinning = Binning::Simple(40, -6.f, 34.f);
26 const Binning kPdgBinning = Binning::Simple(5000, -2500, 2500);
27 
28 // // In this example, we are making the following Spectra
29 std::vector<PlotDef> plots = {
30  { "count", "", Binning::Simple(3, 0, 3), kCounting },
31  { "bestenergy", "Best plane energy (GeV)", kEnergyBinningGeV, kRecoShower_BestEnergy },
32  { "conversion", "Conversion gap (cm)", kGapBinning, kRecoShower_ConversionGap },
33  { "dedx", "dEdx (MeV/cm)", kdEdxBinning, kRecoShower_BestdEdx },
34  { "slength", "Shower Length (cm)", kLengthBinning, kRecoShower_Length },
35  { "tlength", "Longest Track Length (cm)", kLengthBinning, kLongestTrackLength },
36  { "openangle", "Opening angle (rad)", kOpenAngleBinning, kRecoShower_OpenAngle },
37  { "density", "Shower density (MeV/cm)", kDensityBinning, kRecoShower_Density },
38  { "startx", "Shower start position X (cm)", kPositionXNDBinning, kRecoShower_StartX },
39  { "starty", "Shower start position Y (cm)", kPositionYNDBinning, kRecoShower_StartY },
40  { "startz", "Shower start position Z (cm)", kPositionZNDBinning, kRecoShower_StartZ },
41  { "vtxx", "Slice vertex X (cm)", kPositionXNDBinning, kSlcVtxX },
42  { "vtxy", "Slice vertes Y (cm)", kPositionYNDBinning, kSlcVtxY },
43  { "vtxz", "Slice vertex Z (cm)", kPositionZNDBinning, kSlcVtxZ },
44  { "nuScore", "Slice Nu Score", kBDTBinning, kSlcNuScore },
45  { "flashScore", "Slice Flash Score", kFlashBinning, kSlcFlashScore },
46  { "vtxdist", "Vertex Distance (cm)", kGapBinning, kTruthVtxDistMag },
47  { "trueshwpdg", "True Shower Pdg", kPdgBinning, kRecoShower_TruePdg },
48  { "truetrkpdg", "True Track Pdg", kPdgBinning, kLongestTrackTruePdg },
49 };
50 
51 // Selection Struc
52 struct SelDef {
53  std::string suffix = "";
54  std::string label = "";
55  Cut cut = kNoCut;
56  int color = kBlack;
57 };
58 
59 std::vector<SelDef> types = {
60  { "nuecc", "NuE CC", kSlcIsRecoNu&& kNuECC, kBlue + 1 },
61  { "numucc", "NuMu CC", kSlcIsRecoNu&& kNuMuCC, kRed + 1 },
62  { "nunc", "NC", kSlcIsRecoNu&& kNC, kOrange },
63  { "othernu", "Other Nu", kSlcIsRecoNu&& kOtherNu, kOrange },
64  { "cosmic", "Cosmic", kSlcIsRecoNu&& kCosmicRay, kBlack },
65 };
66 
67 std::vector<SelDef> sels = {
68  { "fvcut", "FV Cut", kFiducialVolumeND&& kVtxDistMagCut, kBlue },
69  { "nuscorecut", "Nu Score Cut", kSlcNuScoreCut, kBlue },
70  { "fmatchcut", "Flah Match Cut", kSlcFlashMatchCut, kBlue },
71  { "recosel", "Reco Selection", kRecoNueSel, kBlue },
72  { "trklencut", "Track Length Cut", kNueTrackLenCut, kBlue },
73  { "shwdensitycut", "Shower Density Cut", kShowerDensityCut, kBlue },
74  { "shwconvgapcut", "Conversion Gap Cut", kShowerConvGapCut, kBlue },
75  { "shwdedxcut", "Shower dEdx Cut", kShowerdEdxCut, kBlue },
76  { "fullsel", "Full Selection", kFullNueSel, kBlue },
77 };
78 
79 // std::vector<SelDef> sels = {
80 // { "fvcut", "FV Cut", kFiducialVolumeND&& kVtxDistMagCut, kBlue },
81 // { "presel", "Pre Selection", kPreNueSel, kBlue },
82 // { "recosel", "Reco Selection", kRecoNueSel, kBlue },
83 // { "fullsel", "Full Selection", kFullNueSel, kBlue },
84 // };
const Binning kLengthBinning
const Cut kShowerConvGapCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].conversion_gap< 3.25f);})
Definition: NueCuts.h:22
const Cut kNoCut([](const caf::SRSliceProxy *){return true;})
The simplest possible cut: pass everything, used as a default.
const Var kRecoShower_OpenAngle([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?180.*shw->open_angle/M_PI:-5.;})
Definition: NueVars.h:16
const Cut kShowerDensityCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].density > 4.5);})
Definition: NueCuts.h:23
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
const Binning kTimeBinning
const Binning kDensityBinning
const Binning kBDTBinning
Definition: Binnings.cxx:40
const Var kRecoShower_StartX([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.x):-9999.;})
Definition: NueVars.h:17
const Var kSlcFlashScore([](const caf::SRSliceProxy *slc) -> double{return((bool) kSlcHasFlash(slc)?(float) slc->fmatch.score:-5.f);})
Definition: Vars.h:35
const Binning kPositionYNDBinning
Definition: Binnings.cxx:30
const Cut kSlcFlashMatchCut([](const caf::SRSliceProxy *slc){return(kSlcHasFlashMatch(slc)&&slc->fmatch.score >0 &&slc->fmatch.score< 6);})
const Binning kPositionZNDBinning
Definition: Binnings.cxx:31
const Var kRecoShower_StartY([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.y):-9999.;})
Definition: NueVars.h:18
const Var kTruthVtxDistMag([](const caf::SRSliceProxy *slc) -> double{return(kHasTruthMatch(slc)?(float) std::hypot(kTruthVtxDistX(slc), kTruthVtxDistY(slc), kTruthVtxDistZ(slc)):-5.f);})
Definition: TruthVars.h:20
const Binning kOpenAngleBinning
process_name opflashCryoW ana
const Binning kdEdxBinning
const Var kSlcVtxX([](const caf::SRSliceProxy *slc) -> double{return slc->vertex.x;})
Definition: Vars.h:30
const Binning kEnergyBinningGeV
const Var kSlcVtxY([](const caf::SRSliceProxy *slc) -> double{return slc->vertex.y;})
Definition: Vars.h:31
Definition: demo.h:63
const Cut kFullNueSel
Definition: NueCuts.h:38
const Var kRecoShower_BestEnergy([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->bestplane_energy):-5;})
Definition: NueVars.h:10
const Cut kFiducialVolumeND([](const caf::SRSliceProxy *slc){return PtInVolAbsX(slc->vertex, fvndAbs);})
const Var kSlcVtxZ([](const caf::SRSliceProxy *slc) -> double{return slc->vertex.z;})
Definition: Vars.h:32
const Cut kSlcIsRecoNu([](const caf::SRSliceProxy *slc){return!slc->is_clear_cosmic;})
std::vector< SelDef > types
const Binning kPositionXNDBinning
Definition: Binnings.cxx:29
const Binning kPEBinning
const Var kRecoShower_Length([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->len):-5.;})
Definition: NueVars.h:15
std::vector< PlotDef > plots
Definition: demo.h:54
const Cut kCosmicRay
const Cut kSlcNuScoreCut([](const caf::SRSliceProxy *slc){return(kSlcIsRecoNu(slc)&&slc->nu_score >0.4);})
const Cut kNueTrackLenCut([](const caf::SRSliceProxy *slc){return kLongestTrackLength(slc)< 110.f;})
Definition: NueCuts.h:13
const Var kRecoShower_StartZ([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.z):-9999.;})
Definition: NueVars.h:19
std::vector< SelDef > sels
Definition: demo.h:77
const Cut kNuMuCC
const Cut kRecoNueSel
Definition: NueCuts.h:37
const Cut kShowerdEdxCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].bestplane_dEdx< 3.625f);})
Definition: NueCuts.h:21
Definition: demo.h:45
const Var kRecoShower_Density([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->density):-5.;})
Definition: NueVars.h:13
const Var kLongestTrackTruePdg([](const caf::SRSliceProxy *slc) -> int{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?int(trk->truth.p.pdg):-5;})
Definition: NueVars.h:30
const Cut kNuECC
const Binning kGapBinning
const Var kCounting
Definition: Vars.cxx:19
const Binning kFlashBinning
Neutral-current interactions.
Definition: IPrediction.h:39
const Var kRecoShower_ConversionGap([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->conversion_gap):-5.;})
Definition: NueVars.h:12
const Cut kOtherNu
const Var kRecoShower_BestdEdx([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);if(!shw||shw->bestplane_dEdx< 0) return-5.;return shw->bestplane_dEdx;})
Definition: NueVars.h:11
const Var kSlcNuScore([](const caf::SRSliceProxy *slc) -> double{return slc->nu_score;})
Definition: Vars.h:33
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:38
const Cut kVtxDistMagCut([](const caf::SRSliceProxy *slc){if(slc->truth.index< 0) return true;return(kTruthVtxDistMag(slc)< 1);})
const Binning kPdgBinning
const Var kRecoShower_TruePdg([](const caf::SRSliceProxy *slc) -> int{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?int(shw->truth.p.pdg):-5;})
Definition: NueVars.h:29
const Var kLongestTrackLength([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?double(trk->len):-5.;})
Definition: NueVars.h:34