LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 157 of file MVAOutput.h.

Constructor & Destructor Documentation

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

Definition at line 159 of file MVAOutput.h.

159 {}
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 170 of file MVAOutput.h.

174  {
175  setOutputNames(outputNames);
176  }
const std::string & dataTag() const
Definition: MVAOutput.h:201
void setOutputNames(std::vector< std::string > const &outputNames)
Definition: MVAOutput.h:218
std::string fOutputInstance
Instance name of the feature vector collection.
Definition: MVAOutput.h:166
const std::string & outputInstance() const
Definition: MVAOutput.h:197
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:165
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 178 of file MVAOutput.h.

180  : fDataTag("")
181  , // initialize with empty data tag, so it should be assigned later
183  {
184  setOutputNames(outputNames);
185  }
void setOutputNames(std::vector< std::string > const &outputNames)
Definition: MVAOutput.h:218
std::string fOutputInstance
Instance name of the feature vector collection.
Definition: MVAOutput.h:166
const std::string & outputInstance() const
Definition: MVAOutput.h:197
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:165

Member Function Documentation

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

Definition at line 162 of file MVAOutput.h.

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

Definition at line 201 of file MVAOutput.h.

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

Definition at line 231 of file MVAOutput.h.

232  {
233  for (size_t i = 0; i < N; ++i) {
234  if (fOutputNames[i] == name) { return i; }
235  }
236  return -1; // not found
237  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:167
template<size_t N>
const std::string& anab::MVADescription< N >::outputInstance ( ) const
inline

Definition at line 197 of file MVAOutput.h.

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

Definition at line 211 of file MVAOutput.h.

212  {
213  if (index < N) { return fOutputNames[index]; }
214  else {
215  throw cet::exception("MVADescription") << "Index out of range: " << index << std::endl;
216  }
217  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:167
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 202 of file MVAOutput.h.

203  {
204  if (fDataTag.empty()) { fDataTag = tag; }
205  else {
206  throw cet::exception("MVADescription")
207  << "Data tag already assigned: " << fDataTag << std::endl;
208  }
209  }
std::string fDataTag
Tag of the reco data products (art::InputTag format)
Definition: MVAOutput.h:165
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 218 of file MVAOutput.h.

219  {
220  if (outputNames.size() <= N) {
221  for (size_t i = 0; i < outputNames.size(); ++i) {
222  fOutputNames[i] = outputNames[i];
223  }
224  }
225  else {
226  throw cet::exception("FeatureVector") << "Expected max length of outputNames: " << N
227  << ", provided: " << outputNames.size() << std::endl;
228  }
229  }
std::string fOutputNames[N]
Feature vector entries names/meaning.
Definition: MVAOutput.h:167
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 199 of file MVAOutput.h.

Referenced by NuGraphAnalyzer::analyze().

199 { 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 187 of file MVAOutput.h.

188  {
189  o << "MVADescription: prepared for " << a.fDataTag << ", instance name " << a.fOutputInstance
190  << ", " << N << " outputs:" << std::endl;
191  for (size_t i = 0; i < N; ++i) {
192  o << " " << a.fOutputNames[i] << std::endl;
193  }
194  return o;
195  }

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 165 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 166 of file MVAOutput.h.

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

Feature vector entries names/meaning.

Definition at line 167 of file MVAOutput.h.


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