ATLAS Offline Software
Classes | 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 >:

Classes

struct  ref_trait
 Type trait to find the proper refernce type for the lambda function access. More...
 

Public Types

using value_type = typename HitObjContainer::value_type
 
using element_type = typename std::remove_pointer_t< value_type >
 
using const_ref = ref_trait< value_type >::type
 
using ViewMode = ChamberView::Mode
 

Public Member Functions

template<typename HitObjType >
 requires (std::is_pointer_v< HitObjType >) struct ref_trait< HitObjType >
 Branch if the input value type is a pointer. More...
 
template<typename HitObjType >
 requires (!std::is_pointer_v< HitObjType >) struct ref_trait< HitObjType >
 Branch if the input value is an object. More...
 
 ChamberViewer (const HitObjContainer &container) noexcept
 Standard constructor. More...
 
 ChamberViewer (const HitObjContainer &container, const Muon::IMuonIdHelperSvc *idHelperSvc, const ViewMode mode=ViewMode::DetElement) noexcept
 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...
 
HitObjContainer::const_iterator begin () const noexcept
 Begin iterator of the current chamber view. More...
 
HitObjContainer::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...
 
HitObjContainer::const_iterator::reference 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)
 Loads the view matching the parsed identifier. More...
 
bool loadView (const IdentifierHash &idHash)
 Loads the view matching the parsed IdentifierHash. More...
 
bool loadView (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}
 
DetectorIDHashType m_currentHash {0}
 
HitObjContainer::const_iterator m_end {m_container.begin()}
 
HitObjContainer::const_iterator m_begin {m_container.begin()}
 

Detailed Description

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

Definition at line 65 of file ChamberViewer.h.

Member Typedef Documentation

◆ const_ref

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
using xAOD::ChamberViewer< HitObjContainer >::const_ref = ref_trait<value_type>::type

Definition at line 87 of file ChamberViewer.h.

◆ element_type

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

Definition at line 68 of file ChamberViewer.h.

◆ value_type

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

Definition at line 67 of file ChamberViewer.h.

◆ ViewMode

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

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

92  :
93  m_container{container} {
94  static_assert(ChamberViewConcepts::hasIdentifyHash<element_type>::value, "Object needs to provide identifierHash" );
95  next();
96  }

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

101  :
102  m_container{container},
103  m_idHelperSvc{idHelperSvc},
104  m_mode{mode} {
105  static_assert(ChamberViewConcepts::hasIdentify<element_type>::value, "Object needs to provide identify()" );
106  next();
107  }

◆ 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>
HitObjContainer::const_iterator::reference xAOD::ChamberViewer< HitObjContainer >::at ( const std::size_t  idx) const
inline

Returns the i-the measurement from the current chamber.

Definition at line 129 of file ChamberViewer.h.

129  {
130  if (idx >= size()) {
131  THROW_EXCEPTION("Invalid index given "<<typeid(value_type).name()<<" Size: "<<size()<<", requested: "<<idx);
132  }
133  return (*m_begin +idx);
134  }

◆ begin()

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

Begin iterator of the current chamber view.

Definition at line 117 of file ChamberViewer.h.

117  {
118  return m_begin;
119  }

◆ end()

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

End iterator of the current chamber view.

Definition at line 121 of file ChamberViewer.h.

121  {
122  return m_end;
123  }

◆ idHash()

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

Returns the IdentifierHash from an Identifier.

Definition at line 198 of file ChamberViewer.h.

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

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

162  {
163  static_assert(ChamberViewConcepts::hasIdentify<element_type>::value, "Object needs to provide identify()" );
164  const IdentifierHash detId = idHash(chamberId);
165  m_begin = std::ranges::find_if(m_container,[this,&detId](const_ref meas) {
166  return idHash(meas->identify()) == detId;
167  });
168  m_end = std::find_if(m_begin, m_container.end(),[this,&detId](const_ref meas) {
169  return idHash(meas->identify()) != detId;
170  });
171  return m_begin != m_end;
172  }

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

176  {
177  static_assert(ChamberViewConcepts::hasIdentifyHash<element_type>::value, "Object needs to provide identify()" );
178  m_begin = std::ranges::find_if(m_container,[&idHash](const_ref meas) {
179  return meas->identifierHash() == idHash;
180  });
181  m_end = std::find_if(m_begin, m_container.end(),[&idHash](const_ref meas) {
182  return meas->identifierHash() != idHash;
183  });
184  return m_begin != m_end;
185  }

