LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lcvn::Result Class Reference

Result, basic output of CVN neural net. More...

#include "Result.h"

Public Member Functions

 Result (const float *output, unsigned int &nOutputs)
 
 Result (const std::vector< std::vector< float >> output)
 
 Result ()
 
unsigned int ArgMax (int output_n) const
 Index of maximum value in vector. More...
 
float Max ()
 Maximum value in vector. More...
 
TFIsAntineutrino PredictedIsAntineutrino () const
 Return the predicted is_antineutrino. More...
 
TFFlavour PredictedFlavour () const
 Return the predicted flavour. More...
 
TFInteraction PredictedInteraction () const
 Return the predicted interaction. More...
 
TFTopologyProtons PredictedProtons () const
 Return the predicted protons. More...
 
TFTopologyPions PredictedPions () const
 Return the predicted pions. More...
 
TFTopologyPizeros PredictedPizeros () const
 Return the predicted pizeros. More...
 
TFTopologyNeutrons PredictedNeutrons () const
 Return the predicted neutrons. More...
 
float GetIsAntineutrinoProbability () const
 Return the is_antineutrino probability. More...
 
float GetNumuProbability () const
 Return the numu flavour probability. More...
 
float GetNueProbability () const
 Return the nue flavour probability. More...
 
float GetNutauProbability () const
 Return the nutau flavour probability. More...
 
float GetNCProbability () const
 Return the NC probability. More...
 
float GetQEProbability () const
 Return the CC QE interaction probability. More...
 
float GetResProbability () const
 Return the CC Res interaction probability. More...
 
float GetDISProbability () const
 Return the CC DIS interaction probability. More...
 
float GetOtherProbability () const
 Return the CC Other interaction probability. More...
 
float Get0protonsProbability () const
 Return the 0 protons topology probability. More...
 
float Get1protonsProbability () const
 Return the 1 protons topology probability. More...
 
float Get2protonsProbability () const
 Return the 2 protons topology probability. More...
 
float GetNprotonsProbability () const
 Return the >2 protons topology probability. More...
 
float Get0pionsProbability () const
 Return the 0 pions topology probability. More...
 
float Get1pionsProbability () const
 Return the 1 pions topology probability. More...
 
float Get2pionsProbability () const
 Return the 2 pions topology probability. More...
 
float GetNpionsProbability () const
 Return the >2 pions topology probability. More...
 
float Get0pizerosProbability () const
 Return the 0 pizeros topology probability. More...
 
float Get1pizerosProbability () const
 Return the 1 pizeros topology probability. More...
 
float Get2pizerosProbability () const
 Return the 2 pizeros topology probability. More...
 
float GetNpizerosProbability () const
 Return the >2 pizeros topology probability. More...
 
float Get0neutronsProbability () const
 Return the 0 neutrons topology probability. More...
 
float Get1neutronsProbability () const
 Return the 1 neutrons topology probability. More...
 
float Get2neutronsProbability () const
 Return the 2 neutrons topology probability. More...
 
float GetNneutronsProbability () const
 Return the >2 neutrons topology probability. More...
 
unsigned int NOutput ()
 Number of outputs, i.e. size of vector. More...
 

Public Attributes

std::vector< std::vector< float > > fOutput
 Vector of outputs from neural net. More...
 

Detailed Description

Result, basic output of CVN neural net.

Definition at line 17 of file Result.h.

Constructor & Destructor Documentation

lcvn::Result::Result ( const float *  output,
unsigned int &  nOutputs 
)

Definition at line 19 of file Result.cxx.

References fOutput.

