Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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 24 of file MVAOutput.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file MVAOutput.h.

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

Definition at line 37 of file MVAOutput.h.

37 { set(init); }
init
Definition: train.py:42
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::array< float, N > const &  values)
inline

Definition at line 38 of file MVAOutput.h.

38 { set(values); }
Q_UINT16 values[128]
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::array< double, N > const &  values)
inline

Definition at line 39 of file MVAOutput.h.

39 { set(values); }
Q_UINT16 values[128]
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::vector< float > const &  values)
inline

Definition at line 40 of file MVAOutput.h.

40 { set(values); }
Q_UINT16 values[128]
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( std::vector< double > const &  values)
inline

Definition at line 41 of file MVAOutput.h.

41 { set(values); }
Q_UINT16 values[128]
template<size_t N>
anab::FeatureVector< N >::FeatureVector ( float const *  values)
inline

If you really have to use C arrays:

Definition at line 44 of file MVAOutput.h.

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

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:33
Q_UINT16 values[128]

Member Function Documentation

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

Definition at line 64 of file MVAOutput.h.

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

Definition at line 30 of file MVAOutput.h.

30 { 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 48 of file MVAOutput.h.

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

Definition at line 49 of file MVAOutput.h.

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

Definition at line 50 of file MVAOutput.h.

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

Definition at line 51 of file MVAOutput.h.

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

Definition at line 52 of file MVAOutput.h.

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

Definition at line 70 of file MVAOutput.h.

70 { return fData[index]; }
float fData[N]
Vector values.
Definition: MVAOutput.h:33
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 78 of file MVAOutput.h.

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

Definition at line 79 of file MVAOutput.h.

79 { for (size_t i = 0; i < N; ++i) { fData[i] = values[i]; } }
float fData[N]
Vector values.
Definition: MVAOutput.h:33
template<size_t N>
void anab::FeatureVector< N >::set ( std::array< double, 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:33
template<size_t N>
void anab::FeatureVector< N >::set ( std::vector< float > const &  values)
inlineprivate

Definition at line 81 of file MVAOutput.h.

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

Definition at line 86 of file MVAOutput.h.

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

Definition at line 62 of file MVAOutput.h.

Friends And Related Function Documentation

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

Definition at line 54 of file MVAOutput.h.

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

Member Data Documentation

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

Vector values.

Definition at line 33 of file MVAOutput.h.


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