$treeview $search $mathjax $extrastylesheet
artdaq_demo
v3_04_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #define TRACE_NAME "EventReporterOutput" 00002 00003 #include "art/Framework/Core/ModuleMacros.h" 00004 #include "art/Framework/Core/OutputModule.h" 00005 #include "art/Framework/Principal/EventPrincipal.h" 00006 #include "art/Framework/Principal/OutputHandle.h" 00007 #include "art/Framework/Principal/RunPrincipal.h" 00008 #include "art/Framework/Principal/SubRunPrincipal.h" 00009 #include "art/Framework/Services/Registry/ServiceHandle.h" 00010 #if ART_HEX_VERSION < 0x20900 00011 #include "art/Persistency/Provenance/BranchIDListRegistry.h" 00012 #include "canvas/Persistency/Provenance/BranchIDList.h" 00013 #endif 00014 #include "art/Persistency/Provenance/ProcessHistoryRegistry.h" 00015 #include "art/Persistency/Provenance/ProductMetaData.h" 00016 00017 #include "canvas/Persistency/Provenance/BranchDescription.h" 00018 #include "canvas/Persistency/Provenance/BranchKey.h" 00019 #include "canvas/Persistency/Provenance/History.h" 00020 #include "canvas/Persistency/Provenance/ParentageRegistry.h" 00021 #include "canvas/Persistency/Provenance/ProcessConfiguration.h" 00022 #include "canvas/Persistency/Provenance/ProcessConfigurationID.h" 00023 #include "canvas/Persistency/Provenance/ProcessHistoryID.h" 00024 #include "canvas/Persistency/Provenance/ProductList.h" 00025 #include "canvas/Persistency/Provenance/ProductProvenance.h" 00026 #include "canvas/Persistency/Provenance/RunAuxiliary.h" 00027 #include "canvas/Persistency/Provenance/SubRunAuxiliary.h" 00028 #include "canvas/Utilities/DebugMacros.h" 00029 #include "canvas/Utilities/Exception.h" 00030 #include "cetlib/column_width.h" 00031 #include "cetlib/lpad.h" 00032 #include "cetlib/rpad.h" 00033 #include <algorithm> 00034 # include <iterator> 00035 #include "fhiclcpp/ParameterSet.h" 00036 #include "fhiclcpp/ParameterSetID.h" 00037 #include "fhiclcpp/ParameterSetRegistry.h" 00038 00039 #include "artdaq/TransferPlugins/TransferInterface.hh" 00040 #include "artdaq/TransferPlugins/MakeTransferPlugin.hh" 00041 #include "artdaq-core/Data/detail/ParentageMap.hh" 00042 #include "artdaq/DAQdata/Globals.hh" 00043 #include "artdaq/DAQdata/NetMonHeader.hh" 00044 00045 #include <iomanip> 00046 #include <iostream> 00047 #include <sstream> 00048 #include <string> 00049 #include <vector> 00050 00051 #include <unistd.h> 00052 00053 #include <TClass.h> 00054 #include <TMessage.h> 00055 00056 namespace art 00057 { 00058 class EventReporterOutput; 00059 } 00060 00061 00067 class art::EventReporterOutput : public OutputModule 00068 { 00069 public: 00077 explicit EventReporterOutput(fhicl::ParameterSet const& ps); 00078 00082 ~EventReporterOutput(); 00083 00084 private: 00085 virtual void openFile(FileBlock const&); 00086 00087 virtual void closeFile(); 00088 00089 virtual void respondToCloseInputFile(FileBlock const&); 00090 00091 virtual void respondToCloseOutputFiles(FileBlock const&); 00092 00093 virtual void endJob(); 00094 00095 virtual void write(EventPrincipal&); 00096 00097 virtual void writeRun(RunPrincipal&); 00098 00099 virtual void writeSubRun(SubRunPrincipal&); 00100 00101 private: 00102 00103 }; 00104 00105 art::EventReporterOutput:: 00106 EventReporterOutput(fhicl::ParameterSet const& ps) 00107 : OutputModule(ps) 00108 { 00109 TLOG(TLVL_DEBUG) << "Begin: EventReporterOutput::EventReporterOutput(ParameterSet const& ps)"; 00110 } 00111 00112 art::EventReporterOutput:: 00113 ~EventReporterOutput() 00114 { 00115 TLOG(TLVL_DEBUG) << "Begin: EventReporterOutput::~EventReporterOutput()"; 00116 } 00117 00118 void 00119 art::EventReporterOutput:: 00120 openFile(FileBlock const&) 00121 { 00122 TLOG(TLVL_DEBUG) << "Begin/End: EventReporterOutput::openFile(const FileBlock&)"; 00123 } 00124 00125 void 00126 art::EventReporterOutput:: 00127 closeFile() 00128 { 00129 TLOG(TLVL_DEBUG) << "Begin/End: EventReporterOutput::closeFile()"; 00130 } 00131 00132 void 00133 art::EventReporterOutput:: 00134 respondToCloseInputFile(FileBlock const&) 00135 { 00136 TLOG(TLVL_DEBUG) << "Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)"; 00137 } 00138 00139 void 00140 art::EventReporterOutput:: 00141 respondToCloseOutputFiles(FileBlock const&) 00142 { 00143 TLOG(TLVL_DEBUG) << "Begin/End: EventReporterOutput::respondToCloseOutputFiles(FileBlock const&)"; 00144 } 00145 00146 void 00147 art::EventReporterOutput:: 00148 endJob() 00149 { 00150 TLOG(TLVL_DEBUG) << "Begin: EventReporterOutput::endJob()"; 00151 } 00152 00153 00154 00155 void 00156 art::EventReporterOutput:: 00157 write(EventPrincipal& ep) 00158 { 00159 TLOG(TLVL_DEBUG) << " Begin: EventReporterOutput::write(const EventPrincipal& ep)"; 00160 00161 using RawEvent = artdaq::Fragments;; 00162 using RawEvents = std::vector<RawEvent>; 00163 using RawEventHandle = art::Handle<RawEvent>; 00164 using RawEventHandles = std::vector<RawEventHandle>; 00165 00166 auto result_handles = std::vector<art::GroupQueryResult>(); 00167 00168 #if ART_HEX_VERSION < 0x20906 00169 ep.getManyByType(art::TypeID(typeid(RawEvent)), result_handles); 00170 #else 00171 auto const& wrapped = art::WrappedTypeID::make<RawEvent>(); 00172 result_handles = ep.getMany(wrapped, art::MatchAllSelector{}); 00173 #endif 00174 00175 for (auto const& result_handle : result_handles) 00176 { 00177 auto const raw_event_handle = RawEventHandle(result_handle); 00178 00179 if (!raw_event_handle.isValid()) 00180 continue; 00181 00182 for (auto const& fragment : *raw_event_handle){ 00183 TLOG(TLVL_DEBUG) << "EventReporterOutput::write: Event sequenceID=" << fragment.sequenceID() << ", fragmentID=" << fragment.fragmentID(); 00184 } 00185 } 00186 00187 return; 00188 } 00189 00190 void 00191 art::EventReporterOutput:: 00192 writeRun(RunPrincipal& ) 00193 { 00194 TLOG(TLVL_DEBUG) << " EventReporterOutput::writeRun(const RunPrincipal& rp)"; 00195 } 00196 00197 void 00198 art::EventReporterOutput::writeSubRun(SubRunPrincipal& ) 00199 { 00200 TLOG(TLVL_DEBUG) << " EventReporterOutput:: writeSubRun(const SubRunPrincipal& srp)"; 00201 } 00202 00203 DEFINE_ART_MODULE(art::EventReporterOutput) 00204