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

#include "MVAOutput.h"

Public Member Functions

 MVADescription ()
 
 MVADescription (std::string const &dataTag, std::string const &outputInstance, std::vector< std::string > const &outputNames=std::vector< std::string >(N,""))
 
 MVADescription (std::string const &outputInstance, std::vector< std::string > const &outputNames=std::vector< std::string >(N,""))
 
const std::string & outputInstance () const
 
size_t size () const
 
const std::string & dataTag () const
 
void setDataTag (const std::string &tag)
 
const std::string & outputName (size_t index) const
 
void setOutputNames (std::vector< std::string > const &outputNames)
 
int getIndex (const std::string &name) const
 

Static Public Member Functions

static short Class_Version ()
 

Private Attributes

std::string fDataTag
 Tag of the reco data products (art::InputTag format) More...
 
std::string fOutputInstance
 Instance name of the feature vector collection. More...
 
std::string fOutputNames [N]
 Feature vector entries names/meaning. More...
 

Friends

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

Detailed Description

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

Metadata associated to feature vectors. The idea is to link entire collection of objects to the collection of vectors, and add metadata like the meaning of columns in vectors using a single object.

Definition at line 99 of file MVAOutput.h.

Constructor & Destructor Documentation

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

Definition at line 102 of file MVAOutput.h.

102 { }
template<size_t N>
anab::MVADescription< N >::MVADescription ( std::string const &  dataTag,
std::string const &  outputInstance,
std::vector< std::string > const &  outputNames = std::vector< std::string >(N, "") 
)
inline

Definition at line 114 of file MVAOutput.h.

115  :
116  fDataTag(dataTag),
118  {
119  setOutputNames(outputNames);
120  }
const std::string & dataTag() const
Definition: MVAOutput.h:141
void setOutputNames(std::vector< std::string > const &outputNames)
Definition: MVAOutput.h:153
std::string fOutputInstance
Instance name of the feature vector collection.
Definition: MVAOutput.h:109
const std::string & outputInstance() const
Definition: MVAOutput.h:137
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:108
template<size_t N>
anab::MVADescription< N >::MVADescription ( std::string const &  outputInstance,
std::vector< std::string > const &  outputNames = std::vector< std::string >(N, "") 
)
inline

Definition at line 122 of file MVAOutput.h.

123  :
124  fDataTag(""), // initialize with empty data tag, so it should be assigned later
126  {
127  setOutputNames(outputNames);
128  }
void setOutputNames(std::vector< std::string > const &outputNames)
Definition: MVAOutput.h:153
std::string fOutputInstance
Instance name of the feature vector collection.
Definition: MVAOutput.h:109
const std::string & outputInstance() const
Definition: MVAOutput.h:137
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:108

Member Function Documentation

template<size_t N>
static short anab::MVADescription< N >::Class_Version ( )
inlinestatic

Definition at line 105 of file MVAOutput.h.

105 { return 10; }
template<size_t N>
const std::string& anab::MVADescription< N >::dataTag ( ) const
inline

Definition at line 141 of file MVAOutput.h.

141 { return fDataTag; }
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:108
template<size_t N>
int anab::MVADescription< N >::getIndex ( const std::string &  name) const
inline

Definition at line 159 of file MVAOutput.h.

160  {
161  for (size_t i = 0; i < N; ++i) { if (fOutputNames[i] == name) { return i; } }
162  return -1; // not found
163  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:110
template<size_t N>
const std::string& anab::MVADescription< N >::outputInstance ( ) const
inline

Definition at line 137 of file MVAOutput.h.

137 { return fOutputInstance; }
std::string fOutputInstance
Instance name of the feature vector collection.
Definition: MVAOutput.h:109
template<size_t N>
const std::string& anab::MVADescription< N >::outputName ( size_t  index) const
inline

Definition at line 148 of file MVAOutput.h.

149  {
150  if (index < N) { return fOutputNames[index]; }
151  else { throw cet::exception("MVADescription") << "Index out of range: " << index << std::endl; }
152  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:110
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
void anab::MVADescription< N >::setDataTag ( const std::string &  tag)
inline

Definition at line 142 of file MVAOutput.h.

143  {
144  if (fDataTag.empty()) { fDataTag = tag; }
145  else { throw cet::exception("MVADescription") << "Data tag already assigned: " << fDataTag << std::endl; }
146  }
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:108
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
void anab::MVADescription< N >::setOutputNames ( std::vector< std::string > const &  outputNames)
inline

Definition at line 153 of file MVAOutput.h.

154  {
155  if (outputNames.size() <= N) { for (size_t i = 0; i < outputNames.size(); ++i) { fOutputNames[i] = outputNames[i]; } }
156  else { throw cet::exception("FeatureVector") << "Expected max length of outputNames: " << N << ", provided: " << outputNames.size() << std::endl; }
157  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:110
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<size_t N>
size_t anab::MVADescription< N >::size ( ) const
inline

Definition at line 139 of file MVAOutput.h.

139 { return N; }

Friends And Related Function Documentation

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

Definition at line 130 of file MVAOutput.h.

131  {
132  o << "MVADescription: prepared for " << a.fDataTag << ", instance name " << a.fOutputInstance << ", " << N << " outputs:" << std::endl;
133  for (size_t i = 0; i < N; ++i) { o << " " << a.fOutputNames[i] << std::endl; }
134  return o;
135  }

Member Data Documentation

template<size_t N>
std::string anab::MVADescription< N >::fDataTag
private

Tag of the reco data products (art::InputTag format)

Definition at line 108 of file MVAOutput.h.

template<size_t N>
std::string anab::MVADescription< N >::fOutputInstance
private

Instance name of the feature vector collection.

Definition at line 109 of file MVAOutput.h.

template<size_t N>
std::string anab::MVADescription< N >::fOutputNames[N]
private

Feature vector entries names/meaning.

Definition at line 110 of file MVAOutput.h.


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