ATLAS Offline Software
Loading...
Searching...
No Matches
CaloIDHelper.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef CALOIDENTIFIER_CALOIDHELPER_H
14#define CALOIDENTIFIER_CALOIDHELPER_H
15
16
18#include "Identifier/Identifier.h"
20#include "Identifier/MultiRange.h" //used in the icc file
22#include <vector>
23#include <ranges>
24#include <set>
25class IMessageSvc;
26class IdDictRegion;
27
28
33 : public AtlasDetectorID
34{
35public:
36 enum { NOT_VALID=999999 };
37
38
39 typedef Identifier::size_type size_type ;
40
42 using id_iterator = std::vector<Identifier>::const_iterator;
44 using id_range = std::ranges::subrange<id_iterator>;
45
46
47
60 {
61 public:
66 HashGroup();
67
68
79 template <class T>
80 int init (T& parent,
81 const std::string& type,
82 const MultiRange& full_range,
83 Identifier (T::*idfunc) (const ExpandedIdentifier&) const,
85
86
97 int init (const std::string& name,
98 const std::set<Identifier>& ids,
100 const MultiRange* full_range = 0);
101
102
105
112
115
116
124 int get_hash (Identifier id, IdentifierHash& hash_id) const;
125
126
136
138 const std::vector<Identifier>& ids() const;
139
142
144 IdContext context() const;
145
146
147 private:
149 std::vector<Identifier> m_id_vec;
150
153 };
154
155
163 CaloIDHelper (const std::string& name, const std::string& group);
164
165
167 const HashGroup& channels() const;
168
170 const HashGroup& regions() const;
171
176
177
183
184
190
191
205 virtual int get_id (const IdentifierHash& hash_id,
206 Identifier& id,
207 const IdContext* context = 0 ) const;
208
209
225 virtual int get_hash (const Identifier& id,
226 IdentifierHash& hash_id,
227 const IdContext* context = 0 ) const;
228
229
234
235
240
241
243 const std::vector<const IdDictRegion*>& dictRegions() const;
244
245
250 float etaGranularity(const IdentifierHash regHash) const;
251
252
257 float phiGranularity(const IdentifierHash regHash) const;
258
259
264 float eta0(const IdentifierHash regHash) const;
265
266
271 float phi0(const IdentifierHash regHash) const;
272
273
275 const std::string& name() const;
276
277
278protected:
285 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
286 const std::string& dict_name);
287
288
293
294
296 const IdDictDictionary* dict() const;
297
298
305 int fill_vec_of_dict_regions (const std::string& group_name = "");
306
307
316 virtual int get_expanded_id (const Identifier& id,
317 ExpandedIdentifier& exp_id,
318 const IdContext* context) const = 0;
319
320
321private:
323 std::string m_name;
324
327
330
333
335 std::vector<const IdDictRegion*> m_vecOfDictRegions;
336};
337
338
340
341
342#endif // not CALOIDENTIFIER_CALOIDHELPER_H
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
const std::string & group() const
Group name for this helper.
AtlasDetectorID(const std::string &name, const std::string &group)
Manage a list of identifiers.
IdContext context() const
Return the context for this group.
IdentifierHash hash(Identifier id) const
Look up the hash code corresponding to an Identifier.
Identifier id(IdentifierHash hashId) const
Return the identifier for a given hash code (no checking).
const std::vector< Identifier > & ids() const
Return a vector of all Identifiers for this group.
id_iterator end() const
Return an end iterator over the group's Identifiers.
id_iterator begin() const
Return a begin iterator over the group's Identifiers.
size_type m_end_index
Ending index for this group's context.
size_type end_index() const
Return the ending index of the context for this group.
std::vector< Identifier > m_id_vec
List of Identifiers for this group.
int init(T &parent, const std::string &type, const MultiRange &full_range, Identifier(T::*idfunc)(const ExpandedIdentifier &) const, size_type end_index)
Initialize.
id_range range() const
Return an iterator range over the group's Identifiers.
int get_hash(Identifier id, IdentifierHash &hash_id) const
Look up the hash code corresponding to an Identifier.
size_type hash_max() const
Return one more than the largest hash code.
float phi0(const IdentifierHash regHash) const
Return the minimum phi of region, or NOT_VALID.
const HashGroup & regions() const
Return the HashGroup for regions.
IdentifierHash region_hash(Identifier regionId) const
Convert a connected region Identifier to a hash code.
HashGroup & channels()
Return the HashGroup for channels (cells). non-const.
HashGroup & regions()
Return the HashGroup for regions. non-const.
float eta0(const IdentifierHash regHash) const
Return the minimum eta of region, or NOT_VALID.
const std::vector< const IdDictRegion * > & dictRegions() const
Return the vector of IdDictRegion, accessed via region hash.
float etaGranularity(const IdentifierHash regHash) const
Return the eta granularity of a region, or NOT_VALID.
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).
size_type region_hash_max() const
One more than the largest region hash code.
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
Convert a hash code to an Identifier for either channels or regions, depending on the context.
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const =0
Create an expanded Identifier from an Identifier.
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
IdContext region_context() const
Return the context for regions.
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
Convert an Identifier to a hash code for either channels or regions, depending on the context.
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
std::vector< const IdDictRegion * > m_vecOfDictRegions
List of IdDictRegion objects.
size_type channel_hash_max() const
One more than the largest channel (cell) hash code.
HashGroup m_regions
Group of region Identifiers.
IdContext channel_context() const
Return the context for channels (cells).
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
const IdDictDictionary * m_dict
The dictionary for this helper.
Identifier region_id(IdentifierHash hashId) const
Return the region Identifier for a given hash code (no checking).
int fill_vec_of_dict_regions(const std::string &group_name="")
Initialize the list of detector regions.
float phiGranularity(const IdentifierHash regHash) const
Return the phi granularity of a region, or NOT_VALID.
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
HashGroup m_channels
Group of channel (cell) Identifiers.
std::string m_name
Name of this helper.
const std::string & name() const
Return the name for this helper.
const HashGroup & channels() const
Return the HashGroup for channels (cells).
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
A MultiRange combines several Ranges.
Definition MultiRange.h:17