1 #ifndef __JAANET_JMULTIHEAD__
2 #define __JAANET_JMULTIHEAD__
26 namespace JPP {
using namespace JAANET; }
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) {
198 if (header1.
match(header2)) {
200 header1.
add(header2);
201 mergedHeaders.push_back(header2.
UUID);
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
Auxiliary data structure for storing pairs of header UUIDs and event-weight normalisations.
void merge()
Merge all matching headers.
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
double getNormalisation(const JUUID &UUID) const
Get normalisation for given header UUID.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JUUID getHeaderUUID(const Evt &event) const
Get the header UUID corresponding to the given event.
map_type normalisationMap
Map between header UUIDs and event-weight normalisations.
JMultiHead()
Default constructor.
std::map< JUUID, JAANET::JEvtWeightNormalisation > map_type
Abstract base class for event weighing.
bool isMerged(const JUUID &UUID) const
Check if given header UUID correspond to a file which has been merged.
uuid_t header_uuid
UUID of header containing the event-weight information.
void createUUID()
Create UUID if not already set.
bool insert(const Head &header)
Insert the given header.
double getNormalisation(const Evt &event) const
Get normalisation for given event.
JHead & add(const JHead &header)
Addition of headers.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
void merge(const JHead &header)
Merge the given header into this object.
void copy(const Head &from, JHead &to)
Copy header from from to to.
bool match(const JHead &header) const
Test match of headers.
static const int BUFFER_SIZE
number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse ...
double getNormalisation() const
Get event-weight normalisation.
Exception for accessing a value in a collection that is outside of its range.
bool insert(const JHead &header)
Insert the given header.
Helper class for event weighing.
void add(const JHead &header)
Add header.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.