19  : fOutput(1)
20  {
21  fOutput[0].resize(nOutputs);
22  for (size_t i = 0; i < nOutputs; ++i) {
23  fOutput[0][i] = output[i];
24  }
25  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
lcvn::Result::Result ( const std::vector< std::vector< float >>  output)

Definition at line 27 of file Result.cxx.

References fOutput.

28  {
29  fOutput = output;
30  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
lcvn::Result::Result ( )

Definition at line 32 of file Result.cxx.

32 : fOutput() {}
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130

Member Function Documentation

unsigned int lcvn::Result::ArgMax ( int  output_n) const

Index of maximum value in vector.

Definition at line 34 of file Result.cxx.

References util::begin(), util::end(), and fOutput.

Referenced by PredictedFlavour(), PredictedInteraction(), PredictedNeutrons(), PredictedPions(), PredictedPizeros(), and PredictedProtons().

35  {
36  // Get the max element iterator and convert to vector index
37 
38  // single-output
39  if (fOutput.size() == 1)
40  return std::distance(fOutput[0].begin(),
41  std::max_element(fOutput[0].begin(), fOutput[0].end()));
42  // multi-output
43  return std::distance(fOutput[output_n].begin(),
44  std::max_element(fOutput[output_n].begin(), fOutput[output_n].end()));
45  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
float lcvn::Result::Get0neutronsProbability ( ) const

Return the 0 neutrons topology probability.

Definition at line 310 of file Result.cxx.

References fOutput, lcvn::kTop0neutron, and lcvn::neutrons.

311  {
312  // single-output
313  if (fOutput.size() == 1) return -1; // There is no neutrons probability
314  // multi-output
316  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get0pionsProbability ( ) const

Return the 0 pions topology probability.

Definition at line 238 of file Result.cxx.

References fOutput, lcvn::kTop0pion, and lcvn::pions.

239  {
240  // single-output
241  if (fOutput.size() == 1) return -1; // There is no pions probability
242  // multi-output
244  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get0pizerosProbability ( ) const

Return the 0 pizeros topology probability.

Definition at line 274 of file Result.cxx.

References fOutput, lcvn::kTop0pizero, and lcvn::pizeros.

275  {
276  // single-output
277  if (fOutput.size() == 1) return -1; // There is no pizeros probability
278  // multi-output
280  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get0protonsProbability ( ) const

Return the 0 protons topology probability.

Definition at line 202 of file Result.cxx.

References fOutput, lcvn::kTop0proton, and lcvn::protons.

203  {
204  // single-output
205  if (fOutput.size() == 1) return -1; // There is no protons probability
206  // multi-output
208  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get1neutronsProbability ( ) const

Return the 1 neutrons topology probability.

Definition at line 319 of file Result.cxx.

References fOutput, lcvn::kTop1neutron, and lcvn::neutrons.

320  {
321  // single-output
322  if (fOutput.size() == 1) return -1; // There is no neutrons probability
323  // multi-output
325  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get1pionsProbability ( ) const

Return the 1 pions topology probability.

Definition at line 247 of file Result.cxx.

References fOutput, lcvn::kTop1pion, and lcvn::pions.

248  {
249  // single-output
250  if (fOutput.size() == 1) return -1; // There is no pions probability
251  // multi-output
253  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get1pizerosProbability ( ) const

Return the 1 pizeros topology probability.

Definition at line 283 of file Result.cxx.

References fOutput, lcvn::kTop1pizero, and lcvn::pizeros.

284  {
285  // single-output
286  if (fOutput.size() == 1) return -1; // There is no pizeros probability
287  // multi-output
289  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get1protonsProbability ( ) const

Return the 1 protons topology probability.

Definition at line 211 of file Result.cxx.

References fOutput, lcvn::kTop1proton, and lcvn::protons.

212  {
213  // single-output
214  if (fOutput.size() == 1) return -1; // There is no protons probability
215  // multi-output
217  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get2neutronsProbability ( ) const

Return the 2 neutrons topology probability.

Definition at line 328 of file Result.cxx.

References fOutput, lcvn::kTop2neutron, and lcvn::neutrons.

329  {
330  // single-output
331  if (fOutput.size() == 1) return -1; // There is no neutrons probability
332  // multi-output
334  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get2pionsProbability ( ) const

Return the 2 pions topology probability.

Definition at line 256 of file Result.cxx.

References fOutput, lcvn::kTop2pion, and lcvn::pions.

257  {
258  // single-output
259  if (fOutput.size() == 1) return -1; // There is no pions probability
260  // multi-output
262  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get2pizerosProbability ( ) const

Return the 2 pizeros topology probability.

Definition at line 292 of file Result.cxx.

References fOutput, lcvn::kTop2pizero, and lcvn::pizeros.

293  {
294  // single-output
295  if (fOutput.size() == 1) return -1; // There is no pizeros probability
296  // multi-output
298  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Get2protonsProbability ( ) const

Return the 2 protons topology probability.

Definition at line 220 of file Result.cxx.

References fOutput, lcvn::kTop2proton, and lcvn::protons.

221  {
222  // single-output
223  if (fOutput.size() == 1) return -1; // There is no protons probability
224  // multi-output
226  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetDISProbability ( ) const

Return the CC DIS interaction probability.

Definition at line 184 of file Result.cxx.

References fOutput, lcvn::interaction, and lcvn::kInteDISCC.

185  {
186  // single-output
187  if (fOutput.size() == 1) return -1; // There is no interaction probability
188  // multi-output
190  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetIsAntineutrinoProbability ( ) const

Return the is_antineutrino probability.

Definition at line 101 of file Result.cxx.

References fOutput, and lcvn::is_antineutrino.

Referenced by PredictedIsAntineutrino().

102  {
103  // single-output
104  if (fOutput.size() == 1) return -1; // There is no is_antineutrino output
105  // multi-output
107  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNCProbability ( ) const

Return the NC probability.

Definition at line 143 of file Result.cxx.

References lcvn::flavour, fOutput, lcvn::kFlavNC, lcvn::kTFNC, and util::size().

144  {
145 
146  // The old caffe network didn't give us an NC probability
147  // So make sure we have enough values to grab it
148  float result = -999;
149 
150  // single-output
151  if (fOutput.size() == 1) {
152  if (fOutput[0].size() > static_cast<unsigned int>(TFResultType::kTFNC)) {
153  result = fOutput[0][TFResultType::kTFNC];
154  }
155  else {
156  mf::LogError("lcvn::Result")
157  << "Output vector too short to include an NC probability" << std::endl;
158  }
159  return result;
160  }
161  // multi-output
163  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
NC interaction.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNneutronsProbability ( ) const

Return the >2 neutrons topology probability.

Definition at line 337 of file Result.cxx.

References fOutput, lcvn::kTopNneutron, and lcvn::neutrons.

338  {
339  // single-output
340  if (fOutput.size() == 1) return -1; // There is no neutrons probability
341  // multi-output
343  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNpionsProbability ( ) const

Return the >2 pions topology probability.

Definition at line 265 of file Result.cxx.

References fOutput, lcvn::kTopNpion, and lcvn::pions.

266  {
267  // single-output
268  if (fOutput.size() == 1) return -1; // There is no pions probability
269  // multi-output
271  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNpizerosProbability ( ) const

Return the >2 pizeros topology probability.

Definition at line 301 of file Result.cxx.

References fOutput, lcvn::kTopNpizero, and lcvn::pizeros.

302  {
303  // single-output
304  if (fOutput.size() == 1) return -1; // There is no pizeros probability
305  // multi-output
307  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNprotonsProbability ( ) const

Return the >2 protons topology probability.

Definition at line 229 of file Result.cxx.

References fOutput, lcvn::kTopNproton, and lcvn::protons.

230  {
231  // single-output
232  if (fOutput.size() == 1) return -1; // There is no protons probability
233  // multi-output
235  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetNueProbability ( ) const

Return the nue flavour probability.

Definition at line 121 of file Result.cxx.

References lcvn::flavour, fOutput, lcvn::kFlavNueCC, lcvn::kTFNueDIS, lcvn::kTFNueOther, lcvn::kTFNueQE, and lcvn::kTFNueRes.

122  {
123  // single-output
124  if (fOutput.size() == 1)
127  // multi-output
129  }
Nue CC Resonant interaction.
Nue CC DIS interaction.
Nue CC QE interaction.
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
Nue CC, other than above.
float lcvn::Result::GetNumuProbability ( ) const

Return the numu flavour probability.

Definition at line 110 of file Result.cxx.

References lcvn::flavour, fOutput, lcvn::kFlavNumuCC, lcvn::kTFNumuDIS, lcvn::kTFNumuOther, lcvn::kTFNumuQE, and lcvn::kTFNumuRes.

111  {
112  // single-output
113  if (fOutput.size() == 1)
116  // multi-output
118  }
Numu CC Resonant interaction.
Numu CC, other than above.
Numu CC QE interaction.
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
Numu CC DIS interaction.
float lcvn::Result::GetNutauProbability ( ) const

Return the nutau flavour probability.

Definition at line 132 of file Result.cxx.

References lcvn::flavour, fOutput, lcvn::kFlavNutauCC, lcvn::kTFNutauDIS, lcvn::kTFNutauOther, lcvn::kTFNutauQE, and lcvn::kTFNutauRes.

133  {
134  // single-output
135  if (fOutput.size() == 1)
138  // multi-output
140  }
Nutau CC QE interaction.
Nutau CC Resonant interaction.
Nutau CC DIS interaction.
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
Nutau CC, other than above.
float lcvn::Result::GetOtherProbability ( ) const

Return the CC Other interaction probability.

Definition at line 193 of file Result.cxx.

References fOutput, lcvn::interaction, and lcvn::kInteOtherCC.

194  {
195  // single-output
196  if (fOutput.size() == 1) return -1; // There is no interaction probability
197  // multi-output
199  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetQEProbability ( ) const

Return the CC QE interaction probability.

Definition at line 166 of file Result.cxx.

References fOutput, lcvn::interaction, and lcvn::kInteQECC.

167  {
168  // single-output
169  if (fOutput.size() == 1) return -1; // There is no interaction probability
170  // multi-output
172  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::GetResProbability ( ) const

Return the CC Res interaction probability.

Definition at line 175 of file Result.cxx.

References fOutput, lcvn::interaction, and lcvn::kInteResCC.

176  {
177  // single-output
178  if (fOutput.size() == 1) return -1; // There is no interaction probability
179  // multi-output
181  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:130
float lcvn::Result::Max ( )

Maximum value in vector.

unsigned int lcvn::Result::NOutput ( )

Number of outputs, i.e. size of vector.

TFFlavour lcvn::Result::PredictedFlavour ( ) const

Return the predicted flavour.

Definition at line 65 of file Result.cxx.

References ArgMax(), and lcvn::flavour.

66  {
67  return static_cast<TFFlavour>(this->ArgMax(TFMultioutputs::flavour));
68  }
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34
TFInteraction lcvn::Result::PredictedInteraction ( ) const

Return the predicted interaction.

Definition at line 71 of file Result.cxx.

References ArgMax(), and lcvn::interaction.

72  {
73  return static_cast<TFInteraction>(this->ArgMax(TFMultioutputs::interaction));
74  }
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34
TFIsAntineutrino lcvn::Result::PredictedIsAntineutrino ( ) const

Return the predicted is_antineutrino.

Return the predicted is_antineutrion.

Definition at line 59 of file Result.cxx.

References GetIsAntineutrinoProbability().

60  {
61  return static_cast<TFIsAntineutrino>((int)round(this->GetIsAntineutrinoProbability()));
62  }
float GetIsAntineutrinoProbability() const
Return the is_antineutrino probability.
Definition: Result.cxx:101
TFIsAntineutrino
TFTopologyNeutrons lcvn::Result::PredictedNeutrons ( ) const

Return the predicted neutrons.

Definition at line 95 of file Result.cxx.

References ArgMax(), and lcvn::neutrons.

96  {
97  return static_cast<TFTopologyNeutrons>(this->ArgMax(TFMultioutputs::neutrons));
98  }
TFTopologyNeutrons
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34
TFTopologyPions lcvn::Result::PredictedPions ( ) const

Return the predicted pions.

Definition at line 83 of file Result.cxx.

References ArgMax(), and lcvn::pions.

84  {
85  return static_cast<TFTopologyPions>(this->ArgMax(TFMultioutputs::pions));
86  }
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34
TFTopologyPizeros lcvn::Result::PredictedPizeros ( ) const

Return the predicted pizeros.

Definition at line 89 of file Result.cxx.

References ArgMax(), and lcvn::pizeros.

90  {
91  return static_cast<TFTopologyPizeros>(this->ArgMax(TFMultioutputs::pizeros));
92  }
TFTopologyPizeros
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34
TFTopologyProtons lcvn::Result::PredictedProtons ( ) const

Return the predicted protons.

Definition at line 77 of file Result.cxx.

References ArgMax(), and lcvn::protons.

78  {
79  return static_cast<TFTopologyProtons>(this->ArgMax(TFMultioutputs::protons));
80  }
TFTopologyProtons
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:34

Member Data Documentation


The documentation for this class was generated from the following files: