LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
DecoderToolBase Class Referenceabstract

#include "DecoderToolBase.h"

Inheritance diagram for DecoderToolBase:
FilterDecoder SemanticDecoder VertexDecoder

Public Member Functions

virtual ~DecoderToolBase () noexcept=default
 Virtual Destructor. More...
 
 DecoderToolBase (fhicl::ParameterSet const &p)
 Construcutor. More...
 
virtual void declareProducts (art::ProducesCollector &)=0
 declareProducts function More...
 
virtual void writeEmptyToEvent (art::Event &e, const vector< vector< size_t >> &idsmap)=0
 writeEmptyToEvent function More...
 
virtual void writeToEvent (art::Event &e, const vector< vector< size_t >> &idsmap, const vector< NuGraphOutput > &infer_output)=0
 writeToEvent function More...
 
void printVector (const std::vector< float > &vec)
 
template<typename T , size_t N>
void softmax (std::array< T, N > &arr)
 
void setDebugAndPlanes (bool d, vector< std::string > &p)
 

Protected Attributes

bool debug
 
vector< std::string > planes
 
std::string instancename
 
std::string outputname
 

Detailed Description

Definition at line 25 of file DecoderToolBase.h.

Constructor & Destructor Documentation

virtual DecoderToolBase::~DecoderToolBase ( )
virtualdefaultnoexcept

Virtual Destructor.

DecoderToolBase::DecoderToolBase ( fhicl::ParameterSet const &  p)
inline

Construcutor.

Parameters
ParameterSetThe input set of parameters for configuration

Definition at line 38 of file DecoderToolBase.h.

References e, fhicl::ParameterSet::get(), and lar::dump::vector().

39  : instancename{p.get<std::string>("instanceName", "filter")}
40  , outputname{p.get<std::string>("outputName", "x_filter_")}
41  {}
std::string outputname
std::string instancename

Member Function Documentation

virtual void DecoderToolBase::declareProducts ( art::ProducesCollector )
pure virtual

declareProducts function

Parameters
art::ProducesCollector

Implemented in SemanticDecoder, FilterDecoder, and VertexDecoder.

void DecoderToolBase::printVector ( const std::vector< float > &  vec)
inline

Definition at line 69 of file DecoderToolBase.h.

Referenced by FilterDecoder::writeToEvent(), and SemanticDecoder::writeToEvent().

70  {
71  for (size_t i = 0; i < vec.size(); ++i) {
72  std::cout << vec[i];
73  // Print space unless it's the last element
74  if (i != vec.size() - 1) { std::cout << " "; }
75  }
76  std::cout << std::endl;
77  std::cout << std::endl;
78  }
void DecoderToolBase::setDebugAndPlanes ( bool  d,
vector< std::string > &  p 
)
inline

Definition at line 98 of file DecoderToolBase.h.

References d, and tca::debug.

99  {
100  debug = d;
101  planes = p;
102  }
vector< std::string > planes
Float_t d
Definition: plot.C:235
template<typename T , size_t N>
void DecoderToolBase::softmax ( std::array< T, N > &  arr)
inline

Definition at line 81 of file DecoderToolBase.h.

References sum.

Referenced by SemanticDecoder::writeToEvent().

82  {
83  T m = -std::numeric_limits<T>::max();
84  for (size_t i = 0; i < arr.size(); i++) {
85  if (arr[i] > m) { m = arr[i]; }
86  }
87  T sum = 0.0;
88  for (size_t i = 0; i < arr.size(); i++) {
89  sum += expf(arr[i] - m);
90  }
91  T offset = m + logf(sum);
92  for (size_t i = 0; i < arr.size(); i++) {
93  arr[i] = expf(arr[i] - offset);
94  }
95  return;
96  }
Double_t sum
Definition: plot.C:31
virtual void DecoderToolBase::writeEmptyToEvent ( art::Event e,
const vector< vector< size_t >> &  idsmap 
)
pure virtual

writeEmptyToEvent function

Parameters
art::Eventevent record

Implemented in SemanticDecoder, FilterDecoder, and VertexDecoder.

virtual void DecoderToolBase::writeToEvent ( art::Event e,
const vector< vector< size_t >> &  idsmap,
const vector< NuGraphOutput > &  infer_output 
)
pure virtual

writeToEvent function

Parameters
art::Eventevent record
idsmap
infer_output

Implemented in SemanticDecoder, FilterDecoder, and VertexDecoder.

Member Data Documentation

bool DecoderToolBase::debug
protected
std::string DecoderToolBase::outputname
protected
vector<std::string> DecoderToolBase::planes
protected

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