LArSoft  v10_06_00
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 21 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 34 of file DecoderToolBase.h.

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

35  : instancename{p.get<std::string>("instanceName", "filter")}
36  , outputname{p.get<std::string>("outputName", "x_filter_")}
37  {}
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 65 of file DecoderToolBase.h.

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

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

Definition at line 94 of file DecoderToolBase.h.

References d, and tca::debug.

95  {
96  debug = d;
97  planes = p;
98  }
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 77 of file DecoderToolBase.h.

References sum.

Referenced by SemanticDecoder::writeToEvent().

78  {
79  T m = -std::numeric_limits<T>::max();
80  for (size_t i = 0; i < arr.size(); i++) {
81  if (arr[i] > m) { m = arr[i]; }
82  }
83  T sum = 0.0;
84  for (size_t i = 0; i < arr.size(); i++) {
85  sum += expf(arr[i] - m);
86  }
87  T offset = m + logf(sum);
88  for (size_t i = 0; i < arr.size(); i++) {
89  arr[i] = expf(arr[i] - offset);
90  }
91  return;
92  }
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: