LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 > >::value > DumpPCAxis (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 76 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().

77 {
78 
79  if (!pca.getSvdOK()) {
80  nl() << "<not valid>";
81  return;
82  }
83 
84  nl() << std::setiosflags(std::ios::fixed) << std::setprecision(2)
85  << " ID " << pca.getID()
86  << " run on " << pca.getNumHitsUsed() << " space points";
87  nl()
88  << " - center position: " << std::setw(6) << pca.getAvePosition()[0]
89  << ", " << pca.getAvePosition()[1]
90  << ", " << pca.getAvePosition()[2];
91  nl()
92  << " - eigen values: " << std::setw(8) << std::right
93  << pca.getEigenValues()[0] << ", "
94  << pca.getEigenValues()[1] << ", " << pca.getEigenValues()[2];
95  nl()
96  << " - average doca: " << pca.getAveHitDoca();
97  nl()
98  << " - principle axis: "
99  << std::setw(7) << std::setprecision(4) << pca.getEigenVectors()[0][0]
100  << ", " << pca.getEigenVectors()[0][1]
101  << ", " << pca.getEigenVectors()[0][2];
102  nl()
103  << " - second axis: "
104  << std::setw(7) << std::setprecision(4) << pca.getEigenVectors()[1][0]
105  << ", " << pca.getEigenVectors()[1][1]
106  << ", " << pca.getEigenVectors()[1][2];
107  nl()
108  << " - third axis: "
109  << std::setw(7) << std::setprecision(4) << pca.getEigenVectors()[2][0]
110  << ", " << pca.getEigenVectors()[2][1]
111  << ", " << pca.getEigenVectors()[2][2];
112 
113 } // 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:112
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 51 of file PCAxisDumpers.h.

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

55  {
56  DumpPCAxis(
57  std::forward<Stream>(out), pca, makeNewLine(out, indent, !indentFirst)
58  );
59  }
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:146
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:51
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 84 of file SpacePointDumpers.h.

References fhicl::detail::nl().

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

93 {
94  double const* pos = sp.XYZ();
95  double const* err = sp.ErrXYZ();
96 
97  NewLineRef nl(out, options.indent);
98  lar::OptionalHexFloat hexfloat(options.hexFloats);
99 
100  nl()
101  << "ID=" << sp.ID() << " at (" << hexfloat(pos[0])
102  << ", " << hexfloat(pos[1]) << ", " << hexfloat(pos[2])
103  << ") cm, chi^2/NDF=" << hexfloat(sp.Chisq());
104 
105  nl()
106  << "variances { x^2=" << hexfloat(err[0]) << " y^2=" << hexfloat(err[2])
107  << " z^2=" << hexfloat(err[5])
108  << " xy=" << hexfloat(err[1]) << " xz=" << hexfloat(err[3])
109  << " yz=" << hexfloat(err[4]) << " }";
110 
111 } // recob::dumper::DumpSpacePoint()
Helper for formatting floats in base 16.
Definition: hexfloat.h:105
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 146 of file NewLine.h.

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

Referenced by DumpPCAxis().

147  { return NewLine<Stream>(stream, indent, followLine); }
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 152 of file NewLine.h.

153  { return NewLine<Stream>(stream, options); }