ATLAS Offline Software
LArMCSym.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARRAWCONDITIONS_LARMCSYM_H
6 #define LARRAWCONDITIONS_LARMCSYM_H
7 
8 
17 
18 class LArMCSym
19 {
20 public:
21  LArMCSym() = delete;
22 
23 
32  LArMCSym(const LArOnlineID* onlId,
33  const CaloCell_ID* caloId,
34  std::vector<HWIdentifier>&& oflHashtoSymOnl,
35  std::vector<HWIdentifier>&& onlHashtoSymOnl,
36  std::vector<HWIdentifier>&& symIds
37  );
38 
39 
41  static constexpr size_t NO_INDEX = static_cast<size_t> (-1);
42 
43 
48  HWIdentifier ZPhiSymOfl(const Identifier notSymOffId) const {
49  if (m_caloCellID->is_tile(notSymOffId)) return HWIdentifier();
50  const IdentifierHash h=m_caloCellID->calo_cell_hash(notSymOffId);
51  return ZPhiSymOfl(h);
52  }
53 
54 
59  HWIdentifier ZPhiSymOfl(const IdentifierHash notSymOffHash) const {
60  assert(notSymOffHash < m_oflHashtoSymOnl.size());
61  return HWIdentifier (m_oflHashtoSymOnl[notSymOffHash].first);
62  }
63 
64 
70  size_t ZPhiSymOflIndex(const Identifier notSymOffId) const {
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  }
75 
81  size_t ZPhiSymOflIndex(const IdentifierHash notSymOffHash) const {
82  assert(notSymOffHash < m_oflHashtoSymOnl.size());
83  return m_oflHashtoSymOnl[notSymOffHash].second;
84  }
85 
86 
91  HWIdentifier ZPhiSymOnl(const HWIdentifier notSymOnlId) const {
92  const IdentifierHash h=m_onlineID->channel_Hash(notSymOnlId);
93  return ZPhiSymOnl(h);
94  }
95 
96 
101  HWIdentifier ZPhiSymOnl(const IdentifierHash notSymOnlHash) const {
102  assert(notSymOnlHash < m_onlHashtoSymOnl.size());
103  return HWIdentifier (m_onlHashtoSymOnl[notSymOnlHash].first);
104  }
105 
106 
112  size_t ZPhiSymOnlIndex(const HWIdentifier notSymOnlId) const {
113  const IdentifierHash h=m_onlineID->channel_Hash(notSymOnlId);
114  return ZPhiSymOnlIndex(h);
115  }
116 
117 
123  size_t ZPhiSymOnlIndex(const IdentifierHash notSymOnlHash) const {
124  assert(notSymOnlHash < m_onlHashtoSymOnl.size());
125  return m_onlHashtoSymOnl[notSymOnlHash].second;
126  }
127 
128 
132  const std::vector<HWIdentifier>& symIds() const {
133  return m_symIds;
134  }
135 
139  std::pair<size_t,size_t> hashMax() const {
140  return std::make_pair(m_onlHashtoSymOnl.size(),m_oflHashtoSymOnl.size());
141  }
142 
143 
144 
145  private:
146  typedef std::pair<Identifier32::value_type, uint32_t> IdPair_t;
147  std::vector<IdPair_t>
148  initIndices (const std::vector<HWIdentifier>& ids,
149  const std::vector<HWIdentifier>& symIds) const;
150 
151 
154  const std::vector<IdPair_t> m_oflHashtoSymOnl;
155  const std::vector<IdPair_t> m_onlHashtoSymOnl;
156  const std::vector<HWIdentifier> m_symIds;
157 
158 };
159 
160 #include "AthenaKernel/CLASS_DEF.h"
161 CLASS_DEF( LArMCSym , 33771274 , 1 )
162 #include "AthenaKernel/CondCont.h"
163 CONDCONT_DEF( LArMCSym, 159334782 );
164 
165 #endif
LArMCSym::ZPhiSymOnl
HWIdentifier ZPhiSymOnl(const IdentifierHash notSymOnlHash) const
Find the symmetric HWID for an online channel hash.
Definition: LArMCSym.h:101
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::ZPhiSymOnlIndex
size_t ZPhiSymOnlIndex(const IdentifierHash notSymOnlHash) const
Find the index in symIds() of the symmetric HWID for an online channel hash.
Definition: LArMCSym.h:123
LArMCSym::m_symIds
const std::vector< HWIdentifier > m_symIds
Definition: LArMCSym.h:156
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::LArMCSym
LArMCSym()=delete
CaloCell_ID.h
LArMCSym::ZPhiSymOfl
HWIdentifier ZPhiSymOfl(const Identifier notSymOffId) const
Find the symmetric HWID for an offline cell identifier.
Definition: LArMCSym.h:48
LArMCSym
Helper class to handle z-phi symmetry of calibration constants in MC.
Definition: LArMCSym.h:19
LArMCSym::IdPair_t
std::pair< Identifier32::value_type, uint32_t > IdPair_t
Definition: LArMCSym.h:146
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
LArMCSym::ZPhiSymOnl
HWIdentifier ZPhiSymOnl(const HWIdentifier notSymOnlId) const
Find the symmetric HWID for an online channel identifier.
Definition: LArMCSym.h:91
LArMCSym::ZPhiSymOfl
HWIdentifier ZPhiSymOfl(const IdentifierHash notSymOffHash) const
Find the symmetric HWID for an offline cell hash.
Definition: LArMCSym.h:59
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
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
LArMCSym::hashMax
std::pair< size_t, size_t > hashMax() const
Return the hash-max as pair<onlHashMax,oflHashMax>
Definition: LArMCSym.h:139
HWIdentifier.h
LArMCSym::m_caloCellID
const CaloCell_ID * m_caloCellID
Definition: LArMCSym.h:153
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
IdentifierHash.h
LArOnlineID
Definition: LArOnlineID.h:20
LArMCSym::ZPhiSymOflIndex
size_t ZPhiSymOflIndex(const IdentifierHash notSymOffHash) const
Find the index in symIds() of the symmetric HWID for an offline cell hash.
Definition: LArMCSym.h:81
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
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CONDCONT_DEF
CONDCONT_DEF(LArMCSym, 159334782)
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
Identifier32.h
CLASS_DEF.h
macros to associate a CLID to a type
LArOnlineID.h