14 #include "art/Framework/Core/EDAnalyzer.h"
15 #include "art/Framework/Core/ModuleMacros.h"
16 #include "art/Framework/Principal/Event.h"
17 #include "art/Framework/Principal/Handle.h"
18 #include "canvas/Utilities/InputTag.h"
19 #include "fhiclcpp/types/Atom.h"
20 #include "messagefacility/MessageLogger/MessageLogger.h"
30 class DumpSimPhotonsLite;
35 using namespace fhicl;
40 using Comment = fhicl::Comment;
42 fhicl::Atom<art::InputTag> InputPhotons {
44 Comment(
"data product with the SimPhotonsLite to be dumped")
47 fhicl::Atom<std::string> OutputCategory {
48 Name(
"OutputCategory"),
49 Comment(
"name of the output stream (managed by the message facility)"),
75 void analyze(art::Event
const& event)
override;
91 template <
typename Stream>
94 std::string indent, std::string firstIndent
97 template <
typename Stream>
101 { DumpPhoton(std::forward<Stream>(out), photons, indent, indent); }
118 , fInputPhotons(config().InputPhotons())
119 , fOutputCategory(config().OutputCategory())
123 template <
typename Stream>
126 std::string indent, std::string firstIndent
129 unsigned int const nPhotons = std::accumulate(
131 0U, [](
auto sum,
auto const& entry){
return sum + entry.second; }
135 <<
"channel=" << photons.
OpChannel <<
" has ";
137 out << nPhotons <<
" photons (format: [tick] photons):";
138 constexpr
unsigned int PageSize = 5;
139 unsigned int pager = 0;
142 pager = PageSize - 1;
143 out <<
"\n" << indent <<
" ";
145 out <<
" [" << pair.first <<
"] " << std::setw(6) << pair.second;
160 = *(
event.getValidHandle<std::vector<sim::SimPhotonsLite>>(fInputPhotons));
162 mf::LogVerbatim(fOutputCategory) <<
"Event " <<
event.id()
163 <<
" : data product '" << fInputPhotons.encode() <<
"' contains "
164 << Photons.size() <<
" SimPhotonsLite";
166 unsigned int iChannel = 0;
169 mf::LogVerbatim log(fOutputCategory);
171 log <<
"[#" << (iChannel++) <<
"] ";
172 DumpPhoton(log, photons,
" ");
175 mf::LogVerbatim(fOutputCategory) <<
"\n";
process_name opflashCryo1 flashfilter analyze
art::EDAnalyzer::Table< Config > Parameters
art::InputTag fInputPhotons
name of SimPhotons's data product
std::map< int, int > DetectedPhotons
Number of photons detected at each given time: time tick -> photons.
Simulation objects for optical detectors.
DumpSimPhotonsLite(Parameters const &config)
Configuration-checking constructor.
int OpChannel
Optical detector channel associated to this data.
BEGIN_PROLOG vertical distance to the surface Name
Compact representation of photons on a channel.
void analyze(art::Event const &event) override
void DumpPhoton(Stream &&out, sim::SimPhotonsLite const &photons, std::string indent, std::string firstIndent) const
Dumps the content of specified SimPhotonsLite in the output stream.
std::string fOutputCategory
name of the stream for output