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;
77 void print(std::ostream& os)
const;
195 void print(std::ostream& os)
const;
211 void fragmentTypes(std::vector<Fragment::type_t>& type_list);
237 : header_(run, subrun, event, seq, ts)
241 : header_(hdr), fragments_()
247 if (pfrag ==
nullptr)
249 throw cet::exception(
"LogicError")
250 <<
"Attempt to insert a null FragmentPtr into a RawEvent detected.\n";
252 fragments_.emplace_back(std::move(pfrag));
259 return fragments_.size();
265 for (
auto const& frag : fragments_) { sum += frag->size(); }
278 std::unique_ptr<Fragments> result(
new Fragments);
279 result->reserve(fragments_.size());
282 for (
auto& i : fragments_)
284 result->emplace_back(std::move(*i));
297 for (
auto& i : fragments_)
299 auto fragType = i->type();
300 if (std::find(type_list.begin(), type_list.end(), fragType) == type_list.end())
302 type_list.push_back(fragType);
309 inline std::unique_ptr<Fragments>
312 std::unique_ptr<Fragments> result(
new Fragments);
313 auto iter = fragments_.begin();
316 if ((*iter)->type() == fragment_type)
318 result->push_back(std::move(*(*iter)));
319 iter = fragments_.erase(iter);
325 }
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...