ATLAS Offline Software
LArOnOffIdMapping.h
Go to the documentation of this file.
1 //Dear emacs, this is -*-c++-*-
2 
3 /*
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef LARONOFFIDMAPPING_H
8 #define LARONOFFIDMAPPING_H
9 
11 #include "Identifier/Identifier.h"
13 
16 
17 #include <vector>
18 #include <assert.h>
19 
21 
22  friend class LArOnOffMappingAlg; //The conditions alg filling this object
23 
24  public:
26 
28 
34 
35 
41 
46  Identifier cnvToIdentifier(const HWIdentifier & sid) const;
47 
52  IdentifierHash oflHashFromOnlHash(const IdentifierHash & onlHash) const;
53 
57  Identifier cnvToIdentifierFromHash(const IdentifierHash & sid_hash) const;
58 
62  bool isOnlineConnectedFromHash(const IdentifierHash & sid_hash ) const;
63 
67  bool isOnlineConnected(const HWIdentifier & sid ) const;
68 
69 
73  std::vector<Identifier>& getOnlHash2OflId();
74  std::vector<HWIdentifier>& getOflHash2OnId();
75 
76 
77  private:
80 
81  std::vector<Identifier> m_onlHashToOffline;
82  std::vector<HWIdentifier> m_oflHashToOnline;
83  std::vector<IdentifierHash> m_onlHashToOflHash;
84 
87 
90 
91 };
92 
93 
94 //Inline methods:
95 
96 inline bool LArOnOffIdMapping::isOnlineConnectedFromHash(const IdentifierHash & sid_hash ) const {
97  if (sid_hash <m_onlHashToOffline.size())
98  return (m_idEmpty!=m_onlHashToOffline[sid_hash]);
99 
100  return false;
101 }
102 
103 
105  return m_oflHashToOnline[id_hash];
106 }
107 
108 
110  if (sid_hash <m_onlHashToOffline.size())
111  return m_onlHashToOffline[sid_hash];
112 
113  return m_idEmpty;
114 }
115 
117  const IdentifierHash sid_hash=m_onlineId->channel_Hash(sid);
118  return this->cnvToIdentifierFromHash(sid_hash);
119  }
120 
121 inline bool LArOnOffIdMapping::isOnlineConnected(const HWIdentifier & sid ) const {
122  const IdentifierHash sid_hash=m_onlineId->channel_Hash(sid);
123  return this->isOnlineConnectedFromHash(sid_hash);
124 }
125 
127  const IdentifierHash id_hash=m_caloId->calo_cell_hash(id);
128  return this->createSignalChannelIDFromHash(id_hash);
129 }
130 
131 inline std::vector<Identifier>& LArOnOffIdMapping::getOnlHash2OflId() {
132  return m_onlHashToOffline;
133 }
134 
135 inline std::vector<HWIdentifier>& LArOnOffIdMapping::getOflHash2OnId() {
136  return m_oflHashToOnline;
137 }
138 
140  assert(onlHash < m_onlHashToOflHash.size());
141  return m_onlHashToOflHash[onlHash];
142 }
143 
144 
145 #include "AthenaKernel/CLASS_DEF.h"
146 CLASS_DEF( LArOnOffIdMapping,148608605 , 1)
147 #include "AthenaKernel/CondCont.h"
149 
150 #endif
LArOnOffIdMapping::getOflHash2OnId
std::vector< HWIdentifier > & getOflHash2OnId()
Definition: LArOnOffIdMapping.h:135
LArOnOffIdMapping::createSignalChannelIDFromHash
HWIdentifier createSignalChannelIDFromHash(const IdentifierHash &id_hash) const
create a HWIdentifier from an Identifier (from hash) (inline)
Definition: LArOnOffIdMapping.h:104
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
LArOnOffIdMapping::getOnlHash2OflId
std::vector< Identifier > & getOnlHash2OflId()
Access to underlying storage (not-const only!)
Definition: LArOnOffIdMapping.h:131
LArOnOffIdMapping::m_idEmpty
const Identifier m_idEmpty
Invalid default instance of Identifier.
Definition: LArOnOffIdMapping.h:86
LArOnlineID_Base.h
LArOnOffIdMapping::m_onlHashToOflHash
std::vector< IdentifierHash > m_onlHashToOflHash
Definition: LArOnOffIdMapping.h:83
LArOnOffIdMapping::m_hwidEmpty
const HWIdentifier m_hwidEmpty
Invalid default instance of HWIdentifier.
Definition: LArOnOffIdMapping.h:89
LArOnOffIdMapping::LArOnOffIdMapping
LArOnOffIdMapping()=delete
LArOnOffIdMapping::cnvToIdentifierFromHash
Identifier cnvToIdentifierFromHash(const IdentifierHash &sid_hash) const
create an Identifier from a HWIdentifier (from hash) (inline)
Definition: LArOnOffIdMapping.h:109
HWIdentifier
Definition: HWIdentifier.h:13
LArOnOffIdMapping::m_caloId
const CaloCell_Base_ID * m_caloId
Definition: LArOnOffIdMapping.h:79
LArOnOffIdMapping::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition: LArOnOffIdMapping.h:78
CONDCONT_DEF
CONDCONT_DEF(LArOnOffIdMapping, 155467877)
LArOnOffIdMapping::isOnlineConnectedFromHash
bool isOnlineConnectedFromHash(const IdentifierHash &sid_hash) const
Test whether a HWIdentifier is connected of not (by online hash) (inline)
Definition: LArOnOffIdMapping.h:96
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
CaloCell_Base_ID.h
Helper base class for offline cell identifiers.
LArOnOffIdMapping::oflHashFromOnlHash
IdentifierHash oflHashFromOnlHash(const IdentifierHash &onlHash) const
Offline identifier hash from online.
Definition: LArOnOffIdMapping.h:139
LArOnOffMappingAlg
Definition: LArOnOffMappingAlg.h:17
LArOnOffIdMapping::createSignalChannelID
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Definition: LArOnOffIdMapping.h:126
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
HWIdentifier.h
IdentifierHash.h
LArOnOffIdMapping::cnvToIdentifier
Identifier cnvToIdentifier(const HWIdentifier &sid) const
create an Identifier from a HWIdentifier (inline)
Definition: LArOnOffIdMapping.h:116
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
IdentifierHash
Definition: IdentifierHash.h:38
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
LArOnOffIdMapping::m_oflHashToOnline
std::vector< HWIdentifier > m_oflHashToOnline
Definition: LArOnOffIdMapping.h:82
CLASS_DEF.h
macros to associate a CLID to a type
LArOnOffIdMapping::isOnlineConnected
bool isOnlineConnected(const HWIdentifier &sid) const
Test whether a HWIdentifier is connected of not (inline)
Definition: LArOnOffIdMapping.h:121
LArOnOffIdMapping::m_onlHashToOffline
std::vector< Identifier > m_onlHashToOffline
Definition: LArOnOffIdMapping.h:81
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20