ATLAS Offline Software
Loading...
Searching...
No Matches
LArMCSym Class Reference

Helper class to handle z-phi symmetry of calibration constants in MC. More...

#include <LArMCSym.h>

Collaboration diagram for LArMCSym:

Public Member Functions

 LArMCSym ()=delete
 LArMCSym (const LArOnlineID_Base *onlId, const CaloCell_Base_ID *caloId, std::vector< HWIdentifier > &&oflHashtoSymOnl, std::vector< HWIdentifier > &&onlHashtoSymOnl, std::vector< HWIdentifier > &&symIds)
 Constructor.
HWIdentifier ZPhiSymOfl (const Identifier notSymOffId) const
 Find the symmetric HWID for an offline cell identifier.
HWIdentifier ZPhiSymOfl (const IdentifierHash notSymOffHash) const
 Find the symmetric HWID for an offline cell hash.
size_t ZPhiSymOflIndex (const Identifier notSymOffId) const
 Find the index in symIds() of the symmetric HWID for an offline cell identifier.
size_t ZPhiSymOflIndex (const IdentifierHash notSymOffHash) const
 Find the index in symIds() of the symmetric HWID for an offline cell hash.
HWIdentifier ZPhiSymOnl (const HWIdentifier notSymOnlId) const
 Find the symmetric HWID for an online channel identifier.
HWIdentifier ZPhiSymOnl (const IdentifierHash notSymOnlHash) const
 Find the symmetric HWID for an online channel hash.
size_t ZPhiSymOnlIndex (const HWIdentifier notSymOnlId) const
 Find the index in symIds() of the symmetric HWID for an online channel identifier.
size_t ZPhiSymOnlIndex (const IdentifierHash notSymOnlHash) const
 Find the index in symIds() of the symmetric HWID for an online channel hash.
const std::vector< HWIdentifier > & symIds () const
 Return the list of symmetric hashes.
std::pair< size_t, size_t > hashMax () const
 Return the hash-max as pair<onlHashMax,oflHashMax>

Static Public Attributes

static constexpr size_t NO_INDEX = static_cast<size_t> (-1)
 Return for an index if there's no valid symmetric identifier.

Private Types

typedef std::pair< Identifier32::value_type, uint32_t > IdPair_t

Private Member Functions

std::vector< IdPair_tinitIndices (const std::vector< HWIdentifier > &ids, const std::vector< HWIdentifier > &symIds) const

Private Attributes

const LArOnlineID_Basem_onlineID
const CaloCell_Base_IDm_caloCellID
const std::vector< IdPair_tm_oflHashtoSymOnl
const std::vector< IdPair_tm_onlHashtoSymOnl
const std::vector< HWIdentifierm_symIds

Detailed Description

Helper class to handle z-phi symmetry of calibration constants in MC.

Definition at line 18 of file LArMCSym.h.

Member Typedef Documentation

◆ IdPair_t

typedef std::pair<Identifier32::value_type, uint32_t> LArMCSym::IdPair_t
private

Definition at line 146 of file LArMCSym.h.

Constructor & Destructor Documentation

◆ LArMCSym() [1/2]

LArMCSym::LArMCSym ( )
delete

◆ LArMCSym() [2/2]

LArMCSym::LArMCSym ( const LArOnlineID_Base * onlId,
const CaloCell_Base_ID * caloId,
std::vector< HWIdentifier > && oflHashtoSymOnl,
std::vector< HWIdentifier > && onlHashtoSymOnl,
std::vector< HWIdentifier > && symIds )

Constructor.

onlId Online ID helper.

caloId Offline ID helper.

oflHashtoSymOnl Symmetric HWID corresponding to each offline hash.

onlHashtoSymOnl Symmetric HWID corresponding to each online hash.

symIds List of all symmetric HWIDs. MUST BE SORTED.

Definition at line 18 of file LArMCSym.cxx.

22 :
23 m_onlineID(onlId),
24 m_caloCellID(caloId),
25 m_oflHashtoSymOnl (initIndices (oflHashtoSymOnl, symIds)),
26 m_onlHashtoSymOnl (initIndices (onlHashtoSymOnl, symIds)),
27 m_symIds(std::move(symIds))
28{
29}
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition LArMCSym.h:132
const LArOnlineID_Base * m_onlineID
Definition LArMCSym.h:152
const std::vector< IdPair_t > m_oflHashtoSymOnl
Definition LArMCSym.h:154
const std::vector< HWIdentifier > m_symIds
Definition LArMCSym.h:156
std::vector< IdPair_t > initIndices(const std::vector< HWIdentifier > &ids, const std::vector< HWIdentifier > &symIds) const
Definition LArMCSym.cxx:33
const std::vector< IdPair_t > m_onlHashtoSymOnl
Definition LArMCSym.h:155
const CaloCell_Base_ID * m_caloCellID
Definition LArMCSym.h:153

Member Function Documentation

◆ hashMax()

std::pair< size_t, size_t > LArMCSym::hashMax ( ) const
inline

Return the hash-max as pair<onlHashMax,oflHashMax>

Definition at line 139 of file LArMCSym.h.

139 {
140 return std::make_pair(m_onlHashtoSymOnl.size(),m_oflHashtoSymOnl.size());
141 }

◆ initIndices()

std::vector< LArMCSym::IdPair_t > LArMCSym::initIndices ( const std::vector< HWIdentifier > & ids,
const std::vector< HWIdentifier > & symIds ) const
private

Definition at line 33 of file LArMCSym.cxx.

35{
36 std::vector<IdPair_t> out;
37 out.reserve (ids.size());
38 HWIdentifier last_id;
39 size_t idx = NO_INDEX;
40 for (const HWIdentifier& id : ids) {
41 if (!id.is_valid()) {
42 idx = NO_INDEX;
43 }
44 else if (id != last_id) {
45 if (idx < symIds.size()-1 && symIds[idx+1] == id) {
46 ++idx;
47 }
48 else {
49 auto it = std::lower_bound (symIds.begin(), symIds.end(), id);
50 if (it == symIds.end() || *it != id) std::abort();
51 idx = it - symIds.begin();
52 }
53 }
54 out.emplace_back (id.get_identifier32().get_compact(), idx);
55 last_id = id;
56 }
57
58 return out;
59}
static constexpr size_t NO_INDEX
Return for an index if there's no valid symmetric identifier.
Definition LArMCSym.h:41

◆ symIds()

const std::vector< HWIdentifier > & LArMCSym::symIds ( ) const
inline

Return the list of symmetric hashes.

Definition at line 132 of file LArMCSym.h.

132 {
133 return m_symIds;
134 }

◆ ZPhiSymOfl() [1/2]

HWIdentifier LArMCSym::ZPhiSymOfl ( const Identifier notSymOffId) const
inline

Find the symmetric HWID for an offline cell identifier.

May return an invalid identifier.

Definition at line 48 of file LArMCSym.h.

48 {
49 if (m_caloCellID->is_tile(notSymOffId)) return HWIdentifier();
50 const IdentifierHash h=m_caloCellID->calo_cell_hash(notSymOffId);
51 return ZPhiSymOfl(h);
52 }
HWIdentifier ZPhiSymOfl(const Identifier notSymOffId) const
Find the symmetric HWID for an offline cell identifier.
Definition LArMCSym.h:48

◆ ZPhiSymOfl() [2/2]

HWIdentifier LArMCSym::ZPhiSymOfl ( const IdentifierHash notSymOffHash) const
inline

Find the symmetric HWID for an offline cell hash.

May return an invalid identifier.

Definition at line 59 of file LArMCSym.h.

59 {
60 assert(notSymOffHash < m_oflHashtoSymOnl.size());
61 return HWIdentifier (m_oflHashtoSymOnl[notSymOffHash].first);
62 }

◆ ZPhiSymOflIndex() [1/2]

size_t LArMCSym::ZPhiSymOflIndex ( const Identifier notSymOffId) const
inline

Find the index in symIds() of the symmetric HWID for an offline cell identifier.

Returns NO_INDEX if no symmetric identifier is defined.

Definition at line 70 of file LArMCSym.h.

