13 #include "canvas/Utilities/InputTag.h"
14 #include "art/Framework/Core/EDAnalyzer.h"
15 #include "art/Framework/Principal/Event.h"
18 #include "fhiclcpp/types/Atom.h"
19 #include "fhiclcpp/types/Table.h"
20 #include "fhiclcpp/types/Name.h"
21 #include "fhiclcpp/types/Comment.h"
56 Name(
"SeedModuleLabel"),
57 Comment(
"tag of the recob::Seed collection data product to be dumped")
61 Name(
"OutputCategory"),
62 Comment(
"name of the message facility category to be used for output"),
67 Name(
"PrintHexFloats"),
68 Comment(
"print all the floating point numbers in base 16"),
80 virtual void analyze (
const art::Event&
evt)
override;
102 #include "art/Framework/Core/ModuleMacros.h"
103 #include "canvas/Persistency/Common/FindMany.h"
104 #include "art/Framework/Principal/Handle.h"
107 #include "messagefacility/MessageLogger/MessageLogger.h"
120 struct PrintOptions_t {
121 bool hexFloats =
false;
127 SeedDumper(std::vector<recob::Seed>
const& seed_list)
128 : SeedDumper(seed_list, {})
133 (std::vector<recob::Seed>
const& seed_list, PrintOptions_t print_options)
140 void SetHits(art::FindMany<recob::Hit>
const* hit_query)
141 { hits = hit_query; }
145 template <
typename Stream>
146 void DumpSeed(
Stream&& out,
size_t iSeed)
const
149 std::string
const& indentstr =
options.indent;
155 out <<
"\n" << indentstr
156 <<
"[#" << iSeed <<
"]";
157 if (!seed.
IsValid()) out <<
" invalid!";
159 std::array<double, 3> start,
dir;
161 seed.
GetPoint(start.data(),
nullptr);
163 <<
" starts at (" << hexfloat(start[0])
164 <<
"," << hexfloat(start[1]) <<
"," << hexfloat(start[2])
165 <<
") toward (" << hexfloat(dir[0]) <<
"," << hexfloat(dir[1])
166 <<
"," << hexfloat(dir[2])
167 <<
"); length: " << hexfloat(seed.
GetLength()) <<
" cm"
175 std::vector<recob::Hit const*> myHits = hits->at(iSeed);
176 if (!myHits.empty()) {
182 <<
"; " << myHits.size() <<
" hits:";
184 out <<
"\n" << indentstr
185 <<
" on " <<
hit->WireID()
186 <<
", peak at tick " <<
hit->PeakTime()
187 <<
", " <<
hit->PeakAmplitude()
188 <<
" ADC, RMS: " <<
hit->RMS()
189 <<
" (channel: " <<
hit->Channel() <<
")";
202 template <
typename Stream>
203 void DumpAllSeeds(
Stream&& out)
const
205 size_t const nSeeds =
seeds.size();
206 for (
size_t iSeed = 0; iSeed < nSeeds; ++iSeed)
207 DumpSeed(out, iSeed);
213 std::vector<recob::Seed>
const&
seeds;
218 art::FindMany<recob::Hit>
const* hits =
nullptr;
235 , fInputTag(config().SeedModuleLabel())
236 , fOutputCategory(config().OutputCategory())
237 , fPrintHexFloats(config().PrintHexFloats())
248 auto Seeds = evt.getValidHandle<std::vector<recob::Seed>>(
fInputTag);
250 art::FindMany<recob::Hit>
const SeedHits(Seeds, evt,
fInputTag);
252 size_t const nSeeds = Seeds->size();
254 <<
" contains " << nSeeds <<
" seeds from '"
258 SeedDumper::PrintOptions_t
options;
260 options.indent =
" ";
261 SeedDumper dumper(*Seeds, options);
263 if (SeedHits.isValid()) dumper.SetHits(&SeedHits);
264 else mf::LogWarning(
"DumpSeeds") <<
"hit information not avaialble";
fhicl::Atom< std::string > OutputCategory
Declaration of signal hit object.
void GetPoint(double *Pt, double *Err) const
art::InputTag fInputTag
input tag of the Seed product
Prints the content of all the seeds on screen.
virtual void analyze(const art::Event &evt) override
Does the printing.
fhicl::Atom< bool > PrintHexFloats
DumpSeeds(Parameters const &config)
Default constructor.
fhicl::Atom< art::InputTag > SeedModuleLabel
std::string fOutputCategory
category for LogInfo output
bool fPrintHexFloats
whether to print floats in base 16
BEGIN_PROLOG vertical distance to the surface Name
Helper for formatting floats in base 16.
std::vector< TrajPoint > seeds
Helper to support output of real numbers in base 16.
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
2D representation of charge deposited in the TDC/wire plane
art::EDAnalyzer::Table< Config > Parameters
void GetDirection(double *Dir, double *Err) const