ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
xAOD::ChamberViewer< HitObjContainer > Class Template Reference

#include <ChamberViewer.h>

Collaboration diagram for xAOD::ChamberViewer< HitObjContainer >:

Public Types

using value_type = typename HitObjContainer::value_type
 
using element_type = typename Acts::RemovePointer_t< value_type >
 
using const_iterator = typename HitObjContainer::const_iterator
 
using const_ref = typename const_iterator::reference
 
using ViewMode = ChamberView::Mode
 

Public Member Functions

 ChamberViewer (const HitObjContainer &container) noexcept requires(ChamberViewConcepts
 Standard constructor. More...
 
 ChamberViewer (const HitObjContainer &container, const Muon::IMuonIdHelperSvc *idHelperSvc, const ViewMode mode=ViewMode::DetElement) noexcept requires(ChamberViewConcepts
 Standard constructor. More...
 
 ChamberViewer (const ChamberViewer &other)=delete
 Delete the copy constructor. More...
 
ChamberVieweroperator= (const ChamberViewer &other)=delete
 Delete the copy assignment operator. More...
 
 ChamberViewer (ChamberViewer &&other)=default
 Standard move constructor. More...
 
ChamberVieweroperator= (ChamberViewer &&other)=default
 Standard move operator. More...
 
const_iterator begin () const noexcept
 Begin iterator of the current chamber view. More...
 
const_iterator end () const noexcept
 End iterator of the current chamber view. More...
 
std::size_t size () const noexcept
 Returns how many hits are in the current chamber. More...
 
const_ref at (const std::size_t idx) const
 Returns the i-the measurement from the current chamber. More...
 
bool next () noexcept
 Loads the hits from the next chamber. More...
 
bool loadView (const Identifier &chamberId) requires(ChamberViewConcepts
 Loads the view matching the parsed identifier. More...
 
bool loadView (const IdentifierHash &idHash) requires(ChamberViewConcepts
 Loads the view matching the parsed IdentifierHash. More...
 
bool loadView (std::function< bool(const_ref)> selector)
 Loads the view range based on a generic selector function. More...
 
bool next (std::function< bool(const_ref)> selector)
 

Private Member Functions

IdentifierHash idHash (const Identifier &id) const
 Returns the IdentifierHash from an Identifier. More...
 

Private Attributes

const HitObjContainer & m_container
 
const Muon::IMuonIdHelperSvcm_idHelperSvc {nullptr}
 
const ViewMode m_mode {ViewMode::DetElement}
 
const_iterator m_end {m_container.begin()}
 
const_iterator m_begin {m_container.begin()}
 

Detailed Description

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
class xAOD::ChamberViewer< HitObjContainer >

Definition at line 59 of file ChamberViewer.h.

Member Typedef Documentation

◆ const_iterator

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::const_iterator = typename HitObjContainer::const_iterator

Definition at line 64 of file ChamberViewer.h.

◆ const_ref

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::const_ref = typename const_iterator::reference

Definition at line 65 of file ChamberViewer.h.

◆ element_type

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::element_type = typename Acts::RemovePointer_t<value_type>

Definition at line 62 of file ChamberViewer.h.

◆ value_type

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::value_type = typename HitObjContainer::value_type

Definition at line 61 of file ChamberViewer.h.

◆ ViewMode

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::ViewMode = ChamberView::Mode

Definition at line 66 of file ChamberViewer.h.

Constructor & Destructor Documentation

◆ ChamberViewer() [1/4]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
xAOD::ChamberViewer< HitObjContainer >::ChamberViewer ( const HitObjContainer &  container)
inlinenoexcept

Standard constructor.

Parameters
containerUncalibratedMeasurementContainer from which the views per chamber shall be generated

Definition at line 70 of file ChamberViewer.h.

71  :
72  m_container{container} {
73  next();
74  }

◆ ChamberViewer() [2/4]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
xAOD::ChamberViewer< HitObjContainer >::ChamberViewer ( const HitObjContainer &  container,
const Muon::IMuonIdHelperSvc idHelperSvc,
const ViewMode  mode = ViewMode::DetElement 
)
inlinenoexcept

Standard constructor.

Parameters
containerUncalibratedMeasurementContainer from which the views per chamber shall be generated

Definition at line 77 of file ChamberViewer.h.

80  :
81  m_container{container},
82  m_idHelperSvc{idHelperSvc},
83  m_mode{mode} {
84  next();
85  }

◆ ChamberViewer() [3/4]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
xAOD::ChamberViewer< HitObjContainer >::ChamberViewer ( const ChamberViewer< HitObjContainer > &  other)
delete

Delete the copy constructor.

◆ ChamberViewer() [4/4]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
xAOD::ChamberViewer< HitObjContainer >::ChamberViewer ( ChamberViewer< HitObjContainer > &&  other)
default

Standard move constructor.

Member Function Documentation

◆ at()

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const_ref xAOD::ChamberViewer< HitObjContainer >::at ( const std::size_t  idx) const
inline

Returns the i-the measurement from the current chamber.

Definition at line 107 of file ChamberViewer.h.

107  {
108  if (idx >= size()) {
109  throw std::domain_error(std::format("Invalid index given {:}. size: {:}, requested:{:} ",
110  typeid(const_ref).name(), size(), idx));
111  }
112  return (*m_begin +idx);
113  }

◆ begin()

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const_iterator xAOD::ChamberViewer< HitObjContainer >::begin ( ) const
inlinenoexcept

Begin iterator of the current chamber view.

Definition at line 95 of file ChamberViewer.h.

95  {
96  return m_begin;
97  }

◆ end()

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const_iterator xAOD::ChamberViewer< HitObjContainer >::end ( ) const
inlinenoexcept

End iterator of the current chamber view.

Definition at line 99 of file ChamberViewer.h.

99  {
100  return m_end;
101  }

◆ idHash()

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
IdentifierHash xAOD::ChamberViewer< HitObjContainer >::idHash ( const Identifier id) const
inlineprivate

Returns the IdentifierHash from an Identifier.

Definition at line 197 of file ChamberViewer.h.

197  {
198  return m_mode == ViewMode::DetElement ? m_idHelperSvc->detElementHash(id)
199  : m_idHelperSvc->moduleHash(id);
200  }

◆ loadView() [1/3]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
bool xAOD::ChamberViewer< HitObjContainer >::loadView ( const Identifier chamberId)
inline

Loads the view matching the parsed identifier.

I.e. the collection of hits sharing the same IdentifierHash. Returns whether the view is empty or not

Parameters
chamberIdIdentifier from the chamber / detElement to consider

Definition at line 143 of file ChamberViewer.h.

144  {
145 
146  const IdentifierHash detId = idHash(chamberId);
147  m_begin = std::ranges::find_if(m_container,[this,&detId](const_ref meas) {
148  return idHash(meas->identify()) == detId;
149  });
150  m_end = std::find_if(m_begin, m_container.end(),[this,&detId](const_ref meas) {
151  return idHash(meas->identify()) != detId;
152  });
153  return m_begin != m_end;
154  }

◆ loadView() [2/3]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
bool xAOD::ChamberViewer< HitObjContainer >::loadView ( const IdentifierHash idHash)
inline

Loads the view matching the parsed IdentifierHash.

I.e. either the detector element hash or the chamber module hash. There's no cross-check whether the interpretion of both hashes is the same

Parameters
idHashIdentifierHash to search

Definition at line 158 of file ChamberViewer.h.

159  {
160  m_begin = std::ranges::find_if(m_container,[&idHash](const_ref meas) {
161  return meas->identifierHash() == idHash;
162  });
163  m_end = std::find_if(m_begin, m_container.end(),[&idHash](const_ref meas) {
164  return meas->identifierHash() != idHash;
165  });
166  return m_begin != m_end;
167  }

◆ loadView() [3/3]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
bool xAOD::ChamberViewer< HitObjContainer >::loadView ( std::function< bool(const_ref)>  selector)
inline

Loads the view range based on a generic selector function.

Parameters
selectorGeneric selector to base the range on

Definition at line 170 of file ChamberViewer.h.

170  {
171  m_begin = std::ranges::find_if(m_container, selector);
172  m_end = std::find_if(m_begin, m_container.end(),
173  [&selector](const_ref meas) {
174  return !selector(meas);
175  });
176  return m_begin != m_end;
177  }

◆ next() [1/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
bool xAOD::ChamberViewer< HitObjContainer >::next ( )
inlinenoexcept

Loads the hits from the next chamber.

Returns false if all chambers have been traversed.

Definition at line 116 of file ChamberViewer.h.

116  {
117  if (m_end == m_container.end()) {
118  return false;
119  }
120  m_begin = m_end;
121  if constexpr (ChamberViewConcepts::identifierHashConcept<element_type>) {
122  const IdentifierHash currentHash = (*m_end)->identifierHash();
123  m_end = std::find_if(m_begin, m_container.end(),
124  [&currentHash](const_ref meas){
125  return meas->identifierHash() != currentHash;
126  });
127  } else {
128  const IdentifierHash currentHash = idHash((*m_end)->identify());
129  m_end = std::find_if(m_begin, m_container.end(),
130  [this,&currentHash](const_ref meas){
131  return idHash(meas->identify()) != currentHash;
132  });
133  }
134  if (m_begin == m_end) {
135  return next(); // veto empty views
136  }
137  return true;
138  }

◆ next() [2/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
bool xAOD::ChamberViewer< HitObjContainer >::next ( std::function< bool(const_ref)>  selector)
inline

Check whether a new element is available

Definition at line 178 of file ChamberViewer.h.

178  {
179  if (m_end == m_container.end()) {
180  return false;
181  }
183  const_iterator nextBegin = std::ranges::find_if(m_end, m_container.end(), selector);
184  if (nextBegin == m_container.end()) {
185  return false;
186  }
187  m_begin = nextBegin;
188  m_end = std::find_if(m_begin, m_container.end(),
189  [&selector](const_ref meas) {
190  return !selector(meas);
191  });
192  return true;
193  }

◆ operator=() [1/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
ChamberViewer& xAOD::ChamberViewer< HitObjContainer >::operator= ( ChamberViewer< HitObjContainer > &&  other)
default

Standard move operator.

◆ operator=() [2/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
ChamberViewer& xAOD::ChamberViewer< HitObjContainer >::operator= ( const ChamberViewer< HitObjContainer > &  other)
delete

Delete the copy assignment operator.

◆ size()

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
std::size_t xAOD::ChamberViewer< HitObjContainer >::size ( ) const
inlinenoexcept

Returns how many hits are in the current chamber.

Definition at line 103 of file ChamberViewer.h.

103  {
104  return std::distance(m_begin, m_end);
105  }

Member Data Documentation

◆ m_begin

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const_iterator xAOD::ChamberViewer< HitObjContainer >::m_begin {m_container.begin()}
private

Definition at line 205 of file ChamberViewer.h.

◆ m_container

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const HitObjContainer& xAOD::ChamberViewer< HitObjContainer >::m_container
private

Definition at line 201 of file ChamberViewer.h.

◆ m_end

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const_iterator xAOD::ChamberViewer< HitObjContainer >::m_end {m_container.begin()}
private

Definition at line 204 of file ChamberViewer.h.

◆ m_idHelperSvc

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const Muon::IMuonIdHelperSvc* xAOD::ChamberViewer< HitObjContainer >::m_idHelperSvc {nullptr}
private

Definition at line 202 of file ChamberViewer.h.

◆ m_mode

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
const ViewMode xAOD::ChamberViewer< HitObjContainer >::m_mode {ViewMode::DetElement}
private

Definition at line 203 of file ChamberViewer.h.


The documentation for this class was generated from the following file:
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::ChamberViewer::size
std::size_t size() const noexcept
Returns how many hits are in the current chamber.
Definition: ChamberViewer.h:103
vtune_athena.format
format
Definition: vtune_athena.py:14
xAOD::ChamberViewer::next
bool next() noexcept
Loads the hits from the next chamber.
Definition: ChamberViewer.h:116
Muon::IMuonIdHelperSvc::moduleHash
virtual IdentifierHash moduleHash(const Identifier &id) const =0
Returns the module hash associated to an Identifier.
xAOD::ChamberViewer::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: ChamberViewer.h:202
xAOD::ChamberViewer::const_iterator
typename HitObjContainer::const_iterator const_iterator
Definition: ChamberViewer.h:64
Preparation.mode
mode
Definition: Preparation.py:107
xAOD::ChamberViewer::const_ref
typename const_iterator::reference const_ref
Definition: ChamberViewer.h:65
xAOD::ChamberViewer::m_end
const_iterator m_end
Definition: ChamberViewer.h:204
xAOD::ChamberViewer::idHash
IdentifierHash idHash(const Identifier &id) const
Returns the IdentifierHash from an Identifier.
Definition: ChamberViewer.h:197
xAOD::ChamberViewer::m_mode
const ViewMode m_mode
Definition: ChamberViewer.h:203
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:610
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
xAOD::ChamberViewer::m_container
const HitObjContainer & m_container
Definition: ChamberViewer.h:201
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
xAOD::ChamberViewer::m_begin
const_iterator m_begin
Definition: ChamberViewer.h:205
Muon::IMuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.