LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
recob::dumper Namespace Reference

Classes

struct  IndentOptions_t
 Structure collecting indentation options. More...
 
class  NewLine
 Starts a new line in a output stream. More...
 
struct  SpacePointPrintOptions_t
 Collection of available printing style options. More...
 

Functions

template<typename Stream >
NewLine< Stream > makeNewLine (Stream &stream, std::string indent, bool followLine=false)
 Convenience function to create a temporary NewLine. More...
 
template<typename Stream >
NewLine< Stream > makeNewLine (Stream &stream, IndentOptions_t const &options)
 Convenience function to create a temporary NewLine. More...
 
template<typename Stream , typename NewLineRef >
std::enable_if_t< std::is_same< recob::dumper::NewLine< std::decay_t< Stream > >, std::decay_t< NewLineRef > >::valueDumpPCAxis (Stream &&out, recob::PCAxis const &pca, NewLineRef &&nl)
 
template<typename Stream >
void DumpPCAxis (Stream &&out, recob::PCAxis const &pca, std::string indent="", bool indentFirst=true)
 Dumps the content of the specified PCA axis into a stream. More...
 
template<typename Stream , typename NewLineRef = recob::dumper::NewLine<Stream>>
auto DumpSpacePoint (Stream &&out, recob::SpacePoint const &sp, SpacePointPrintOptions_t const &options={}) -> std::enable_if_t< std::is_same< NewLine< std::decay_t< Stream >>, std::decay_t< NewLineRef >>::value >
 Dumps the content of the specified space point into a stream. More...
 

Function Documentation

template<typename Stream , typename NewLineRef >
std::enable_if_t< std::is_same< recob::dumper::NewLine< std::decay_t< Stream > >, std::decay_t< NewLineRef > >::value > recob::dumper::DumpPCAxis ( Stream &&  out,
recob::PCAxis const &  pca,
NewLineRef &&  nl 
)

Dumps the content of the specified PCA axis (indentation info in nl)

Template Parameters
Streamthe type of the output stream
NewLineRefNewLine reference type (to get a universal reference)

Definition at line 68 of file PCAxisDumpers.h.

References recob::PCAxis::getAveHitDoca(), recob::PCAxis::getAvePosition(), recob::PCAxis::getEigenValues(), recob::PCAxis::getEigenVectors(), recob::PCAxis::getID(), recob::PCAxis::getNumHitsUsed(), recob::PCAxis::getSvdOK(), fhicl::detail::nl(), and art::right().

Referenced by DumpPCAxis().

69 {
70 
71  if (!pca.getSvdOK()) {
72  nl() << "<not valid>";
73  return;
74  }
75 
76  nl() << std::setiosflags(std::ios::fixed) << std::setprecision(2) << " ID " << pca.getID()
77  << " run on " << pca.getNumHitsUsed() << " space points";
78  nl() << " - center position: " << std::setw(6) << pca.getAvePosition()[0] << ", "
79  << pca.getAvePosition()[1] << ", " << pca.getAvePosition()[2];
80  nl() << " - eigen values: " << std::setw(8) << std::right << pca.getEigenValues()[0] << ", "
81  << pca.getEigenValues()[1] << ", " << pca.getEigenValues()[2];
82  nl() << " - average doca: " << pca.getAveHitDoca();
83  nl() << " - principle axis: " << std::setw(7) << std::setprecision(4)
84  << pca.getEigenVectors()[0][0] << ", " << pca.getEigenVectors()[0][1] << ", "
85  << pca.getEigenVectors()[0][2];
86  nl() << " - second axis: " << std::setw(7) << std::setprecision(4) << pca.getEigenVectors()[1][0]
87  << ", " << pca.getEigenVectors()[1][1] << ", " << pca.getEigenVectors()[1][2];
88  nl() << " - third axis: " << std::setw(7) << std::setprecision(4) << pca.getEigenVectors()[2][0]
89  << ", " << pca.getEigenVectors()[2][1] << ", " << pca.getEigenVectors()[2][2];
90 
91 } // recob::dumper::DumpPCAxis()
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
std::string nl(std::size_t i=1)
template<typename Stream >
void recob::dumper::DumpPCAxis ( Stream &&  out,
recob::PCAxis const &  pca,
std::string  indent = "",
bool  indentFirst = true 
)

