All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vars.cxx
Go to the documentation of this file.
2 
4 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
5 
6 #include "TFile.h"
7 #include "TH1.h"
8 
9 #include <iostream>
10 #include <vector>
11 
12 namespace ana
13 {
14 
15  const SpillVar kRun = SIMPLESPILLVAR(hdr.run);
16  const SpillVar kEvt = SIMPLESPILLVAR(hdr.evt);
17  // const Var kSlc = SIMPLEVAR(hdr.subevt);
18 
21 
22 
23  // There can be more than one crt hit per spill so the variables are vectors.
24  // Use SpillMultiVar for now.
25  const SpillMultiVar kCRTHitX([](const caf::SRSpillProxy *sr)
26  {
27  std::vector<double> positions;
28  for(const auto& hit : sr->crt_hits){
29  positions.push_back(hit.position.x);
30  }
31  return positions;
32  });
33 
34  const SpillMultiVar kCRTHitY([](const caf::SRSpillProxy *sr)
35  {
36  std::vector<double> positions;
37  for(const auto& hit : sr->crt_hits){
38  positions.push_back(hit.position.y);
39  }
40  return positions;
41  });
42 
43  const SpillMultiVar kCRTHitZ([](const caf::SRSpillProxy *sr)
44  {
45  std::vector<double> positions;
46  for(const auto& hit : sr->crt_hits){
47  positions.push_back(hit.position.z);
48  }
49  return positions;
50  });
51 
52  const SpillMultiVar kCRTHitPE([](const caf::SRSpillProxy *sr)
53  {
54  std::vector<double> pes;
55  for(const auto& hit : sr->crt_hits){
56  pes.push_back(hit.pe);
57  }
58  return pes;
59  });
60 
61  const SpillMultiVar kCRTHitTime([](const caf::SRSpillProxy *sr)
62  {
63  std::vector<double> times;
64  for(const auto& hit : sr->crt_hits){
65  times.push_back(hit.time);
66  }
67  return times;
68  });
69 
70  // Temporary use for ICARUS as of Nov 25 2020
71  // Bug: the time should be unsigned and the beam spill at zero
72  // Correct by substracting the amount by which the beam spill is shifted
74  {
75  std::vector<double> times;
76  for(const auto& hit : sr->crt_hits){
77  auto thistime = hit.time - 1600.;
78  times.push_back(thistime);
79  }
80  return times;
81  });
82 
83  // // For when we have spill beam mode info
84  // const SpillCut kIsRHC([](const caf::SRProxy* sr) {return sr->spill.isRHC;});
85 
86  const Var kSlcVtxX([](const caf::SRSliceProxy *slc) -> double
87  {
88  return slc->vertex.x;
89  });
90 
91  const Var kSlcVtxY([](const caf::SRSliceProxy *slc) -> double
92  {
93  return slc->vertex.y;
94  });
95 
96  const Var kSlcVtxZ([](const caf::SRSliceProxy *slc) -> double
97  {
98  return slc->vertex.z;
99  });
100 
101  const Var kSlcNuScore([](const caf::SRSliceProxy *slc) -> double
102  {
103  return slc->nu_score;
104  });
105 
106  const Var kSlcHasFlash([](const caf::SRSliceProxy *slc) -> double
107  {
108  return slc->fmatch.present;
109  });
110 
111  const Var kSlcFlashScore([](const caf::SRSliceProxy *slc) -> double
112  {
113  return ((bool)kSlcHasFlash(slc) ? (float)slc->fmatch.score : -5.f);
114  });
115 
116  const Var kSlcIsRecoNu([](const caf::SRSliceProxy *slc) -> double
117  {
118  return !slc->is_clear_cosmic;
119  });
120 }
const SpillVar kSpillUnweighted([](const caf::SRSpillProxy *){return 1;})
const SpillMultiVar kCRTHitTime([](const caf::SRSpillProxy *sr){std::vector< double > times;for(const auto &hit:sr->crt_hits){times.push_back(hit.time);}return times;})
Definition: Vars.h:19
const SpillMultiVar kCRTHitX([](const caf::SRSpillProxy *sr){std::vector< double > positions;for(const auto &hit:sr->crt_hits){positions.push_back(hit.position.x);}return positions;})
Definition: Vars.h:15
#define SIMPLESPILLVAR(CAFNAME)
Definition: Var.h:84
const SpillMultiVar kCRTHitTimeFD([](const caf::SRSpillProxy *sr){std::vector< double > times;for(const auto &hit:sr->crt_hits){auto thistime=hit.time-1600.;times.push_back(thistime);}return times;})
Definition: Vars.h:20
const Var kSlcFlashScore([](const caf::SRSliceProxy *slc) -> double{return((bool) kSlcHasFlash(slc)?(float) slc->fmatch.score:-5.f);})
Definition: Vars.h:35
process_name hit
Definition: cheaterreco.fcl:51
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
const SpillVar kRun
Definition: Vars.cxx:15
const SpillMultiVar kCRTHitPE([](const caf::SRSpillProxy *sr){std::vector< double > pes;for(const auto &hit:sr->crt_hits){pes.push_back(hit.pe);}return pes;})
Definition: Vars.h:18
const Cut kSlcIsRecoNu([](const caf::SRSliceProxy *slc){return!slc->is_clear_cosmic;})
_MultiVar< caf::SRSpillProxy > SpillMultiVar
Definition: MultiVar.h:49
caf::Proxy< caf::StandardRecord > SRSpillProxy
Definition: EpilogFwd.h:3
const SpillMultiVar kCRTHitY([](const caf::SRSpillProxy *sr){std::vector< double > positions;for(const auto &hit:sr->crt_hits){positions.push_back(hit.position.y);}return positions;})
Definition: Vars.h:16
const SpillMultiVar kCRTHitZ([](const caf::SRSpillProxy *sr){std::vector< double > positions;for(const auto &hit:sr->crt_hits){positions.push_back(hit.position.z);}return positions;})
Definition: Vars.h:17
const Var kSlcVtxX([](const caf::SRSliceProxy *slc) -> double{return slc->slc.vertex.x;})
const Var kUnweighted([](const caf::SRSliceProxy *){return 1;})
The simplest possible Var, always 1. Used as a default weight.
const Var kCounting
Definition: Vars.cxx:19
const SpillVar kSpillCounting
Definition: Vars.cxx:20
const Var kSlcVtxZ([](const caf::SRSliceProxy *slc) -> double{return slc->slc.vertex.z;})
const Var kSlcVtxY([](const caf::SRSliceProxy *slc) -> double{return slc->slc.vertex.y;})
Most useful for combining weights.
Definition: Var.h:23
const Var kSlcHasFlash([](const caf::SRSliceProxy *slc) -> double{return slc->fmatch.present;})
Definition: Vars.h:34
const Var kSlcNuScore([](const caf::SRSliceProxy *slc) -> double{return slc->nu_score;})
Definition: Vars.h:33
const SpillVar kEvt
Definition: Vars.cxx:16