2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
7 * @file CaloIdentifier/LArFCAL_Base_ID.icc
8 * @author naoko kanaya <nkanaya@cern.ch>
10 * @brief Inline implementations for LArFCAL_Base_ID.
14 //--------------------
16 //--------------------
18 //----------------------------------------------------------------------------
20 LArFCAL_Base_ID::module_id (const ExpandedIdentifier& exp_id) const
22 return this->module_id ( exp_id[m_POSNEG_INDEX],
23 exp_id[m_MODULE_INDEX] );
26 //----------------------------------------------------------------------------
28 LArFCAL_Base_ID::channel_id (const ExpandedIdentifier& exp_id) const
30 return this->channel_id (exp_id[m_POSNEG_INDEX],
31 exp_id[m_MODULE_INDEX],
36 //----------------------------------------------------------------------------
38 LArFCAL_Base_ID::module_id (int pos_neg, int module, bool checks) const
42 module_id_checks ( pos_neg, module );
47 // Pack fields independently
48 m_lar_impl.pack (lar_field_value(), result);
49 m_fcal_impl.pack (lar_fcal_field_value(), result);
50 m_pn_impl.pack (pos_neg, result);
51 m_module_impl.pack (module, result);
52 m_slar_impl.pack (m_slar, result);
58 LArFCAL_Base_ID::module_id (int pos_neg, int module) const
60 return module_id (pos_neg, module, do_checks());
63 //----------------------------------------------------------------------------
65 LArFCAL_Base_ID::channel_id ( int pos_neg, int module,
66 int eta, int phi, bool checks ) const
70 channel_id_checks( pos_neg, module, eta, phi );
74 // Pack fields independently
75 m_lar_impl.pack (lar_field_value(), result);
76 m_fcal_impl.pack (lar_fcal_field_value(), result);
77 m_pn_impl.pack (pos_neg, result);
78 m_module_impl.pack (module, result);
79 m_eta_impl.pack (eta, result);
80 m_phi_impl.pack (phi, result);
81 m_slar_impl.pack (m_slar, result);
87 LArFCAL_Base_ID::channel_id ( int pos_neg, int module,
88 int eta, int phi ) const
90 return channel_id (pos_neg, module, eta, phi, do_checks());
94 //----------------------------------------------------------------------------
96 LArFCAL_Base_ID::module_id ( const Identifier channelId ) const
99 Identifier result(channelId);
101 m_eta_impl.reset(result);
102 m_phi_impl.reset(result);
103 m_slar_impl.pack(m_slar,result);
107 //----------------------------------------------------------------------------
109 LArFCAL_Base_ID::channel_id ( const Identifier module_id,
110 int eta, int phi, bool checks ) const
114 channel_id_checks( module_id, eta, phi );
117 Identifier result(module_id);
119 // Reset the fields and then set the values
120 m_eta_impl.reset (result);
121 m_phi_impl.reset (result);
122 m_eta_impl.pack (eta, result);
123 m_phi_impl.pack (phi, result);
124 m_slar_impl.pack (m_slar, result);
130 LArFCAL_Base_ID::channel_id ( const Identifier module_id,
131 int eta, int phi ) const
133 return channel_id (module_id, eta, phi, do_checks());
136 //----------------------------------------------------------------------------
137 inline Identifier LArFCAL_Base_ID::module_id (IdentifierHash module_hash_id) const
139 return region_id (module_hash_id);
142 //----------------------------------------------------------------------------
143 inline IdentifierHash LArFCAL_Base_ID::module_hash (Identifier module_id) const
145 return region_hash (module_id);
148 //----------------------------------------------------------------------------
149 inline IdentifierHash LArFCAL_Base_ID::channel_hash_binary_search (Identifier channelId) const
151 return channel_hash (channelId);
154 //----------------------------------------------------------------------------
155 inline LArFCAL_Base_ID::size_type LArFCAL_Base_ID::module_hash_max (void) const
157 return region_hash_max();
160 //----------------------------------------------------------------------------
161 inline LArFCAL_Base_ID::id_iterator LArFCAL_Base_ID::mod_begin (void) const
163 return regions().begin();
166 //----------------------------------------------------------------------------
167 inline LArFCAL_Base_ID::id_iterator LArFCAL_Base_ID::mod_end (void) const
169 return regions().end();
172 //----------------------------------------------------------------------------
173 inline LArFCAL_Base_ID::id_range LArFCAL_Base_ID::mod_range (void) const
175 return regions().range();
178 //----------------------------------------------------------------------------
179 inline LArFCAL_Base_ID::id_iterator LArFCAL_Base_ID::fcal_begin (void) const
181 return channels().begin();
184 //----------------------------------------------------------------------------
185 inline LArFCAL_Base_ID::id_iterator LArFCAL_Base_ID::fcal_end (void) const
187 return channels().end();
190 //----------------------------------------------------------------------------
191 inline LArFCAL_Base_ID::id_range LArFCAL_Base_ID::fcal_range (void) const
193 return channels().range();
196 //----------------------------------------------------------------------------
197 inline const std::vector<Identifier>& LArFCAL_Base_ID::channel_ids() const
199 return channels().ids();
202 //----------------------------------------------------------------------------
203 inline int LArFCAL_Base_ID::pos_neg (const Identifier id)const
205 return (m_pn_impl.unpack(id));
208 //----------------------------------------------------------------------------
209 inline int LArFCAL_Base_ID::module (const Identifier id)const
211 return (m_module_impl.unpack(id));
214 //----------------------------------------------------------------------------
215 inline int LArFCAL_Base_ID::eta (const Identifier id)const
217 int result = m_eta_impl.unpack(id);
221 //----------------------------------------------------------------------------
222 inline int LArFCAL_Base_ID::phi(const Identifier id)const
224 int result = m_phi_impl.unpack(id);
228 //----------------------------------------------------------------------------
229 inline int LArFCAL_Base_ID::phi_min(const Identifier modId) const
231 IdentifierHash modHash = module_hash(modId);
232 unsigned int index = modHash;
233 return (m_vecOfPhiMin[index]);