All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleNeutrinoId_tool.cc
Go to the documentation of this file.
1 /**
2  * @file larpandora/LArPandoraEventBuilding/LArPandoraSimpleNeutrinoId_tool.cc
3  *
4  * @brief implementation of the lar pandora simple neutrino id tool
5  */
6 
7 #include "art/Utilities/ToolMacros.h"
8 #include "fhiclcpp/ParameterSet.h"
9 
12 
13 namespace lar_pandora
14 {
15 
16 /**
17  * @brief Simple neutrino ID tool that selects the most likely neutrino slice using the scores from Pandora
18  */
20 {
21 public:
22  /**
23  * @brief Default constructor
24  *
25  * @param pset FHiCL parameter set
26  */
27  SimpleNeutrinoId(fhicl::ParameterSet const &pset);
28 
29  /**
30  * @brief Classify slices as neutrino or cosmic
31  *
32  * @param slices the input vector of slices to classify
33  * @param evt the art event
34  */
35  void ClassifySlices(SliceVector &slices, const art::Event &evt) override;
36 };
37 
38 DEFINE_ART_CLASS_TOOL(SimpleNeutrinoId)
39 
40 } // namespace lar_pandora
41 
42 //------------------------------------------------------------------------------------------------------------------------------------------
43 // implementation follows
44 
45 namespace lar_pandora
46 {
47 
48 SimpleNeutrinoId::SimpleNeutrinoId(fhicl::ParameterSet const &/*pset*/)
49 {
50 }
51 
52 //------------------------------------------------------------------------------------------------------------------------------------------
53 
54 void SimpleNeutrinoId::ClassifySlices(SliceVector &slices, const art::Event &/*evt*/)
55 {
56  if (slices.empty()) return;
57 
58  // Find the most probable slice
59  float highestNuScore(-std::numeric_limits<float>::max());
60  unsigned int mostProbableSliceIndex(std::numeric_limits<unsigned int>::max());
61 
62  for (unsigned int sliceIndex = 0; sliceIndex < slices.size(); ++sliceIndex)
63  {
64  const float nuScore(slices.at(sliceIndex).GetTopologicalScore());
65  if (nuScore > highestNuScore)
66  {
67  highestNuScore = nuScore;
68  mostProbableSliceIndex = sliceIndex;
69  }
70  }
71 
72  // Tag the most probable slice as a neutrino
73  slices.at(mostProbableSliceIndex).TagAsTarget();
74 }
75 
76 } // namespace lar_pandora
Abstract base class for a slice ID tool.
void ClassifySlices(SliceVector &slices, const art::Event &evt) override
Classify slices as neutrino or cosmic.
header for the lar pandora slice ID base tool
header for the lar pandora slice class
std::vector< TCSlice > slices
Definition: DataStructs.cxx:13
SimpleNeutrinoId(fhicl::ParameterSet const &pset)
Default constructor.
TCEvent evt
Definition: DataStructs.cxx:8
Simple neutrino ID tool that selects the most likely neutrino slice using the scores from Pandora...