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

Private Member Functions

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

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 :
73 next();
74 }
bool next() noexcept
Loads the hits from the next chamber.
const HitObjContainer & m_container

◆ 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 :
83 m_mode{mode} {
84 next();
85 }
const Muon::IMuonIdHelperSvc * m_idHelperSvc
const ViewMode m_mode

◆ 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 }
const_iterator m_begin
typename const_iterator::reference const_ref
std::size_t size() const noexcept
Returns how many hits are in the current chamber.

◆ 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 }
const_iterator m_end

◆ 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
148 return idHash(meas->identify()) == detId;
149 });
151 return idHash(meas->identify()) != detId;
152 });
153 return m_begin != m_end;
154 }
IdentifierHash idHash(const Identifier &id) const
Returns the IdentifierHash from an Identifier.

◆ 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 {
161 return meas->identifierHash() == idHash;
162 });
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 {
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;
122 const IdentifierHash currentHash = (*m_end)->identifierHash();
125 return meas->identifierHash() != currentHash;
126 });
127 } else {
128 const IdentifierHash currentHash = idHash((*m_end)->identify());
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 }
184 if (nextBegin == m_container.end()) {
185 return false;
186 }
190 return !selector(meas);
191 });
192 return true;
193 }
typename HitObjContainer::const_iterator const_iterator

◆ 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.

205{m_container.begin()};

◆ 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.

204{m_container.begin()};

◆ m_idHelperSvc

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

Definition at line 202 of file ChamberViewer.h.

202{nullptr};

◆ 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: