Public Member Functions | Public Attributes | List of all members
cvn::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 18 of file Result.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file Result.cxx.

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

Definition at line 30 of file Result.cxx.

30  {
31  fOutput = output;
32  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
cvn::Result::Result ( )

Definition at line 34 of file Result.cxx.

34  :
35  fOutput()
36  {}
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132

Member Function Documentation

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

Index of maximum value in vector.

Definition at line 38 of file Result.cxx.

39  {
40  // Get the max element iterator and convert to vector index
41 
42  // single-output
43  if(fOutput.size() == 1)
44  return std::distance(fOutput[0].begin(),std::max_element(fOutput[0].begin(),fOutput[0].end()));
45  // multi-output
46  return std::distance(fOutput[output_n].begin(),std::max_element(fOutput[output_n].begin(),fOutput[output_n].end()));
47  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
float cvn::Result::Get0neutronsProbability ( ) const

Return the 0 neutrons topology probability.

Definition at line 322 of file Result.cxx.

323  {
324  // single-output
325  if(fOutput.size() == 1)
326  return -1; // There is no neutrons probability
327  // multi-output
329  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get0pionsProbability ( ) const

Return the 0 pions topology probability.

Definition at line 242 of file Result.cxx.

243  {
244  // single-output
245  if(fOutput.size() == 1)
246  return -1; // There is no pions probability
247  // multi-output
249  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get0pizerosProbability ( ) const

Return the 0 pizeros topology probability.

Definition at line 282 of file Result.cxx.

283  {
284  // single-output
285  if(fOutput.size() == 1)
286  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:132
float cvn::Result::Get0protonsProbability ( ) const

Return the 0 protons topology probability.

Definition at line 202 of file Result.cxx.

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

Return the 1 neutrons topology probability.

Definition at line 332 of file Result.cxx.

333  {
334  // single-output
335  if(fOutput.size() == 1)
336  return -1; // There is no neutrons probability
337  // multi-output
339  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get1pionsProbability ( ) const

Return the 1 pions topology probability.

Definition at line 252 of file Result.cxx.

253  {
254  // single-output
255  if(fOutput.size() == 1)
256  return -1; // There is no pions probability
257  // multi-output
259  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get1pizerosProbability ( ) const

Return the 1 pizeros topology probability.

Definition at line 292 of file Result.cxx.

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

Return the 1 protons topology probability.

Definition at line 212 of file Result.cxx.

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

Return the 2 neutrons topology probability.

Definition at line 342 of file Result.cxx.

343  {
344  // single-output
345  if(fOutput.size() == 1)
346  return -1; // There is no neutrons probability
347  // multi-output
349  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get2pionsProbability ( ) const

Return the 2 pions topology probability.

Definition at line 262 of file Result.cxx.

263  {
264  // single-output
265  if(fOutput.size() == 1)
266  return -1; // There is no pions probability
267  // multi-output
269  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::Get2pizerosProbability ( ) const

Return the 2 pizeros topology probability.

Definition at line 302 of file Result.cxx.

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

Return the 2 protons topology probability.

Definition at line 222 of file Result.cxx.

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

Return the CC DIS interaction probability.

Definition at line 182 of file Result.cxx.

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

Return the is_antineutrino probability.

Definition at line 97 of file Result.cxx.

98  {
99  // single-output
100  if(fOutput.size() == 1)
101  return -1; // There is no is_antineutrino output
102  // multi-output
104  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetNCProbability ( ) const

Return the NC probability.

Definition at line 140 of file Result.cxx.

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

Return the >2 neutrons topology probability.

Definition at line 352 of file Result.cxx.

353  {
354  // single-output
355  if(fOutput.size() == 1)
356  return -1; // There is no neutrons probability
357  // multi-output
359  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetNpionsProbability ( ) const

Return the >2 pions topology probability.

Definition at line 272 of file Result.cxx.

273  {
274  // single-output
275  if(fOutput.size() == 1)
276  return -1; // There is no pions probability
277  // multi-output
279  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetNpizerosProbability ( ) const

Return the >2 pizeros topology probability.

Definition at line 312 of file Result.cxx.

313  {
314  // single-output
315  if(fOutput.size() == 1)
316  return -1; // There is no pizeros probability
317  // multi-output
319  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetNprotonsProbability ( ) const

Return the >2 protons topology probability.

Definition at line 232 of file Result.cxx.

233  {
234  // single-output
235  if(fOutput.size() == 1)
236  return -1; // There is no protons probability
237  // multi-output
239  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetNueProbability ( ) const

Return the nue flavour probability.

Definition at line 118 of file Result.cxx.

119  {
120  // single-output
121  if(fOutput.size() == 1)
124  // multi-output
126  }
Nue CC, other than above.
Nue CC DIS interaction.
Nue CC QE interaction.
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
Nue CC Resonant interaction.
float cvn::Result::GetNumuProbability ( ) const

Return the numu flavour probability.

Definition at line 107 of file Result.cxx.

108  {
109  // single-output
110  if(fOutput.size() == 1)
113  // multi-output
115  }
Numu CC QE interaction.
Numu CC Resonant interaction.
Numu CC, other than above.
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
Numu CC DIS interaction.
float cvn::Result::GetNutauProbability ( ) const

Return the nutau flavour probability.

Definition at line 129 of file Result.cxx.

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

Return the CC Other interaction probability.

Definition at line 192 of file Result.cxx.

193  {
194  // single-output
195  if(fOutput.size() == 1)
196  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:132
float cvn::Result::GetQEProbability ( ) const

Return the CC QE interaction probability.

Definition at line 162 of file Result.cxx.

163  {
164  // single-output
165  if(fOutput.size() == 1)
166  return -1; // There is no interaction probability
167  // multi-output
169  }
std::vector< std::vector< float > > fOutput
Vector of outputs from neural net.
Definition: Result.h:132
float cvn::Result::GetResProbability ( ) const

Return the CC Res interaction probability.

Definition at line 172 of file Result.cxx.

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

Maximum value in vector.

unsigned int cvn::Result::NOutput ( )

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

TFFlavour cvn::Result::PredictedFlavour ( ) const

Return the predicted flavour.

Definition at line 66 of file Result.cxx.

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

Return the predicted interaction.

Definition at line 72 of file Result.cxx.

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:38
TFIsAntineutrino cvn::Result::PredictedIsAntineutrino ( ) const

Return the predicted is_antineutrino.

Return the predicted is_antineutrion.

Definition at line 61 of file Result.cxx.

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

Return the predicted neutrons.

Definition at line 92 of file Result.cxx.

92  {
93  return static_cast<TFTopologyNeutrons>(this->ArgMax(TFMultioutputs::neutrons));
94  }
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:38
TFTopologyNeutrons
TFTopologyPions cvn::Result::PredictedPions ( ) const

Return the predicted pions.

Definition at line 82 of file Result.cxx.

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

Return the predicted pizeros.

Definition at line 87 of file Result.cxx.

87  {
88  return static_cast<TFTopologyPizeros>(this->ArgMax(TFMultioutputs::pizeros));
89  }
unsigned int ArgMax(int output_n) const
Index of maximum value in vector.
Definition: Result.cxx:38
TFTopologyPizeros
TFTopologyProtons cvn::Result::PredictedProtons ( ) const

Return the predicted protons.

Definition at line 77 of file Result.cxx.

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

Member Data Documentation

std::vector< std::vector<float> > cvn::Result::fOutput

Vector of outputs from neural net.

Definition at line 132 of file Result.h.


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