15 #include "art/Framework/Core/EDAnalyzer.h"
16 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "canvas/Utilities/InputTag.h"
20 #include "fhiclcpp/types/Atom.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
30 using namespace fhicl;
35 using Comment = fhicl::Comment;
37 fhicl::Atom<art::InputTag> InputPhotons {
39 Comment(
"data product with the SimPhotons to be dumped")
42 fhicl::Atom<std::string> OutputCategory {
43 Name(
"OutputCategory"),
44 Comment(
"name of the output stream (managed by the message facility)"),
64 struct OnePhotonSorter {
70 if (res < 0)
return true;
71 if (res > 0)
return false;
74 if (res < 0)
return true;
75 if (res > 0)
return false;
78 if (res < 0)
return true;
79 if (res > 0)
return false;
82 if (res < 0)
return true;
83 if (res > 0)
return false;
86 if (res < 0)
return true;
87 if (res > 0)
return false;
90 if (res < 0)
return true;
91 if (res > 0)
return false;
98 {
return operator() (*a, *b); }
102 template <
typename T,
typename U>
103 static int cmp(T
const& a, U
const& b)
105 if (a < b)
return -1;
106 if (a == b)
return 0;
131 void analyze(art::Event
const& event)
override;
147 template <
typename Stream>
150 std::string indent =
"",
bool bIndentFirst =
true
154 template <
typename Stream>
172 , fInputPhotons(config().InputPhotons())
173 , fOutputCategory(config().OutputCategory())
177 template <
typename Stream>
181 out <<
"E=" << onephoton.
Energy <<
" t=" << onephoton.
Time
185 if (onephoton.
SetInSD) out <<
" [in SD]";
191 template <
typename Stream>
194 std::string indent ,
bool bIndentFirst
196 if (bIndentFirst) out << indent;
197 out <<
"channel=" << simphotons.
OpChannel() <<
" has ";
198 if (simphotons.empty()) {
199 out << simphotons.size() <<
" no photons";
202 out << simphotons.size() <<
" photons:";
206 (sortedPhotonPtrs.begin(), sortedPhotonPtrs.end(), OnePhotonSorter());
208 for (
auto const* onephoton: sortedPhotonPtrs) {
209 out <<
"\n" << indent <<
" ";
210 DumpOnePhoton(out, *onephoton);
223 = *(
event.getValidHandle<std::vector<sim::SimPhotons>>(fInputPhotons));
225 mf::LogVerbatim(fOutputCategory) <<
"Event " <<
event.id()
226 <<
" : data product '" << fInputPhotons.encode() <<
"' contains "
229 unsigned int iPhoton = 0;
232 mf::LogVerbatim log(fOutputCategory);
234 log <<
"[#" << (iPhoton++) <<
"] ";
235 DumpElement(log, photons,
" ",
false);
238 mf::LogVerbatim(fOutputCategory) <<
"\n";
process_name opflashCryo1 flashfilter analyze
process_name can override from command line with o or output photon
int OpChannel() const
Returns the optical channel number this object is associated to.
void DumpElement(Stream &&out, sim::SimPhotons const &simphotons, std::string indent="", bool bIndentFirst=true) const
Dumps the content of the specified SimPhotons in the output stream.
Silly utility to sort vectors indirectly.
All information of a photon entering the sensitive optical detector volume.
art::InputTag fInputPhotons
name of SimPhotons's data product
auto makePointerVector(Coll &coll)
Creates a STL vector with pointers to data from another collection.
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
Simulation objects for optical detectors.
BEGIN_PROLOG vertical distance to the surface Name
std::string fOutputCategory
name of the stream for output
void DumpOnePhoton(Stream &&out, sim::OnePhoton const &photon) const
Dumps a sim::OnePhoton on a single line.
void analyze(art::Event const &event) override
DumpSimPhotons(Parameters const &config)
Configuration-checking constructor.
Collection of photons which recorded on one channel.
bool SetInSD
Whether the photon reaches the sensitive detector.
geo::OpticalPoint_t FinalLocalPosition
Where photon enters the optical detector in local coordinates [cm].
art::EDAnalyzer::Table< Config > Parameters
float Energy
Scintillation photon energy [GeV].
int MotherTrackID
ID of the GEANT4 track causing the scintillation.