1 #define TRACE_NAME "EventReporterOutput"
3 #include "art/Framework/Core/ModuleMacros.h"
4 #include "art/Framework/Core/OutputModule.h"
5 #include "art/Framework/Principal/EventPrincipal.h"
6 #include "art/Framework/Principal/OutputHandle.h"
7 #include "art/Framework/Principal/RunPrincipal.h"
8 #include "art/Framework/Principal/SubRunPrincipal.h"
9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #include "art/Persistency/Provenance/ModuleContext.h"
11 #include "art/Persistency/Provenance/ProcessHistoryRegistry.h"
12 #include "canvas/Persistency/Common/Wrapper.h"
13 #include "canvas/Persistency/Provenance/BranchDescription.h"
14 #include "canvas/Persistency/Provenance/BranchKey.h"
15 #include "canvas/Persistency/Provenance/History.h"
16 #include "canvas/Persistency/Provenance/ParentageRegistry.h"
17 #include "canvas/Persistency/Provenance/ProcessConfiguration.h"
18 #include "canvas/Persistency/Provenance/ProcessConfigurationID.h"
19 #include "canvas/Persistency/Provenance/ProcessHistoryID.h"
20 #include "canvas/Persistency/Provenance/ProductList.h"
21 #include "canvas/Persistency/Provenance/ProductProvenance.h"
22 #include "canvas/Persistency/Provenance/RunAuxiliary.h"
23 #include "canvas/Persistency/Provenance/SubRunAuxiliary.h"
24 #include "canvas/Utilities/DebugMacros.h"
25 #include "canvas/Utilities/Exception.h"
26 #if ART_HEX_VERSION < 0x30901
27 #include "canvas/Utilities/WrappedTypeID.h"
29 #include "canvas/Persistency/Common/WrappedTypeID.h"
31 #include "cetlib/column_width.h"
32 #include "cetlib/lpad.h"
33 #include "cetlib/rpad.h"
34 #include "fhiclcpp/ParameterSet.h"
35 #include "fhiclcpp/ParameterSetID.h"
36 #include "fhiclcpp/ParameterSetRegistry.h"
38 #include "artdaq-core/Data/detail/ParentageMap.hh"
39 #include "artdaq/DAQdata/Globals.hh"
40 #include "artdaq/DAQdata/NetMonHeader.hh"
41 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
42 #include "artdaq/TransferPlugins/TransferInterface.hh"
57 class EventReporterOutput;
88 void openFile(FileBlock
const& )
override;
90 virtual void closeFile();
92 void respondToCloseInputFile(FileBlock
const& )
override;
94 void respondToCloseOutputFiles(FileBlock
const& )
override;
96 void endJob()
override;
98 void write(EventPrincipal& )
override;
100 void writeRun(RunPrincipal& )
override;
102 void writeSubRun(SubRunPrincipal& )
override;
108 TLOG(TLVL_DEBUG) <<
"Begin: EventReporterOutput::EventReporterOutput(ParameterSet const& ps)";
113 TLOG(TLVL_DEBUG) <<
"Begin: EventReporterOutput::~EventReporterOutput()";
116 void art::EventReporterOutput::openFile(FileBlock
const& )
118 TLOG(TLVL_DEBUG) <<
"Begin/End: EventReporterOutput::openFile(const FileBlock&)";
121 void art::EventReporterOutput::closeFile() { TLOG(TLVL_DEBUG) <<
"Begin/End: EventReporterOutput::closeFile()"; }
123 void art::EventReporterOutput::respondToCloseInputFile(FileBlock
const& )
125 TLOG(TLVL_DEBUG) <<
"Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)";
128 void art::EventReporterOutput::respondToCloseOutputFiles(FileBlock
const& )
130 TLOG(TLVL_DEBUG) <<
"Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)";
133 void art::EventReporterOutput::endJob() { TLOG(TLVL_DEBUG) <<
"Begin: EventReporterOutput::endJob()"; }
135 void art::EventReporterOutput::write(EventPrincipal& ep)
137 TLOG(TLVL_DEBUG) <<
" Begin: EventReporterOutput::write(const EventPrincipal& ep)";
139 using RawEvent = artdaq::Fragments;
141 using RawEvents = std::vector<RawEvent>;
142 using RawEventHandle = art::Handle<RawEvent>;
143 using RawEventHandles = std::vector<RawEventHandle>;
145 auto result_handles = std::vector<art::GroupQueryResult>();
147 auto const& wrapped = art::WrappedTypeID::make<RawEvent>();
148 ModuleContext
const mc{moduleDescription()};
149 ProcessTag
const processTag{
"", mc.moduleDescription().processName()};
151 result_handles = ep.getMany(mc, wrapped, art::MatchAllSelector{}, processTag);
153 for (
auto const& result_handle : result_handles)
155 auto const raw_event_handle = RawEventHandle(result_handle);
157 if (!raw_event_handle.isValid())
162 for (
auto const& fragment : *raw_event_handle)
164 TLOG(TLVL_DEBUG) <<
"EventReporterOutput::write: Event sequenceID=" << fragment.sequenceID()
165 <<
", fragmentID=" << fragment.fragmentID();
170 void art::EventReporterOutput::writeRun(RunPrincipal& )
172 TLOG(TLVL_DEBUG) <<
" EventReporterOutput::writeRun(const RunPrincipal& rp)";
175 void art::EventReporterOutput::writeSubRun(SubRunPrincipal& )
177 TLOG(TLVL_DEBUG) <<
" EventReporterOutput:: writeSubRun(const SubRunPrincipal& srp)";
An art::OutputModule which does nothing, but reports seen events and their fragments. This module is designed for debugging purposes, where writing events into ROOT files or sending events down stream is not necessary.
EventReporterOutput(fhicl::ParameterSet const &ps)
EventReporterOutput Constructor.
~EventReporterOutput() override
EventReporterOutput Destructor.