ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
IDCInDetBSErrContainer Class Reference

IDC like storage for BS errors, TODO, customise implementation further so that we store int rather than int*. More...

#include <IDCInDetBSErrContainer.h>

Inheritance diagram for IDCInDetBSErrContainer:
Collaboration diagram for IDCInDetBSErrContainer:

Public Types

typedef uint64_t ErrorCode
 
typedef uint64_t value_type
 
typedef IdentifiableValueCache< uint64_t > Cache
 

Public Member Functions

const uint64_t & emptyValue () const
 Return the empty value that is interpreted as an empty entry. More...
 
bool present (size_t i) const
 Is the value for this has set and also accepted in the mask. More...
 
bool setOrDrop (size_t i, const uint64_t &value)
 Set the value for the given hash. More...
 
size_t maxSize () const
 Return the maxSize of the collection. More...
 
size_t numberSet () const
 Return the number of entries set and accessible according to the mask. More...
 
bool tryAddFromCache (size_t i)
 Returns true if the value is also in the external cache, sets mask to true if it is. More...
 
uint64_t retrieve (size_t i) const
 Retrieve the value of the hash, if accessible according to the mask. More...
 
std::vector< std::pair< size_t, uint64_t > > getAll () const
 Make a vector of hashes and values, convenient for iteration and other uses. More...
 
const std::vector< std::atomic< uint64_t > > & wholeEventReadAccess () const
 Get read only access to the whole external cache. This could be useful for special situations. More...
 
const Cachecache () const
 Obtain const access to the cache. More...
 
const std::set< size_t > & getMask () const
 

Private Attributes

std::set< size_t > m_mask
 
Cachem_cache
 
bool m_own
 

Detailed Description

IDC like storage for BS errors, TODO, customise implementation further so that we store int rather than int*.

Definition at line 19 of file IDCInDetBSErrContainer.h.

Member Typedef Documentation

◆ Cache

typedef IdentifiableValueCache<uint64_t > IdentifiableValueContainer< uint64_t >::Cache
inherited

Definition at line 25 of file IdentifiableValueContainer.h.

◆ ErrorCode

Definition at line 21 of file IDCInDetBSErrContainer.h.

◆ value_type

typedef uint64_t IdentifiableValueContainer< uint64_t >::value_type
inherited

Definition at line 24 of file IdentifiableValueContainer.h.

Member Function Documentation

◆ cache()

const Cache* IdentifiableValueContainer< uint64_t >::cache
inlineinherited

Obtain const access to the cache.

Definition at line 77 of file IdentifiableValueContainer.h.

77 { return m_cache; }

◆ emptyValue()

const uint64_t & IdentifiableValueContainer< uint64_t >::emptyValue
inlineinherited

Return the empty value that is interpreted as an empty entry.

Definition at line 48 of file IdentifiableValueContainer.h.

48 { return m_cache->emptyValue(); }

◆ getAll()

std::vector< std::pair< size_t, uint64_t > > IdentifiableValueContainer< uint64_t >::getAll
inherited

Make a vector of hashes and values, convenient for iteration and other uses.

Definition at line 71 of file IdentifiableValueContainer.h.

93  {
94  std::vector<std::pair<size_t, T>> list;
95  list.reserve(m_mask.size());
96  const auto& raw = m_cache->rawReadAccess();
97  for(size_t i : m_mask){
98  list.emplace_back(i, raw[i].load(std::memory_order_relaxed));
99  }
100  return list;
101 }

◆ getMask()

const std::set<size_t>& IdentifiableValueContainer< uint64_t >::getMask
inlineinherited

Definition at line 79 of file IdentifiableValueContainer.h.

79 { return m_mask; }

◆ maxSize()

size_t IdentifiableValueContainer< uint64_t >::maxSize
inlineinherited

Return the maxSize of the collection.

Definition at line 58 of file IdentifiableValueContainer.h.

58 { return m_cache->maxSize(); }

◆ numberSet()

size_t IdentifiableValueContainer< uint64_t >::numberSet
inherited

Return the number of entries set and accessible according to the mask.

This is not a trivial function do not repeatedly call.

Definition at line 62 of file IdentifiableValueContainer.h.

124  {
125  return m_mask.size();
126 }

◆ present()

bool IdentifiableValueContainer< uint64_t >::present ( size_t  i) const
inherited

Is the value for this has set and also accepted in the mask.

Definition at line 52 of file IdentifiableValueContainer.h.

88 {
89  return m_mask.count(i);
90 }

◆ retrieve()

uint64_t IdentifiableValueContainer< uint64_t >::retrieve ( size_t  i) const
inherited

Retrieve the value of the hash, if accessible according to the mask.

Definition at line 68 of file IdentifiableValueContainer.h.

104  {
106  auto r = cache->retrieve(i);
107  //Should be quicker to establish empty cache than empty mask with a std::set
108  //So the cache is checked first
109  if(r!= cache->emptyValue() && present(i)) return r;
110  else return cache->emptyValue();
111 }

◆ setOrDrop()

bool IdentifiableValueContainer< uint64_t >::setOrDrop ( size_t  i,
const uint64_t &  value 
)
inherited

Set the value for the given hash.

Definition at line 55 of file IdentifiableValueContainer.h.

129  {
130  bool b = m_cache->setOrDrop(i, value);
131  m_mask.emplace(i);
132  return b;
133 }

◆ tryAddFromCache()

bool IdentifiableValueContainer< uint64_t >::tryAddFromCache ( size_t  i)
inherited

Returns true if the value is also in the external cache, sets mask to true if it is.

Definition at line 65 of file IdentifiableValueContainer.h.

114  {
115  if(i >= maxSize()) return false;
116  bool b = m_cache->present(i);
117  if(b) m_mask.emplace(i);
118  return b;
119 }

◆ wholeEventReadAccess()

const std::vector<std::atomic<uint64_t > >& IdentifiableValueContainer< uint64_t >::wholeEventReadAccess
inlineinherited

Get read only access to the whole external cache. This could be useful for special situations.

Definition at line 74 of file IdentifiableValueContainer.h.

74 { return m_cache->rawReadAccess(); }

Member Data Documentation

◆ m_cache

Cache* IdentifiableValueContainer< uint64_t >::m_cache
privateinherited

Definition at line 82 of file IdentifiableValueContainer.h.

◆ m_mask

std::set<size_t> IdentifiableValueContainer< uint64_t >::m_mask
privateinherited

Definition at line 81 of file IdentifiableValueContainer.h.

◆ m_own

bool IdentifiableValueContainer< uint64_t >::m_own
privateinherited

Definition at line 83 of file IdentifiableValueContainer.h.


The documentation for this class was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
IdentifiableValueContainer< uint64_t >::maxSize
size_t maxSize() const
Return the maxSize of the collection.
Definition: IdentifiableValueContainer.h:58
IdentifiableValueCache::setOrDrop
bool setOrDrop(size_t i, const T &value)
Set the given hash to the value.
Definition: IdentifiableValueCache.h:90
athena.value
value
Definition: athena.py:122
IdentifiableValueCache::rawReadAccess
const std::vector< std::atomic< T > > & rawReadAccess() const
Definition: IdentifiableValueCache.h:66
IdentifiableValueCache::emptyValue
const T & emptyValue() const
Return the empty value that is interpreted as an empty entry.
Definition: IdentifiableValueCache.h:26
IdentifiableValueContainer< uint64_t >::cache
const Cache * cache() const
Obtain const access to the cache.
Definition: IdentifiableValueContainer.h:77
IdentifiableValueCache::retrieve
T retrieve(size_t i)
Retrieve the Value stored in that hash.
Definition: IdentifiableValueCache.h:49
IdentifiableValueContainer< uint64_t >::m_mask
std::set< size_t > m_mask
Definition: IdentifiableValueContainer.h:81
IdentifiableValueContainer< uint64_t >::m_cache
Cache * m_cache
Definition: IdentifiableValueContainer.h:82
IdentifiableValueCache::present
bool present(size_t i)
Returns true if the value is set to anything but the emptyValue.
Definition: IdentifiableValueCache.h:55
lumiFormat.i
int i
Definition: lumiFormat.py:92
IdentifiableValueContainer< uint64_t >::Cache
IdentifiableValueCache< uint64_t > Cache
Definition: IdentifiableValueContainer.h:25
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
IdentifiableValueContainer< uint64_t >::present
bool present(size_t i) const
Is the value for this has set and also accepted in the mask.
Definition: IdentifiableValueContainer.h:87
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
IdentifiableValueCache::maxSize
size_t maxSize() const
Return the maxSize of the collection.
Definition: IdentifiableValueCache.h:44
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
python.root_pickle.load
def load(f, use_proxy=1, key=None)
Definition: root_pickle.py:476