Dumps the content of the specified PCA axis into a stream.


Template Parameters
Streamthe type of output stream
Parameters
outthe output stream
pcathe principal component axis to be dumped
indentindentation string (none by default)
indentFirstwhether to indent the first line (yes by default)

Insertion operators are required that insert into Stream basic types.

This function does not insert a end-of-line after its output.

Definition at line 48 of file PCAxisDumpers.h.

References DumpPCAxis(), art::detail::indent(), makeNewLine(), and value.

52  {
53  DumpPCAxis(std::forward<Stream>(out), pca, makeNewLine(out, indent, !indentFirst));
54  }
std::string indent(std::size_t const i)
NewLine< Stream > makeNewLine(Stream &stream, std::string indent, bool followLine=false)
Convenience function to create a temporary NewLine.
Definition: NewLine.h:148
void DumpPCAxis(Stream &&out, recob::PCAxis const &pca, std::string indent="", bool indentFirst=true)
Dumps the content of the specified PCA axis into a stream.
Definition: PCAxisDumpers.h:48
template<typename Stream , typename NewLineRef = recob::dumper::NewLine<Stream>>
auto recob::dumper::DumpSpacePoint ( Stream &&  out,
recob::SpacePoint const &  sp,
SpacePointPrintOptions_t const &  options = {} 
) -> std::enable_if_t< std::is_same<NewLine<std::decay_t<Stream>>, std::decay_t<NewLineRef>>::value>

Dumps the content of the specified space point into a stream.

Template Parameters
Streamthe type of the output stream
NewLineRefNewLine reference type (to get a universal reference)
Parameters
outthe output stream
spthe space point to be dumped
optionsindentation and formatting options

Definition at line 75 of file SpacePointDumpers.h.

References fhicl::detail::nl().

Referenced by recob::dumper::SpacePointPrintOptions_t::SpacePointPrintOptions_t().

80 {
81  double const* pos = sp.XYZ();
82  double const* err = sp.ErrXYZ();
83 
84  NewLineRef nl(out, options.indent);
85  lar::OptionalHexFloat hexfloat(options.hexFloats);
86 
87  nl() << "ID=" << sp.ID() << " at (" << hexfloat(pos[0]) << ", " << hexfloat(pos[1]) << ", "
88  << hexfloat(pos[2]) << ") cm, chi^2/NDF=" << hexfloat(sp.Chisq());
89 
90  nl() << "variances { x^2=" << hexfloat(err[0]) << " y^2=" << hexfloat(err[2])
91  << " z^2=" << hexfloat(err[5]) << " xy=" << hexfloat(err[1]) << " xz=" << hexfloat(err[3])
92  << " yz=" << hexfloat(err[4]) << " }";
93 
94 } // recob::dumper::DumpSpacePoint()
Helper for formatting floats in base 16.
Definition: hexfloat.h:109
std::string nl(std::size_t i=1)
template<typename Stream >
NewLine<Stream> recob::dumper::makeNewLine ( Stream &  stream,
std::string  indent,
bool  followLine = false 
)
inline

Convenience function to create a temporary NewLine.

Definition at line 148 of file NewLine.h.

References recob::dumper::IndentOptions_t::indent.

Referenced by DumpPCAxis().

149  {
150  return NewLine<Stream>(stream, indent, followLine);
151  }
std::string indent(std::size_t const i)
template<typename Stream >
NewLine<Stream> recob::dumper::makeNewLine ( Stream &  stream,
IndentOptions_t const &  options 
)
inline

Convenience function to create a temporary NewLine.

Definition at line 155 of file NewLine.h.

156  {
157  return NewLine<Stream>(stream, options);
158  }