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 
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  */
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 
39 
40 } // namespace lar_pandora
41 
42 //------------------------------------------------------------------------------------------------------------------------------------------
43 // implementation follows
44 
45 namespace lar_pandora
46 {
47 
49 {
50 }
51 
52 //------------------------------------------------------------------------------------------------------------------------------------------
53 
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.
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
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
static int max(int a, int b)
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
std::vector< Slice > SliceVector
Definition: Slice.h:68
SimpleNeutrinoId(fhicl::ParameterSet const &pset)
Default constructor.
TCEvent evt
Definition: DataStructs.cxx:7
Simple neutrino ID tool that selects the most likely neutrino slice using the scores from Pandora...