126 TLOG_DEBUG(
"PdspHDFFileReader") <<
"readNext BEGIN";
144 if (fragmentMap.size() == 0)
146 TLOG_ERROR(
"PdspHDFFileReader") <<
"No data received, either because of a problem or end of file. Returning false (should exit art)";
152 for (
auto& subDetName_fragmentList_pair : fragmentMap)
154 for (
auto& frag : *subDetName_fragmentList_pair.second)
156 TLOG_DEBUG(
"PdspHDFFileReader") << subDetName_fragmentList_pair.first <<
" Fragment, " <<
" type " 157 << ((
int) frag.type()) <<
", timestamp " << frag.timestamp()
158 <<
", sequence_id " << frag.sequenceID()
159 <<
" fragment_id " << frag.fragmentID();
160 evtHeader.event_id = frag.sequenceID();
161 evtHeader.sequence_id = frag.sequenceID();
162 evtHeader.timestamp = frag.timestamp();
167 timespec hi_res_time;
168 int retcode = clock_gettime(CLOCK_REALTIME, &hi_res_time);
169 TLOG_ARB(15,
"PdspHDFFileReader") <<
"hi_res_time tv_sec = " << hi_res_time.tv_sec
170 <<
" tv_nsec = " << hi_res_time.tv_nsec <<
" (retcode = " << retcode <<
")";
173 currentTime = ((hi_res_time.tv_sec & 0xffffffff) << 32) | (hi_res_time.tv_nsec & 0xffffffff);
177 TLOG_ERROR(
"PdspHDFFileReader")
178 <<
"Unable to fetch a high-resolution time with clock_gettime for art::Event Timestamp. " 179 <<
"The art::Event Timestamp will be zero for event " << evtHeader.event_id;
183 if (inR == 0 || inR->
run() != evtHeader.run_id)
189 art::SubRunID subrun_check(evtHeader.run_id, evtHeader.subrun_id);
190 if (inSR == 0 || subrun_check != inSR->
subRunID())
197 for (
auto& subDetName_fragmentList_pair : fragmentMap)
200 subDetName_fragmentList_pair.first);
207 TLOG_TRACE(
"PdspHDFFileReader") <<
"EventHeader has Run " << evtHeader.run_id <<
", SubRun " << evtHeader.subrun_id <<
", Event " << evtHeader.event_id <<
", SeqID " << evtHeader.sequence_id <<
", IsComplete " << evtHeader.is_complete;
211 for (
auto& fragmentTypePair : eventMap)
213 auto type_code = fragmentTypePair.first;
214 TLOG_TRACE(
"PdspHDFFileReader") <<
"Before GetFragmentsByType call, type is " << (
int)type_code;
215 TLOG_TRACE(
"PdspHDFFileReader") <<
"After GetFragmentsByType call, number of fragments is " << fragmentTypePair.second->size();
217 std::unordered_map<std::string, std::unique_ptr<artdaq::Fragments>> derived_fragments;
218 for (
auto& frag : *fragmentTypePair.second)
224 if (!instance_name_result.first)
226 TLOG_WARNING(
"PdspHDFFileReader")
227 <<
"UnknownFragmentType: The product instance name mapping for fragment type \"" << ((
int)type_code)
228 <<
"\" is not known. Fragments of this " 229 <<
"type will be stored in the event with an instance name of \"" << label <<
"\".";
231 if (!derived_fragments.count(label))
233 derived_fragments[
label] = std::make_unique<Fragments>();
235 auto fragSize = frag.size();
236 TLOG_TRACE(
"PdspHDFFileReader") <<
"Moving Fragment with size " << fragSize <<
" from type map (type=" << type_code <<
") to derived map label=" <<
label;
239 TLOG_TRACE(
"PdspHDFFileReader") <<
"Placing derived fragments in outE";
240 for (
auto&
type : derived_fragments)
246 TLOG_TRACE(
"PdspHDFFileReader") <<
"After putting fragments in event";
247 TLOG_ARB(10,
"PdspHDFFileReader") <<
"readNext: bytesRead=" <<
bytesRead;;
249 TLOG_TRACE(
"PdspHDFFileReader") <<
"Returning from readNext";
HDFFileInfoPtr reopenFile(HDFFileInfoPtr oldHdfFileInfoPtr)
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
std::string pretend_module_name
The module name to store data under.
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
art::SourceHelper const & pmaker
An art::SourceHelper instance.
SubRunID subRunID() const
std::list< std::string > unprocessedEventList_
size_t bytesRead
running total of number of bytes received
FragmentListsByType getFragmentsForEvent(HDFFileInfoPtr &hdfFileInfoPtr, const std::string &topLevelGroupName)
std::unique_ptr< dune::HDFFileReader::HDFFileInfo > hdf_file_
std::enable_if_t<!detail::range_sets_supported(P::branch_type)> put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
std::map< std::string, std::unique_ptr< artdaq::Fragments > > FragmentListsByType
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
unsigned readNext_calls_
The number of times readNext has been called.