Jpp  18.2.1-ARCA-DF-PATCH
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 JAANET::JMultiHead

Public Member Functions

 MultiHead ()
 Default constructor. More...
 
virtual ~MultiHead ()
 Virtual destructor. More...
 
const_iterator find (const uuid_t &uuid, const bool useCache=false) const
 Find header with given UUID. More...
 
const_iterator find (const Evt &event, const bool useCache=false) const
 Find the header corresponding to the given event. More...
 
bool insert (const Head &header)
 Insert the given header. More...
 
size_t join (const MultiHead &multiHead)
 Join given MultiHead object with this MultiHead object. 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 17 of file MultiHead.hh.

Constructor & Destructor Documentation

MultiHead::MultiHead ( )
inline

Default constructor.

Definition at line 24 of file MultiHead.hh.

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

Virtual destructor.

Definition at line 33 of file MultiHead.hh.

34  {}

Member Function Documentation

const_iterator 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 47 of file MultiHead.hh.

49  {
50  using namespace std;
51 
52  static struct Cache
53  {
54  Cache() { uuid_clear(this->uuid); }
55 
56  const_iterator it;
57  uuid_t uuid;
58  } cache;
59 
60  if (!useCache) {
61 
62  for (cache.it = this->cbegin(); cache.it != this->cend(); ++cache.it) {
63 
64  const Head& head = *cache.it;
65  string uuid_str = head.at(Head::tags::UUID);
66 
67  uuid_str.erase(remove_if(uuid_str.begin(), uuid_str.end(), ::isspace), uuid_str.end());
68 
69  uuid_parse(uuid_str.c_str(), cache.uuid);
70 
71  if (uuid_compare(uuid, cache.uuid) == 0) {
72  return cache.it;
73  }
74  }
75 
76  return this->end();
77 
78  } else {
79 
80  if (uuid_compare(uuid, cache.uuid) == 0) {
81  return cache.it;
82  } else {
83  return find(uuid, false);
84  }
85  }
86  }
static constexpr const char *const UUID
Definition: Head.hh:68
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
const_iterator find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
Definition: MultiHead.hh:47
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
const_iterator 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 98 of file MultiHead.hh.

100  {
101  return find(event.header_uuid, useCache);
102  }
uuid_t header_uuid
UUID of header containing the event-weight information.
Definition: Evt.hh:35
const_iterator find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
Definition: MultiHead.hh:47
bool MultiHead::insert ( const Head header)
inline

Insert the given header.

Parameters
headerheader
Returns
true if insertion was successful; else false

Definition at line 111 of file MultiHead.hh.

112  {
113  using namespace std;
114 
115  string uuid_str = header.at(Head::tags::UUID);
116  uuid_str.erase(remove_if(uuid_str.begin(), uuid_str.end(), ::isspace), uuid_str.end());
117 
118  uuid_t uuid;
119  uuid_parse(uuid_str.c_str(), uuid);
120 
121  if (uuid_is_null(uuid) == 0 && find(uuid) == this->cend()) {
122 
123  this->push_back(header);
124 
125  return true;
126  }
127 
128  return false;
129  }
static constexpr const char *const UUID
Definition: Head.hh:68
const_iterator find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
Definition: MultiHead.hh:47
size_t MultiHead::join ( const MultiHead multiHead)
inline

Join given MultiHead object with this MultiHead object.

Parameters
multiHeadMultiHead object
Returns
number of inserted headers

Definition at line 138 of file MultiHead.hh.

139  {
140  using namespace std;
141 
142  size_t n = 0;
143 
144  for (const_iterator i = multiHead.cbegin(); i != multiHead.cend(); ++i) {
145  n += (size_t) this->insert(*i);
146  }
147 
148  return n;
149  }
const int n
Definition: JPolint.hh:786
bool insert(const Head &header)
Insert the given header.
Definition: MultiHead.hh:111
static void MultiHead::actionAtFileOpen ( int  version)
inlinestatic

Action method at file open.

Parameters
versionversion

Definition at line 157 of file MultiHead.hh.

158  {
160  }
static int ROOT_IO_VERSION
Streamer version as obtained from ROOT file.
Definition: MultiHead.hh:163
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 163 of file MultiHead.hh.


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