All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ysis/ana/SBNOscReco/PostProcess/Cuts.h
Go to the documentation of this file.
1 #ifndef __sbnanalysis_CURS_HH
2 #define __sbnanalysis_CURS_HH
3 
4 #include <array>
5 
6 #include "TVector3.h"
7 
10 
11 #include "../Data/RecoEvent.h"
12 #include "core/Event.hh"
13 
14 namespace ana {
15  namespace SBNOsc {
16 
17 
18 class Cuts {
19 public:
20  static const unsigned nCuts = 11; //!< total number of cuts
21  static const unsigned nTruthCuts = 6; //!< Total number of truth cuts
22  /**
23  * Initialize this class.
24  * \param cfg fhicl configuration for the class
25  * \geometry A pointer to the geoemtry of the detector to configure
26  */
27  void Initialize(const fhicl::ParameterSet &cfg,
29  /**
30  * Process each cut associated with reconstructed events
31  * \param event The reconstructed event information
32  * \param reco_vertex_index The index of the candidate reconstructed neutrino vertex into the list of such vertices in the RecoEvent
33  *
34  * \return A list of bool's of whether the reco event passes each cut
35  */
36  std::array<bool, nCuts> ProcessRecoCuts(const numu::RecoEvent &event,
37  unsigned reco_vertex_index,
38  bool fSequentialCuts = true) const;
39 
40  /**
41  * Process each cut associated with true events
42  * \param event Event information
43  * \param truth_vertex_index The index of the true neutrino vertex into the lsit of true interactions in the RecoEvent
44  *
45  * \return A list of bool's of whether the true event passes each cut
46  */
47  std::array<bool, nTruthCuts> ProcessTruthCuts(const numu::RecoEvent &event,
48  const event::Event &core,
49  unsigned truth_vertex_index,
50  bool SequentialCuts=true) const;
51 
52  /**
53  * Select a reco event based on the cut values provided by ProcessRecoCuts
54  * \param cuts the list of cuts returned by ProcessRecoCuts
55  *
56  * \return whether to select this reconstructed neutrino vertex candidate
57  */
58  bool SelectReco(std::array<bool, nCuts> &cuts);
59  /**
60  * Test whether a point is in the configured fiducial volume
61  * \param v The point to test
62  *
63  * \return Whether the point is in the configured fiducial volume
64  */
65  bool InFV(const TVector3 &v) const;
66  /**
67  * Test whether a point is in the configured fiducial volume
68  * \param v The point to test
69  *
70  * \return Whether the point is in the configured fiducial volume
71  */
72  bool InFV(const geo::Point_t &v) const;
73  /**
74  * Test whether a point is in the configured track containment volume
75  * \param v The point to test
76  *
77  * \return Whether the point is in the configured track containment volume
78  */
79  bool InCosmicContainment(const TVector3 &v) const;
80 
81  /**
82  * Test whether a point is in the configured track containment volume
83  * \param v The point to test
84  *
85  * \return Whether the point is in the configured track containment volume
86  */
87  bool InCalorimetricContainment(const TVector3 &v) const;
88 
89  /**
90  * Gets the time of the CRT match to a track.
91  * \param track The track object
92  *
93  * \return The time [us] of the CRT match. Returns nonsense if no such match exists.
94  */
95  float CRTMatchTime(const numu::RecoTrack &track) const;
96 
97  /**
98  * Whether a TPC track has a CRT hit match
99  * \param track the TPC track
100  * \return Whether a TPC track has a CRT hit match
101  */
102  bool HasCRTHitMatch(const numu::RecoTrack &track) const;
103 
104  /**
105  * Returns whether a time value is within the configured beam spill window
106  * \param time The time to test
107  * \return True when the time is in the beam spill window.
108  */
109  bool TimeInSpill(float time) const;
110  bool TimeInCRTActiveSpill(float time) const;
111 
112  /**
113  * Whether a TPC track has a CRT track match
114  * \param track the TPC track
115  * \return Whether a TPC track has a CRT track match
116  */
117  bool HasCRTTrackMatch(const numu::RecoTrack &track) const;
118 
119  bool PassFlashTrigger(const numu::RecoEvent &event) const;
120 
121  static constexpr std::array<const char *, nTruthCuts> truthCutNames = { "Truth", "T_fid", "T_trig", "T_vqual", "T_tqual", "T_reco"};
122  static constexpr std::array<const char *, nCuts> cutNames =
123  {"Reco", "R_trig", "R_flashtime", "R_fid", "R_goodmcs", "R_flashmatch",
124  "R_crttrack", "R_crthit", "R_crtactive", "R_contained", "R_length"};
125 
126  const std::vector<std::string> &CutOrder() const {
127  return fConfig.CutOrder;
128  }
129 
130  const std::vector<std::string> &TruthCutOrder() const {
131  return fConfig.TruthCutOrder;
132  }
133 
134 private:
135  struct VolYZ {
136  std::array<double, 2> Y;
137  std::array<double, 2> Z;
138  };
139 
140  struct Config {
145  float CRTHitDist;
146  std::array<float, 2> CRTHitTimeRange;
147  std::array<float, 2> CRTActivityTimeRange;
149  float TrackLength;
152  std::vector<std::string> CutOrder;
153  std::vector<std::string> TruthCutOrder;
154  std::vector<geo::BoxBoundedGeo> fiducial_volumes;
155  std::vector<VolYZ> cosmic_containment_volumes;
156  std::vector<geo::BoxBoundedGeo> active_volumes;
157  std::vector<geo::BoxBoundedGeo> calorimetric_containment_volumes;
162  };
163 
165 
166 };
167 
168  }
169 }
170 
171 #endif
172 
bool TimeInSpill(float time) const
Definition: Cuts.cc:217
bool HasCRTHitMatch(const numu::RecoTrack &track) const
Definition: Cuts.cc:205
std::array< bool, nTruthCuts > ProcessTruthCuts(const numu::RecoEvent &event, const event::Event &core, unsigned truth_vertex_index, bool SequentialCuts=true) const
Definition: Cuts.cc:86
std::vector< geo::BoxBoundedGeo > active_volumes
const geo::GeometryCore * geometry
std::vector< geo::BoxBoundedGeo > calorimetric_containment_volumes
bool HasCRTTrackMatch(const numu::RecoTrack &track) const
Definition: Cuts.cc:199
std::vector< geo::BoxBoundedGeo > fiducial_volumes
bool InCosmicContainment(const TVector3 &v) const
Definition: Cuts.cc:248
std::array< bool, nCuts > ProcessRecoCuts(const numu::RecoEvent &event, unsigned reco_vertex_index, bool fSequentialCuts=true) const
Definition: Cuts.cc:125
process_name use argoneut_mc_hitfinder track
process_name opflashCryoW ana
const std::vector< std::string > & TruthCutOrder() const
Access the description of detector geometry.
static const unsigned nCuts
total number of cuts
bool InFV(const TVector3 &v) const
Definition: Cuts.cc:234
float CRTMatchTime(const numu::RecoTrack &track) const
Definition: Cuts.cc:211
Description of geometry of one entire detector.
bool PassFlashTrigger(const numu::RecoEvent &event) const
Definition: Cuts.cc:121
Provides a base class aware of world box coordinates.
The standard event data definition.
Definition: Event.hh:228
static const unsigned nTruthCuts
Total number of truth cuts.
static constexpr std::array< const char *, nTruthCuts > truthCutNames
static constexpr std::array< const char *, nCuts > cutNames
bool TimeInCRTActiveSpill(float time) const
Definition: Cuts.cc:222
bool InCalorimetricContainment(const TVector3 &v) const
Definition: Cuts.cc:241
void Initialize(const fhicl::ParameterSet &cfg, const geo::GeometryCore *geometry)
Definition: Cuts.cc:10
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
bool SelectReco(std::array< bool, nCuts > &cuts)
const std::vector< std::string > & CutOrder() const