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 #if ART_HEX_VERSION < 0x20900
11 #include "art/Persistency/Provenance/BranchIDListRegistry.h"
12 #include "canvas/Persistency/Provenance/BranchIDList.h"
14 #include "art/Persistency/Provenance/ProcessHistoryRegistry.h"
15 #if ART_HEX_VERSION < 0x30000
16 #include "art/Persistency/Provenance/ProductMetaData.h"
21 #include "canvas/Persistency/Provenance/BranchDescription.h"
22 #include "canvas/Persistency/Provenance/BranchKey.h"
23 #include "canvas/Persistency/Provenance/History.h"
24 #include "canvas/Persistency/Provenance/ParentageRegistry.h"
25 #include "canvas/Persistency/Provenance/ProcessConfiguration.h"
26 #include "canvas/Persistency/Provenance/ProcessConfigurationID.h"
27 #include "canvas/Persistency/Provenance/ProcessHistoryID.h"
28 #include "canvas/Persistency/Provenance/ProductList.h"
29 #include "canvas/Persistency/Provenance/ProductProvenance.h"
30 #include "canvas/Persistency/Provenance/RunAuxiliary.h"
31 #include "canvas/Persistency/Provenance/SubRunAuxiliary.h"
32 #include "canvas/Utilities/DebugMacros.h"
33 #include "canvas/Utilities/Exception.h"
34 #include "cetlib/column_width.h"
35 #include "cetlib/lpad.h"
36 #include "cetlib/rpad.h"
37 #include "fhiclcpp/ParameterSet.h"
38 #include "fhiclcpp/ParameterSetID.h"
39 #include "fhiclcpp/ParameterSetRegistry.h"
41 #include "artdaq-core/Data/detail/ParentageMap.hh"
42 #include "artdaq/DAQdata/Globals.hh"
43 #include "artdaq/DAQdata/NetMonHeader.hh"
44 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
45 #include "artdaq/TransferPlugins/TransferInterface.hh"
59 class EventReporterOutput;
85 virtual void openFile( FileBlock
const& );
87 virtual void closeFile();
89 virtual void respondToCloseInputFile( FileBlock
const& );
91 virtual void respondToCloseOutputFiles( FileBlock
const& );
93 virtual void endJob();
95 virtual void write( EventPrincipal& );
97 virtual void writeRun( RunPrincipal& );
99 virtual void writeSubRun( SubRunPrincipal& );
106 TLOG( TLVL_DEBUG ) <<
"Begin: EventReporterOutput::EventReporterOutput(ParameterSet const& ps)";
111 TLOG( TLVL_DEBUG ) <<
"Begin: EventReporterOutput::~EventReporterOutput()";
114 void art::EventReporterOutput::openFile( FileBlock
const& )
116 TLOG( TLVL_DEBUG ) <<
"Begin/End: EventReporterOutput::openFile(const FileBlock&)";
119 void art::EventReporterOutput::closeFile() { TLOG( TLVL_DEBUG ) <<
"Begin/End: EventReporterOutput::closeFile()"; }
121 void art::EventReporterOutput::respondToCloseInputFile( FileBlock
const& )
123 TLOG( TLVL_DEBUG ) <<
"Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)";
126 void art::EventReporterOutput::respondToCloseOutputFiles( FileBlock
const& )
128 TLOG( TLVL_DEBUG ) <<
"Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)";
131 void art::EventReporterOutput::endJob() { TLOG( TLVL_DEBUG ) <<
"Begin: EventReporterOutput::endJob()"; }
133 void art::EventReporterOutput::write( EventPrincipal& ep )
135 TLOG( TLVL_DEBUG ) <<
" Begin: EventReporterOutput::write(const EventPrincipal& ep)";
137 using RawEvent = artdaq::Fragments;
139 using RawEvents = std::vector<RawEvent>;
140 using RawEventHandle = art::Handle<RawEvent>;
141 using RawEventHandles = std::vector<RawEventHandle>;
143 auto result_handles = std::vector<art::GroupQueryResult>();
145 #if ART_HEX_VERSION < 0x30000
146 auto const& wrapped = art::WrappedTypeID::make<RawEvent>();
147 result_handles = ep.getMany( wrapped, art::MatchAllSelector{} );
149 auto const& wrapped = art::WrappedTypeID::make<RawEvent>();
150 ModuleContext
const mc{moduleDescription()};
151 ProcessTag
const processTag{
"", mc.moduleDescription().processName()};
153 result_handles = ep.getMany( mc, wrapped, art::MatchAllSelector{}, processTag );
156 for (
auto const& result_handle : result_handles )
158 auto const raw_event_handle = RawEventHandle( result_handle );
160 if ( !raw_event_handle.isValid() )
continue;
162 for (
auto const& fragment : *raw_event_handle )
164 TLOG( TLVL_DEBUG ) <<
"EventReporterOutput::write: Event sequenceID=" << fragment.sequenceID()
165 <<
", fragmentID=" << fragment.fragmentID();
172 void art::EventReporterOutput::writeRun( RunPrincipal& )
174 TLOG( TLVL_DEBUG ) <<
" EventReporterOutput::writeRun(const RunPrincipal& rp)";
177 void art::EventReporterOutput::writeSubRun( SubRunPrincipal& )
179 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()
EventReporterOutput Destructor.