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)
 Standard constructor.
 ChamberViewer (const HitObjContainer &container, const Muon::IMuonIdHelperSvc *idHelperSvc, const ViewMode mode=ViewMode::DetElement)
 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 ()
 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 63 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 68 of file ChamberViewer.h.

◆ const_ref

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

Definition at line 69 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 66 of file ChamberViewer.h.

◆ value_type

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

Definition at line 65 of file ChamberViewer.h.

◆ ViewMode

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

Definition at line 70 of file ChamberViewer.h.

Constructor & Destructor Documentation

◆ ChamberViewer() [1/4]

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

Standard constructor.

Parameters
containerUncalibratedMeasurementContainer from which the views per chamber shall be generated

Definition at line 74 of file ChamberViewer.h.

75 :
77 next();
78 }
bool next()
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 )
inline

Standard constructor.

Parameters
containerUncalibratedMeasurementContainer from which the views per chamber shall be generated

Definition at line 81 of file ChamberViewer.h.

84 :
87 m_mode{mode} {
88 next();
89 }
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 111 of file ChamberViewer.h.

111 {
112 if (idx >= size()) {
113 throw std::domain_error(std::format("Invalid index given {:}. size: {:}, requested:{:} ",
114 typeid(const_ref).name(), size(), idx));
115 }
116 return *(m_begin +idx);
117 }
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 99 of file ChamberViewer.h.

99 {
100 return m_begin;
101 }

◆ end()

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

End iterator of the current chamber view.

Definition at line 103 of file ChamberViewer.h.

103 {
104 return m_end;
105 }
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 201 of file ChamberViewer.h.

201 {
202 return m_mode == ViewMode::DetElement ? m_idHelperSvc->detElementHash(id)
203 : m_idHelperSvc->moduleHash(id);
204 }

◆ 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 147 of file ChamberViewer.h.

148 {
149
152 return idHash(meas->identify()) == detId;
153 });
155 return idHash(meas->identify()) != detId;
156 });
157 return m_begin != m_end;
158 }
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 162 of file ChamberViewer.h.

163 {
165 return meas->identifierHash() == idHash;
166 });
168 return meas->identifierHash() != idHash;
169 });
170 return m_begin != m_end;
171 }

◆ 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 174 of file ChamberViewer.h.

174 {
178 return !selector(meas);
179 });
180 return m_begin != m_end;
181 }

◆ next() [1/2]

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

Loads the hits from the next chamber.

Returns false if all chambers have been traversed.

Definition at line 120 of file ChamberViewer.h.

120 {
121 if (m_end == m_container.end()) {
122 return false;
123 }
124 m_begin = m_end;
126 const IdentifierHash currentHash = (*m_end)->identifierHash();
129 return meas->identifierHash() != currentHash;
130 });
131 } else {
132 const IdentifierHash currentHash = idHash((*m_end)->identify());
134 [this,&currentHash](const_ref meas){
135 return idHash(meas->identify()) != currentHash;
136 });
137 }
138 if (m_begin == m_end) {
139 return next(); // veto empty views
140 }
141 return true;
142 }

◆ 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 182 of file ChamberViewer.h.

182 {
183 if (m_end == m_container.end()) {
184 return false;
185 }
188 if (nextBegin == m_container.end()) {
189 return false;
190 }
194 return !selector(meas);
195 });
196 return true;
197 }
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 107 of file ChamberViewer.h.

107 {
108 return std::distance(m_begin, m_end);
109 }

Member Data Documentation

◆ m_begin

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

Definition at line 209 of file ChamberViewer.h.

209{m_container.begin()};

◆ m_container

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

Definition at line 205 of file ChamberViewer.h.

◆ m_end

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

Definition at line 208 of file ChamberViewer.h.

208{m_container.begin()};

◆ m_idHelperSvc

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

Definition at line 206 of file ChamberViewer.h.

206{nullptr};

◆ m_mode

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

Definition at line 207 of file ChamberViewer.h.


The documentation for this class was generated from the following file: