LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
anab::FeatureVector< N > Class Template Reference

#include "MVAOutput.h"

Public Member Functions

 FeatureVector ()
 
 FeatureVector (float init)
 
 FeatureVector (std::array< float, N > const &values)
 
 FeatureVector (std::array< double, N > const &values)
 
 FeatureVector (std::vector< float > const &values)
 
 FeatureVector (std::vector< double > const &values)
 
 FeatureVector (float const *values)
 If you really have to use C arrays: More...
 
 FeatureVector (double const *values)
 
FeatureVectoroperator= (float init)
 Assignment operators, from the same types as constructors. More...
 
FeatureVectoroperator= (std::array< float, N > const &values)
 
FeatureVectoroperator= (std::array< double, N > const &values)
 
FeatureVectoroperator= (std::vector< float > const &values)
 
FeatureVectoroperator= (std::vector< double > const &values)
 
size_t size () const
 
float at (size_t index) const
 
float operator[] (size_t index) const
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void set (float init)
 
void set (std::array< float, N > const &values)
 
void set (std::array< double, N > const &values)
 
void set (std::vector< float > const &values)
 
void set (std::vector< double > const &values)
 

Private Attributes

float fData [N]
 Vector values. More...
 

Friends

std::ostream & operator<< (std::ostream &o, FeatureVector const &a)
 

Detailed Description

template<size_t N>
class anab::FeatureVector< N >

Feature vector of size N. Values are saved as 32bit fp's, this is usually enough for the classification purposes and the precision one can expect from MVA algorithms.

Definition at line 25 of file MVAOutput.h.

Constructor & Destructor Documentation

template<size_t N>
anab::FeatureVector< N >::FeatureVector ( )
inline

Definition at line 28 of file MVAOutput.h.

28 { }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( float  init)
inline

Definition at line 38 of file MVAOutput.h.

38 { set(init); }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::array< float, N > const &  values)
inline

Definition at line 39 of file MVAOutput.h.

39 { set(values); }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::array< double, N > const &  values)
inline

Definition at line 40 of file MVAOutput.h.

40 { set(values); }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::vector< float > const &  values)
inline

Definition at line 41 of file MVAOutput.h.

41 { set(values); }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::vector< double > const &  values)
inline

Definition at line 42 of file MVAOutput.h.

42 { set(values); }
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( float const *  values)
inline

If you really have to use C arrays:

Definition at line 45 of file MVAOutput.h.

45 { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( double const *  values)
inline

Definition at line 46 of file MVAOutput.h.

46 { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:34

Member Function Documentation

template<size_t N>
float anab::FeatureVector< N >::at ( size_t  index) const
inline

Definition at line 65 of file MVAOutput.h.

66  {
67  if (index < N) { return fData[index]; }
68  else { throw cet::exception("FeatureVector") << "Index out of range: " << index << std::endl; }
69  }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
static short anab::FeatureVector< N >::Class_Version ( )
inlinestatic

Definition at line 31 of file MVAOutput.h.

31 { return 10; }
template<size_t N>
FeatureVector& anab::FeatureVector< N >::operator= ( float  init)
inline

Assignment operators, from the same types as constructors.

Definition at line 49 of file MVAOutput.h.

49 { set(init); return *this; }
template<size_t N>
FeatureVector& anab::FeatureVector< N >::operator= ( std::array< float, N > const &  values)
inline

Definition at line 50 of file MVAOutput.h.

50 { set(values); return *this; }
template<size_t N>
FeatureVector& anab::FeatureVector< N >::operator= ( std::array< double, N > const &  values)
inline

Definition at line 51 of file MVAOutput.h.

51 { set(values); return *this; }
template<size_t N>
FeatureVector& anab::FeatureVector< N >::operator= ( std::vector< float > const &  values)
inline

Definition at line 52 of file MVAOutput.h.

52 { set(values); return *this; }
template<size_t N>
FeatureVector& anab::FeatureVector< N >::operator= ( std::vector< double > const &  values)
inline

Definition at line 53 of file MVAOutput.h.

53 { set(values); return *this; }
template<size_t N>
float anab::FeatureVector< N >::operator[] ( size_t  index) const
inline

Definition at line 71 of file MVAOutput.h.

71 { return fData[index]; }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
template<size_t N>
void anab::FeatureVector< N >::set ( float  init)
inlineprivate

Access the contained array. *** WOULD LIKE TO CHANGE TYPE OF DATA MEMBER TO std::array AND THEN ENABLE THIS FUNCTION ***

Definition at line 79 of file MVAOutput.h.

79 { for (size_t i = 0; i < N; ++i) { fData[i] = init; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
template<size_t N>
void anab::FeatureVector< N >::set ( std::array< float, N > const &  values)
inlineprivate

Definition at line 80 of file MVAOutput.h.

80 { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
template<size_t N>
void anab::FeatureVector< N >::set ( std::array< double, N > const &  values)
inlineprivate

Definition at line 81 of file MVAOutput.h.

81 { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
template<size_t N>
void anab::FeatureVector< N >::set ( std::vector< float > const &  values)
inlineprivate

Definition at line 82 of file MVAOutput.h.

83  {
84  if (values.size() == N) { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
85  else { throw cet::exception("FeatureVector") << "Expected length: " << N << ", provided: " << values.size() << std::endl; }
86  }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
void anab::FeatureVector< N >::set ( std::vector< double > const &  values)
inlineprivate

Definition at line 87 of file MVAOutput.h.

88  {
89  if (values.size() == N) { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
90  else { throw cet::exception("FeatureVector") << "Expected length: " << N << ", provided: " << values.size() << std::endl; }
91  }
float fData[N]
Vector values.
Definition: MVAOutput.h:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
size_t anab::FeatureVector< N >::size ( ) const
inline

Definition at line 63 of file MVAOutput.h.

63 { return N; }

Friends And Related Function Documentation

template<size_t N>
std::ostream& operator<< ( std::ostream &  o,
FeatureVector< N > const &  a 
)
friend

Definition at line 55 of file MVAOutput.h.

56  {
57  o << "FeatureVector values:";
58  for (size_t i = 0; i < N; ++i) { o << " " << a.fData[i]; }
59  o << std::endl;
60  return o;
61  }

Member Data Documentation

template<size_t N>
float anab::FeatureVector< N >::fData[N]
private

Vector values.

Definition at line 34 of file MVAOutput.h.


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