1 #ifndef artdaq_core_Data_RawEvent_hh
2 #define artdaq_core_Data_RawEvent_hh
4 #include "artdaq-core/Data/Fragment.hh"
5 #include "artdaq-core/Data/dictionarycontrol.hh"
7 #include "cetlib_except/exception.h"
18 struct RawEventHeader;
30 static constexpr uint8_t CURRENT_VERSION = 0;
73 void print(std::ostream& os)
const;
191 void print(std::ostream& os)
const;
207 void fragmentTypes(std::vector<Fragment::type_t>& type_list);
233 : header_(run, subrun, event, seq, ts)
237 : header_(hdr), fragments_()
243 if (pfrag ==
nullptr)
245 throw cet::exception(
"LogicError")
246 <<
"Attempt to insert a null FragmentPtr into a RawEvent detected.\n";
248 fragments_.emplace_back(std::move(pfrag));
255 return fragments_.size();
261 for (
auto const& frag : fragments_) { sum += frag->size(); }
274 std::unique_ptr<Fragments> result(
new Fragments);
275 result->reserve(fragments_.size());
278 for (
auto& i : fragments_)
280 result->emplace_back(std::move(*i));
293 for (
auto& i : fragments_)
295 auto fragType = i->type();
296 if (std::find(type_list.begin(), type_list.end(), fragType) == type_list.end())
298 type_list.push_back(fragType);
305 inline std::unique_ptr<Fragments>
308 std::unique_ptr<Fragments> result(
new Fragments);
309 auto iter = fragments_.begin();
312 if ((*iter)->type() == fragment_type)
314 result->push_back(std::move(*(*iter)));
315 iter = fragments_.erase(iter);
321 }
while (iter != fragments_.end());
std::unique_ptr< Fragment > FragmentPtr
A std::unique_ptr to a Fragment object.
std::unique_ptr< Fragments > releaseProduct()
Release all the Fragments from this RawEvent.
detail::RawEventHeader::run_id_t run_id_t
Run numbers are 32 bits.
event_id_t eventID() const
Retrieve the event number from the RawEventHeader.
void fragmentTypes(std::vector< Fragment::type_t > &type_list)
Fills in a list of unique fragment types from this event.
timestamp_t timestamp() const
Retrieve the timestamp from the RawEventHeader.
std::vector< Fragment > Fragments
A std::vector of Fragment objects.
subrun_id_t subrunID() const
Retrieve the subrun number from the RawEventHeader.
detail::RawEventHeader::subrun_id_t subrun_id_t
Subrun numbers are 32 bits.
sequence_id_t sequenceID() const
Retrieve the sequence id from the RawEventHeader.
bool isComplete() const
Retrieve the value of the complete flag from the RawEventHeader.
detail::RawEventHeader::sequence_id_t sequence_id_t
Field size should be the same as the Fragment::sequence_id field.
detail::RawFragmentHeader::type_t type_t
typedef for type_t from RawFragmentHeader
RawEvent(run_id_t run, subrun_id_t subrun, event_id_t event, sequence_id_t seq, timestamp_t ts)
Constructs a RawEvent with the given parameters.
size_t numFragments() const
Return the number of fragments this RawEvent contains.
detail::RawEventHeader::event_id_t event_id_t
Event numbers are 32 bits.
void print(std::ostream &os) const
Print summary information about this RawEvent to the given stream.
run_id_t runID() const
Retrieve the run number from the RawEventHeader.
std::ostream & operator<<(std::ostream &os, Fragment const &f)
Prints the given Fragment to the stream.
std::shared_ptr< RawEvent > RawEvent_ptr
A smart pointer to a RawEvent object.
detail::RawEventHeader::timestamp_t timestamp_t
Field size should be the same as the Fragment::timestamp field.
std::list< FragmentPtr > FragmentPtrs
A std::list of FragmentPtrs.
void insertFragment(FragmentPtr &&pfrag)
Insert the given (pointer to a) Fragment into this RawEvent.
size_t wordCount() const
Return the sum of the word counts of all fragments in this RawEvent.
void markComplete()
Mark the event as complete.
RawEvent is the artdaq view of a generic event, containing a header and zero or more Fragments...