Classes | Functions
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.

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()
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
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.

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

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

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