14 #include "canvas/Utilities/InputTag.h"
15 #include "art/Framework/Core/EDAnalyzer.h"
16 #include "art/Framework/Principal/Event.h"
19 #include "fhiclcpp/types/Atom.h"
54 Name (
"SpacePointModuleLabel"),
55 Comment(
"label of the producer used to create the recob::SpacePoint collection to be dumped")
58 Name (
"OutputCategory"),
59 Comment(
"the category used for the output (useful for filtering) [\"DumpSpacePoints\"]"),
63 Name (
"PrintHexFloats"),
64 Comment(
"print floating point numbers in base 16 [false]"),
76 virtual void analyze (
const art::Event&
evt)
override;
98 #include "art/Framework/Core/ModuleMacros.h"
99 #include "canvas/Persistency/Common/FindMany.h"
100 #include "art/Framework/Principal/Handle.h"
103 #include "messagefacility/MessageLogger/MessageLogger.h"
111 class SpacePointDumper {
118 std::vector<recob::SpacePoint>
const& point_list,
119 PrintOptions_t
const& printOptions = {}
127 void SetHits(art::FindMany<recob::Hit>
const* hit_query)
128 { hits = hit_query; }
132 template <
typename Stream>
137 template <
typename Stream>
139 (
Stream&& out,
size_t iPoint, std::string indentstr)
const
141 PrintOptions_t localOptions(
options);
142 localOptions.indent.indent = indentstr;
147 template <
typename Stream>
149 (
Stream&& out,
size_t iPoint, PrintOptions_t
const& localOptions)
const
158 <<
"[#" << iPoint <<
"] ";
160 PrintOptions_t indentedOptions(localOptions);
161 indentedOptions.indent.appendIndentation(
" ");
163 (std::forward<Stream>(out), point, indentedOptions);
169 std::vector<recob::Hit const*> myHits = hits->at(iPoint);
170 if (myHits.empty()) {
171 out <<
"; no associated hits";
176 <<
"; " << myHits.size() <<
" hits:";
179 <<
" on " <<
hit->WireID()
180 <<
", peak at tick " <<
hit->PeakTime() <<
", "
181 <<
hit->PeakAmplitude() <<
" ADC, RMS: " <<
hit->RMS()
183 <<
hit->Channel() <<
")";
196 template <
typename Stream>
197 void DumpAllSpacePoints(
Stream&& out, std::string indentstr =
"")
const
200 localOptions.indent.appendIndentation(indentstr);
201 size_t const nPoints = points.size();
202 for (
size_t iPoint = 0; iPoint < nPoints; ++iPoint)
209 std::vector<recob::SpacePoint>
const& points;
213 art::FindMany<recob::Hit>
const* hits =
nullptr;
230 , fInputTag(config().SpacePointModuleLabel())
231 , fOutputCategory(config().OutputCategory())
232 , fPrintHexFloats(config().PrintHexFloats())
244 = evt.getValidHandle<std::vector<recob::SpacePoint>>(
fInputTag);
246 art::FindMany<recob::Hit>
const PointHits(SpacePoints, evt,
fInputTag);
248 size_t const nPoints = SpacePoints->size();
250 <<
"The event contains " << nPoints <<
" space points from '"
254 SpacePointDumper dumper(*SpacePoints);
255 if (PointHits.isValid()) dumper.SetHits(&PointHits);
256 else mf::LogWarning(
"DumpSpacePoints") <<
"hit information not avaialble";
DumpSpacePoints(Parameters const &config)
Default constructor.
bool fPrintHexFloats
whether to print floats in base 16
Declaration of signal hit object.
Prints the content of all the space points on screen.
Functions dumping space points.
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.
std::string fOutputCategory
category for LogInfo output
fhicl::Atom< std::string > OutputCategory
virtual void analyze(const art::Event &evt) override
Does the printing.
fhicl::Atom< bool > PrintHexFloats
Simple class managing a repetitive output task.
BEGIN_PROLOG vertical distance to the surface Name
Configuration parameters.
art::EDAnalyzer::Table< Config > Parameters
fhicl::Atom< art::InputTag > SpacePointModuleLabel
art::InputTag fInputTag
input tag of the SpacePoint product
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
NewLine< Stream > makeNewLine(Stream &stream, std::string indent, bool followLine=false)
Convenience function to create a temporary NewLine.
2D representation of charge deposited in the TDC/wire plane
Collection of available printing style options.