ATLAS Offline Software
Loading...
Searching...
No Matches
SiliconID.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
5#ifndef INDETIDENTIFIER_XXX_SILICONID_H
6#define INDETIDENTIFIER_XXX_SILICONID_H
17
19#include "Identifier/Identifier.h"
21#include "Identifier/IdHelper.h"
25
26
27
40
41class SiliconID final: public AtlasDetectorID
42{
43public:
45
46 typedef Identifier::size_type size_type;
48
50
51 SiliconID();
52 SiliconID(const PixelID* pixel_helper, const SCT_ID* sct_helper);
55
57
58
60
63
66
68 bool is_barrel(const Identifier& id) const;
69
71 bool is_blayer(const Identifier& id) const;
73
76
79
80
82
83
84 virtual int get_id(const IdentifierHash& hash_id,
85 Identifier& id,
86 const IdContext* context = 0) const override final;
87
89 virtual int get_hash(const Identifier& id,
90 IdentifierHash& hash_id,
91 const IdContext* context = 0) const override final;
92
94 virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override final;
96
104};
105
106
107
108//using the macros below we can assign an identifier (and a version)
109//This is required and checked at compile time when you try to record/retrieve
110CLASS_DEF(SiliconID, 129452393, 1)
111
112//----------------------------------------------------------------------------
113inline Identifier
115 // Identifier from hash
117 // Pixel hash
118 return(m_pixel_helper->wafer_id(wafer_hash));
119 } else if (wafer_hash < m_wafer_hash_max) {
120 // SCT hash
122 }
123 // return invalid Identifier
125 return(result);
126}
127
128//----------------------------------------------------------------------------
129inline IdentifierHash
131 // wafer hash from id
132 if (is_pixel(wafer_id)) {
133 // Pixel id
134 return(m_pixel_helper->wafer_hash(wafer_id));
135 } else {
136 // SCT hash + pixel hash max
137 return(m_sct_helper->wafer_hash(wafer_id) + m_pixel_wafer_hash_max);
138 }
139}
140
141//----------------------------------------------------------------------------
144 // Hash table maximum sizes
145 return(m_wafer_hash_max);
146}
147
148//----------------------------------------------------------------------------
149inline bool
151 if (is_pixel(id)) {
152 // Pixel id
153 return(m_pixel_helper->is_barrel(id));
154 } else {
155 // SCT
156 return(m_sct_helper->is_barrel(id));
157 }
158}
159
160//----------------------------------------------------------------------------
162inline bool
164 if (is_pixel(id)) {
165 // Pixel id
166 return(m_pixel_helper->is_blayer(id));
167 } else {
168 // SCT
169 return(false);
170 }
171}
172
173//----------------------------------------------------------------------------
175inline bool
177 // Identifier from hash
179 // Pixel hash
180 return(true);
181 }
182 // SCT hash
183 return(false);
184}
185
186#endif // INDETIDENTIFIER_SILICONID_H
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
bool is_pixel(Identifier id) const
AtlasDetectorID(const std::string &name, const std::string &group)
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.
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
int test_wafer_hashes() const
Tests of packing.
Definition SiliconID.cxx:93
bool is_blayer(const Identifier &id) const
Test for pixle b-layer - generic, i.e. works for EITHER pixel or sct id.
Definition SiliconID.h:163
bool is_barrel(const Identifier &id) const
Test for barrel - generic, i.e. works for EITHER pixel or sct id.
Definition SiliconID.h:150
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override final
Create hash id from compact id (return == 0 for OK)
Definition SiliconID.cxx:78
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override final
Initialization from the identifier dictionary.
Definition SiliconID.cxx:44
const PixelID * m_pixel_helper
Definition SiliconID.h:102
const SCT_ID * m_sct_helper
Definition SiliconID.h:103
size_type wafer_hash_max() const
Hash table maximum sizes.
Definition SiliconID.h:143
bool is_hash_pixel(IdentifierHash wafer_hash) const
Test whether hash is pixel or sct.
Definition SiliconID.h:176
size_type m_wafer_hash_max
Definition SiliconID.h:100
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition SiliconID.h:130
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override final
Create compact id from hash id (return == 0 for OK)
Definition SiliconID.cxx:67
size_type m_pixel_wafer_hash_max
Definition SiliconID.h:101
Identifier wafer_id(IdentifierHash wafer_hash) const
Identifier from hash.
Definition SiliconID.h:114
Identifier::size_type size_type
Definition SiliconID.h:46
#define private