◆ loadView() [3/3]

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

Definition at line 187 of file ChamberViewer.h.

187  {
188  m_begin = std::ranges::find_if(m_container, selector);
189  m_end = std::find_if(m_begin, m_container.end(),
190  [&selector](const_ref meas) {
191  return !selector(meas);
192  });
193  return m_begin != m_end;
194  }

◆ next()

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

137  {
138  if (m_end == m_container.end()) {
139  return false;
140  }
141  m_begin = m_end;
143  m_currentHash = (*m_end)->identifierHash();
144  m_end = std::find_if(m_begin, m_container.end(),
145  [this](const_ref meas){
146  return meas->identifierHash() != m_currentHash;
147  });
148  } else {
149  m_currentHash = idHash((*m_end)->identify());
150  m_end = std::find_if(m_begin, m_container.end(),
151  [this](const_ref meas){
152  return idHash(meas->identify()) != m_currentHash;
153  });
154  }
155  if (m_begin == m_end) return next(); // veto empty views
156  return true;
157  }

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

◆ requires() [1/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
template<typename HitObjType >
xAOD::ChamberViewer< HitObjContainer >::requires ( !std::is_pointer_v< HitObjType >  )
inline

Branch if the input value is an object.

Const type

Const reference type

Definition at line 81 of file ChamberViewer.h.

81  {
83  using const_type = typename std::add_const_t<HitObjType>;
86  };

◆ requires() [2/2]

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
template<typename HitObjType >
xAOD::ChamberViewer< HitObjContainer >::requires ( std::is_pointer_v< HitObjType >  )
inline

Branch if the input value type is a pointer.

Convert to the underlying object itself

Make the object to be const

Declare the type to be a const pointer

Definition at line 72 of file ChamberViewer.h.

72  {
74  using element_type = typename std::remove_pointer_t<HitObjType>;
76  using const_type = typename std::add_const_t<element_type>;
78  using type = std::add_pointer_t<const_type>;
79  };

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

125  {
126  return std::distance(m_begin, m_end);
127  }

Member Data Documentation

◆ m_begin

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

Definition at line 207 of file ChamberViewer.h.

◆ m_container

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

Definition at line 202 of file ChamberViewer.h.

◆ m_currentHash

template<ChamberViewConcepts::ContainerConcept HitObjContainer>
DetectorIDHashType xAOD::ChamberViewer< HitObjContainer >::m_currentHash {0}
private

Definition at line 205 of file ChamberViewer.h.

◆ m_end

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

Definition at line 206 of file ChamberViewer.h.

◆ m_idHelperSvc

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

Definition at line 203 of file ChamberViewer.h.

◆ m_mode

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

Definition at line 204 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:125
xAOD::ChamberViewer::next
bool next() noexcept
Loads the hits from the next chamber.
Definition: ChamberViewer.h:137
xAOD::ChamberViewer::m_end
HitObjContainer::const_iterator m_end
Definition: ChamberViewer.h:206
athena.value
value
Definition: athena.py:124
Muon::IMuonIdHelperSvc::moduleHash
virtual IdentifierHash moduleHash(const Identifier &id) const =0
Returns the module hash associated to an Identifier.
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
xAOD::ChamberViewer::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: ChamberViewer.h:203
xAOD::ChamberViewer::m_currentHash
DetectorIDHashType m_currentHash
Definition: ChamberViewer.h:205
Preparation.mode
mode
Definition: Preparation.py:94
xAOD::ChamberViewer::m_begin
HitObjContainer::const_iterator m_begin
Definition: ChamberViewer.h:207
xAOD::ChamberViewer::element_type
typename std::remove_pointer_t< value_type > element_type
Definition: ChamberViewer.h:68
xAOD::ChamberViewer::idHash
IdentifierHash idHash(const Identifier &id) const
Returns the IdentifierHash from an Identifier.
Definition: ChamberViewer.h:198
xAOD::ChamberViewer::m_mode
const ViewMode m_mode
Definition: ChamberViewer.h:204
xAOD::ChamberViewer::const_ref
ref_trait< value_type >::type const_ref
Definition: ChamberViewer.h:87
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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
value_type
Definition: EDM_MasterSearch.h:11
xAOD::ChamberViewer::m_container
const HitObjContainer & m_container
Definition: ChamberViewer.h:202
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
Muon::IMuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.