70 {
71 if (m_caloCellID->is_tile(notSymOffId)) return NO_INDEX;
72 const IdentifierHash h=m_caloCellID->calo_cell_hash(notSymOffId);
73 return ZPhiSymOflIndex(h);
74 }
size_t ZPhiSymOflIndex(const Identifier notSymOffId) const
Find the index in symIds() of the symmetric HWID for an offline cell identifier.
Definition LArMCSym.h:70

◆ ZPhiSymOflIndex() [2/2]

size_t LArMCSym::ZPhiSymOflIndex ( const IdentifierHash notSymOffHash) const
inline

Find the index in symIds() of the symmetric HWID for an offline cell hash.

Returns NO_INDEX if no symmetric identifier is defined.

Definition at line 81 of file LArMCSym.h.

81 {
82 assert(notSymOffHash < m_oflHashtoSymOnl.size());
83 return m_oflHashtoSymOnl[notSymOffHash].second;
84 }

◆ ZPhiSymOnl() [1/2]

HWIdentifier LArMCSym::ZPhiSymOnl ( const HWIdentifier notSymOnlId) const
inline

Find the symmetric HWID for an online channel identifier.

May return an invalid identifier.

Definition at line 91 of file LArMCSym.h.

91 {
92 const IdentifierHash h=m_onlineID->channel_Hash(notSymOnlId);
93 return ZPhiSymOnl(h);
94 }
HWIdentifier ZPhiSymOnl(const HWIdentifier notSymOnlId) const
Find the symmetric HWID for an online channel identifier.
Definition LArMCSym.h:91

◆ ZPhiSymOnl() [2/2]

HWIdentifier LArMCSym::ZPhiSymOnl ( const IdentifierHash notSymOnlHash) const
inline

Find the symmetric HWID for an online channel hash.

May return an invalid identifier.

Definition at line 101 of file LArMCSym.h.

101 {
102 assert(notSymOnlHash < m_onlHashtoSymOnl.size());
103 return HWIdentifier (m_onlHashtoSymOnl[notSymOnlHash].first);
104 }

◆ ZPhiSymOnlIndex() [1/2]

size_t LArMCSym::ZPhiSymOnlIndex ( const HWIdentifier notSymOnlId) const
inline

Find the index in symIds() of the symmetric HWID for an online channel identifier.

Returns NO_INDEX if no symmetric identifier is defined.

Definition at line 112 of file LArMCSym.h.

112 {
113 const IdentifierHash h=m_onlineID->channel_Hash(notSymOnlId);
114 return ZPhiSymOnlIndex(h);
115 }
size_t ZPhiSymOnlIndex(const HWIdentifier notSymOnlId) const
Find the index in symIds() of the symmetric HWID for an online channel identifier.
Definition LArMCSym.h:112

◆ ZPhiSymOnlIndex() [2/2]

size_t LArMCSym::ZPhiSymOnlIndex ( const IdentifierHash notSymOnlHash) const
inline

Find the index in symIds() of the symmetric HWID for an online channel hash.

Returns NO_INDEX if no symmetric identifier is defined.

Definition at line 123 of file LArMCSym.h.

123 {
124 assert(notSymOnlHash < m_onlHashtoSymOnl.size());
125 return m_onlHashtoSymOnl[notSymOnlHash].second;
126 }

Member Data Documentation

◆ m_caloCellID

const CaloCell_Base_ID* LArMCSym::m_caloCellID
private

Definition at line 153 of file LArMCSym.h.

◆ m_oflHashtoSymOnl

const std::vector<IdPair_t> LArMCSym::m_oflHashtoSymOnl
private

Definition at line 154 of file LArMCSym.h.

◆ m_onlHashtoSymOnl

const std::vector<IdPair_t> LArMCSym::m_onlHashtoSymOnl
private

Definition at line 155 of file LArMCSym.h.

◆ m_onlineID

const LArOnlineID_Base* LArMCSym::m_onlineID
private

Definition at line 152 of file LArMCSym.h.

◆ m_symIds

const std::vector<HWIdentifier> LArMCSym::m_symIds
private

Definition at line 156 of file LArMCSym.h.

◆ NO_INDEX

size_t LArMCSym::NO_INDEX = static_cast<size_t> (-1)
staticconstexpr

Return for an index if there's no valid symmetric identifier.

Definition at line 41 of file LArMCSym.h.


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