ATLAS Offline Software
Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
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 *onlId, const CaloCell_ID *caloId, std::vector< HWIdentifier > &&oflHashtoSymOnl, std::vector< HWIdentifier > &&onlHashtoSymOnl, std::vector< HWIdentifier > &&symIds)
 Constructor. More...
 
HWIdentifier ZPhiSymOfl (const Identifier notSymOffId) const
 Find the symmetric HWID for an offline cell identifier. More...
 
HWIdentifier ZPhiSymOfl (const IdentifierHash notSymOffHash) const
 Find the symmetric HWID for an offline cell hash. More...
 
size_t ZPhiSymOflIndex (const Identifier notSymOffId) const
 Find the index in symIds() of the symmetric HWID for an offline cell identifier. More...
 
size_t ZPhiSymOflIndex (const IdentifierHash notSymOffHash) const
 Find the index in symIds() of the symmetric HWID for an offline cell hash. More...
 
HWIdentifier ZPhiSymOnl (const HWIdentifier notSymOnlId) const
 Find the symmetric HWID for an online channel identifier. More...
 
HWIdentifier ZPhiSymOnl (const IdentifierHash notSymOnlHash) const
 Find the symmetric HWID for an online channel hash. More...
 
size_t ZPhiSymOnlIndex (const HWIdentifier notSymOnlId) const
 Find the index in symIds() of the symmetric HWID for an online channel identifier. More...
 
size_t ZPhiSymOnlIndex (const IdentifierHash notSymOnlHash) const
 Find the index in symIds() of the symmetric HWID for an online channel hash. More...
 
const std::vector< HWIdentifier > & symIds () const
 Return the list of symmetric hashes. More...
 
std::pair< size_t, size_t > hashMax () const
 Return the hash-max as pair<onlHashMax,oflHashMax> More...
 

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

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 LArOnlineIDm_onlineID
 
const CaloCell_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 onlId,
const CaloCell_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)),
28 {
29 }

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 }

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

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

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

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

◆ 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_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* 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

constexpr 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:
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1636
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
LArMCSym::ZPhiSymOnlIndex
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
LArMCSym::m_symIds
const std::vector< HWIdentifier > m_symIds
Definition: LArMCSym.h:156
skel.it
it
Definition: skel.GENtoEVGEN.py:423
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
HWIdentifier
Definition: HWIdentifier.h:13
LArMCSym::ZPhiSymOfl
HWIdentifier ZPhiSymOfl(const Identifier notSymOffId) const
Find the symmetric HWID for an offline cell identifier.
Definition: LArMCSym.h:48
LArMCSym::ZPhiSymOnl
HWIdentifier ZPhiSymOnl(const HWIdentifier notSymOnlId) const
Find the symmetric HWID for an online channel identifier.
Definition: LArMCSym.h:91
LArMCSym::m_oflHashtoSymOnl
const std::vector< IdPair_t > m_oflHashtoSymOnl
Definition: LArMCSym.h:154
LArMCSym::m_onlHashtoSymOnl
const std::vector< IdPair_t > m_onlHashtoSymOnl
Definition: LArMCSym.h:155
LArMCSym::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArMCSym.h:152
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
LArMCSym::m_caloCellID
const CaloCell_ID * m_caloCellID
Definition: LArMCSym.h:153
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
h
LArMCSym::NO_INDEX
static constexpr size_t NO_INDEX
Return for an index if there's no valid symmetric identifier.
Definition: LArMCSym.h:41
DeMoScan.first
bool first
Definition: DeMoScan.py:534
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LArMCSym::ZPhiSymOflIndex
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
LArMCSym::symIds
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition: LArMCSym.h:132
LArMCSym::initIndices
std::vector< IdPair_t > initIndices(const std::vector< HWIdentifier > &ids, const std::vector< HWIdentifier > &symIds) const
Definition: LArMCSym.cxx:33
IdentifierHash
Definition: IdentifierHash.h:38