Jpp  17.3.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
MultiHead Struct Reference

#include <MultiHead.hh>

Inheritance diagram for MultiHead:
std::vector< Head > TObject

Public Member Functions

 MultiHead ()
 Default constructor. More...
 
virtual ~MultiHead ()
 Virtual destructor. More...
 
const Headfind (const uuid_t &uuid, const bool useCache=false) const
 Find header with given UUID. More...
 
const Headfind (const Evt &event, const bool useCache=false) const
 Find the header corresponding to the given event. More...
 
 ClassDef (MultiHead, 1)
 

Static Public Member Functions

static void actionAtFileOpen (int version)
 Action method at file open. More...
 

Static Public Attributes

static int ROOT_IO_VERSION = -1
 Streamer version as obtained from ROOT file. More...
 

Detailed Description

Author
bjung

Definition at line 18 of file MultiHead.hh.

Constructor & Destructor Documentation

MultiHead::MultiHead ( )
inline

Default constructor.

Definition at line 25 of file MultiHead.hh.

25  :
27  TObject()
28  {}
Definition: JRoot.hh:19
virtual MultiHead::~MultiHead ( )
inlinevirtual

Virtual destructor.

Definition at line 34 of file MultiHead.hh.

35  {}

Member Function Documentation

const Head& MultiHead::find ( const uuid_t &  uuid,
const bool  useCache = false 
) const
inline

Find header with given UUID.


Note: The parameter useCache can be toggled on for faster lookup.
This should not be used if your MultiHead object is modified between look-ups.

Parameters
uuidheader UUID
useCacheuse caching for faster look-up
Returns
header with given UUID

Definition at line 48 of file MultiHead.hh.

50  {
51  using namespace std;
52 
53  static struct
54  {
55  size_t index;
56  uuid_t uuid;
57  } cache;
58 
59  if (!useCache) {
60 
61  for (cache.index = 0; cache.index < this->size(); ++cache.index) {
62 
63  const Head& head = (*this)[cache.index];
64  const string& uuid_str = head.at(Head::tags::UUID);
65 
66  uuid_parse(uuid_str.c_str(), cache.uuid);
67 
68  if (uuid_compare(uuid, cache.uuid)) {
69  return head;
70  }
71  }
72 
73  THROW(Exception, "MultiHead::find(const uuid_t&, const bool): Could not find header with UUID " << uuid);
74 
75  } else {
76 
77  if (uuid_compare(uuid, cache.uuid)) {
78  return this->at(cache.index);
79  } else {
80  return find(uuid, false);
81  }
82  }
83  }
static constexpr const char *const UUID
Definition: Head.hh:68
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
General exception.
Definition: Exception.hh:13
const Head & find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
Definition: MultiHead.hh:48
const Head& MultiHead::find ( const Evt event,
const bool  useCache = false 
) const
inline

Find the header corresponding to the given event.

Note: The parameter useCache can be toggled on for faster lookup.
This should not be used if your MultiHead object is modified between look-ups.

Parameters
eventevent
useCacheuse caching for faster look-up
Returns
header corresponding to the given event

Definition at line 95 of file MultiHead.hh.

97  {
98  return find(event.header_uuid, useCache);
99  }
uuid_t header_uuid
UUID of header containing the event-weight information.
Definition: Evt.hh:35
const Head & find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
Definition: MultiHead.hh:48
static void MultiHead::actionAtFileOpen ( int  version)
inlinestatic

Action method at file open.

Parameters
versionversion

Definition at line 107 of file MultiHead.hh.

108  {
110  }
static int ROOT_IO_VERSION
Streamer version as obtained from ROOT file.
Definition: MultiHead.hh:112
version
Definition: JEditTuneHV.sh:5
MultiHead::ClassDef ( MultiHead  ,
 
)

Member Data Documentation

int MultiHead::ROOT_IO_VERSION = -1
static

Streamer version as obtained from ROOT file.

Definition at line 112 of file MultiHead.hh.


The documentation for this struct was generated from the following files: