1#ifndef __JAANET_JMULTIHEAD__
2#define __JAANET_JMULTIHEAD__
81 if (i != head.end()) {
82 uuid_parse(i->second.c_str(), uuid);
85 if (uuid_is_null(uuid) != 0) {
86 uuid_generate_random(uuid);
90 uuid_unparse_lower(uuid, buffer);
111 return i->first != i->second.UUID;
128 const JUUID UUID =
event.header_uuid;
133 return i->second.UUID;
135 THROW(
JValueOutOfRange,
"JMultiHead::getHeaderUUID(): Header UUID " << UUID <<
" for given event not found.");
153 return i->second.normalisation;
155 THROW(
JValueOutOfRange,
"JMultiHead::getNormalisation(): Given header UUID " << UUID <<
" not found.");
183 for (const_iterator i =
copy.cbegin(); i !=
copy.cend(); ++i) {
194 for (const_iterator j = next(i); j !=
copy.end(); ++j) {
196 const JHead header2 = *j;
198 if (header1.
match(header2)) {
200 header1.
add(header2);
201 mergedHeaders.push_back(header2.
UUID);
216 for (vector<JUUID>::const_iterator j = mergedHeaders.cbegin(); j != mergedHeaders.cend(); ++j) {
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JHead & add(const JHead &header)
Addition of headers.
void createUUID()
Create UUID if not already set.
bool match(const JHead &header) const
Test match of headers.
Exception for accessing a value in a collection that is outside of its range.
Extensions to Evt data format.
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
void copy(const Head &from, JHead &to)
Copy header from from to to.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
uuid_t header_uuid
UUID of header containing the event-weight information.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Helper class for event weighing.
double getNormalisation() const
Get event-weight normalisation.
void add(const JHead &header)
Add header.
Auxiliary data structure for storing pairs of header UUIDs and event-weight normalisations.
Abstract base class for event weighing.
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
JMultiHead()
Default constructor.
map_type normalisationMap
Map between header UUIDs and event-weight normalisations.
double getNormalisation(const Evt &event) const
Get normalisation for given event.
bool insert(const JHead &header)
Insert the given header.
void merge()
Merge all matching headers.
void merge(const JHead &header)
Merge the given header into this object.
double getNormalisation(const JUUID &UUID) const
Get normalisation for given header UUID.
std::map< JUUID, JAANET::JEvtWeightNormalisation > map_type
bool isMerged(const JUUID &UUID) const
Check if given header UUID correspond to a file which has been merged.
JUUID getHeaderUUID(const Evt &event) const
Get the header UUID corresponding to the given event.
static const int BUFFER_SIZE
number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse
bool insert(const Head &header)
Insert the given header.