ATLAS Offline Software
IdDictDictionary.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IDDICT_IdDictDictionary_H
6 #define IDDICT_IdDictDictionary_H
7 
8 
9 #include "Identifier/Identifier.h" //typedef
10 #include "Identifier/Range.h" //member
12 
13 #include <vector>
14 #include <string>
15 
16 
17 class IdDictField;
18 struct IdDictLabel;
19 class IdDictSubRegion;
20 class IdDictRegion;
21 class IdDictGroup;
22 class IdDictMgr;
23 
24 class MultiRange;
25 class ExpandedIdentifier;
26 class IdDictDictEntry;
27 
28 
29 
31 public:
34 
35  IdDictDictionary ();
37 
38  IdDictField* find_field (const std::string& name) const;
39  IdDictLabel* find_label (const std::string& field, const std::string& label) const;
40  int get_label_value (const std::string& field, const std::string& label, int& value) const; // > 0 == error
41  IdDictSubRegion* find_subregion (const std::string& subregion_name) const;
42  IdDictRegion* find_region (const std::string& region_name) const;
43  IdDictRegion* find_region (const std::string& region_name, const std::string& group_name) const;
44  IdDictGroup* find_group (const std::string& group_name) const;
45 
46 
47  void add_field (IdDictField* field);
48  void add_subregion (IdDictSubRegion* subregion);
50  void add_subdictionary_name (const std::string& name);
51  void resolve_references (const IdDictMgr& idd);
52  void generate_implementation (const IdDictMgr& idd, const std::string& tag = "");
53  void reset_implementation ();
54  bool verify () const;
55  void sort ();
56  void clear ();
57 
58 
60  int find_region(const ExpandedIdentifier& id, size_type& index) const;
62  IdDictRegion* find_region(const ExpandedIdentifier& id,const std::string& group_name) const;
63 
65  void integrate_bits ();
66 
68  MultiRange build_multirange () const;
69 
75  const Range& prefix = Range(),
76  const std::string& last_field = "") const;
77 
85  const std::string& group_name,
86  const Range& prefix = Range(),
87  const std::string& last_field = "") const;
88 
101  int pack32 (const ExpandedIdentifier& id,
102  size_t index1,
103  size_t index2,
104  Identifier& packedId) const;
105 
123  int pack32 (const int* fields,
124  size_t index1,
125  size_t index2,
126  size_t region_index,
127  Identifier& packedId,
128  size_t first_field_index=0) const;
129 
133  int reset (size_t index1,
134  size_t index2,
135  size_t region_index,
136  Identifier& packedId) const;
137 
138 
139 
145  int unpack (const Identifier& id,
146  const ExpandedIdentifier& prefix,
147  size_t index2,
148  ExpandedIdentifier& unpackedId) const;
149 
155  int unpack (const Identifier& id,
156  const ExpandedIdentifier& prefix,
157  size_t index2,
158  const std::string& sep,
159  std::string& unpackedId) const;
160 
169  int unpack (const Identifier& id,
170  size_t first_field_index,
171  size_t field_index,
172  size_t region_index,
173  int& field) const;
174 
175 
184  int copy (const Identifier& idin,
185  size_t first_field_index,
186  size_t begin_field_index,
187  size_t end_field_index,
188  size_t region_index,
189  Identifier& idout) const;
190 
194  bool do_checks (void) const;
195  void set_do_checks (bool do_checks);
196 
200  bool do_neighbours (void) const;
201  void set_do_neighbours (bool do_neighbours);
202 
204  const std::string& file_name (void) const;
205 
207  const std::string& dict_tag (void) const;
208 
210  void set_file_name (const std::string& name);
211 
213  void set_dict_tag (const std::string& tag);
214 
215 
216  std::string m_name;
217  std::string m_version;
218  std::string m_date;
219  std::string m_author;
220 
221  typedef std::vector<IdDictDictEntry*> entries_type;
223  typedef entries_type::const_iterator entries_const_it;
224 
225  typedef std::vector<IdDictRegion*> regions_type;
227  typedef regions_type::const_iterator regions_const_it;
228 
229  typedef std::vector<IdDictGroup*> groups_type;
231  typedef groups_type::const_iterator groups_const_it;
232 
233  std::map<std::string, IdDictField*> m_fields;
234  std::map<std::string, IdDictSubRegion*> m_subregions;
235  std::vector<IdDictRegion*> m_regions; // corresponding regions for REs
236  std::vector<IdDictRegion*> m_all_regions; // all regions
237  std::vector<IdDictGroup*> m_groups;
238  std::vector<std::string> m_subdictionary_names;
240 
241 private:
242  std::string m_file_name;
243  std::string m_dict_tag;
247 };
248 
249 //-------------------
250 // inline definitions
251 //-------------------
252 
254 inline const std::string&
256  return (m_file_name);
257 }
258 
259 
261 inline const std::string&
263  return (m_dict_tag);
264 }
265 
266 
268 inline void
270  m_file_name = name;
271 }
272 
273 
275 inline void
277  m_dict_tag = tag;
278 }
279 
280 
281 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
IdDictDictionary::find_region
IdDictRegion * find_region(const std::string &region_name) const
Definition: IdDictDictionary.cxx:101
IdDictDictionary::dict_tag
const std::string & dict_tag(void) const
Access to the dictionary tag.
Definition: IdDictDictionary.h:262
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictDictionary.cxx:299
IdDictDictionary::unpack
int unpack(const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier, considering the provided prefix (result will incl...
Definition: IdDictDictionary.cxx:683
IdDictDictionary::reset
int reset(size_t index1, size_t index2, size_t region_index, Identifier &packedId) const
Reset fields from index1 to index2.
Definition: IdDictDictionary.cxx:621
IdDictGroup
Definition: IdDictGroup.h:19
IdDictDictionary::do_neighbours
bool do_neighbours(void) const
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
Definition: IdDictDictionary.cxx:1175
IdDictDictionary::value_type
Identifier::value_type value_type
Definition: IdDictDictionary.h:32
IdDictDictionary::entries_type
std::vector< IdDictDictEntry * > entries_type
Definition: IdDictDictionary.h:221
IdDictDictionary::m_dict_tag
std::string m_dict_tag
Definition: IdDictDictionary.h:243
IdDictDictionary::generate_implementation
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
Definition: IdDictDictionary.cxx:174
IdDictDictionary::m_groups
std::vector< IdDictGroup * > m_groups
Definition: IdDictDictionary.h:237
IdDictDictionary::do_checks
bool do_checks(void) const
Checks are performed by default in debug compilation and NOT in optimized compilation.
Definition: IdDictDictionary.cxx:1165
index
Definition: index.py:1
IdDictDictionary::find_label
IdDictLabel * find_label(const std::string &field, const std::string &label) const
Definition: IdDictDictionary.cxx:65
Range.h
IdDictDictionary::groups_const_it
groups_type::const_iterator groups_const_it
Definition: IdDictDictionary.h:231
IdDictDictionary::regions_type
std::vector< IdDictRegion * > regions_type
Definition: IdDictDictionary.h:225
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
IdDictDictionary::m_do_checks
bool m_do_checks
Definition: IdDictDictionary.h:245
athena.value
value
Definition: athena.py:124
IdDictDictionary::set_dict_tag
void set_dict_tag(const std::string &tag)
Set the dictionary tag.
Definition: IdDictDictionary.h:276
IdDictDictionary::~IdDictDictionary
~IdDictDictionary()
Definition: IdDictDictionary.cxx:42
ExpandedIdentifier.h
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
IdDictDictEntry
Definition: IdDictDictEntry.h:13
IdDictDictionary::pack32
int pack32(const ExpandedIdentifier &id, size_t index1, size_t index2, Identifier &packedId) const
Pack to 32bits the subset of id between (inclusive) index1 and index2 - this is generic,...
Definition: IdDictDictionary.cxx:457
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictDictionary.cxx:45
CalibDbCompareRT.region_id
region_id
Definition: CalibDbCompareRT.py:68
IdDictRegion
Definition: IdDictRegion.h:20
IdDictDictionary::resolve_references
void resolve_references(const IdDictMgr &idd)
Definition: IdDictDictionary.cxx:147
IdDictDictionary::m_version
std::string m_version
Definition: IdDictDictionary.h:217
IdDictDictionary::verify
bool verify() const
Here, we verify global constraints : (this must only be applied after the resolve_references and gene...
Definition: IdDictDictionary.cxx:1208
IdDictDictionary::reset_implementation
void reset_implementation()
Definition: IdDictDictionary.cxx:221
IdDictDictionary::m_parent_dict
IdDictDictionary * m_parent_dict
Definition: IdDictDictionary.h:239
IdDictDictionary::size_type
Identifier::size_type size_type
Definition: IdDictDictionary.h:33
IdDictMgr
Definition: IdDictMgr.h:14
IdDictDictionary::groups_it
groups_type::iterator groups_it
Definition: IdDictDictionary.h:230
IdDictDictionary::m_fields
std::map< std::string, IdDictField * > m_fields
Definition: IdDictDictionary.h:233
IdDictDictionary::IdDictDictionary
IdDictDictionary()
Definition: IdDictDictionary.cxx:33
IdDictDictionary::find_group
IdDictGroup * find_group(const std::string &group_name) const
Definition: IdDictDictionary.cxx:115
Trk::index1
@ index1
Definition: BoundarySurfaceFace.h:48
IdDictDictionary::m_author
std::string m_author
Definition: IdDictDictionary.h:219
IdDictDictionary::groups_type
std::vector< IdDictGroup * > groups_type
Definition: IdDictDictionary.h:229
IdDictDictionary::m_generated_implementation
bool m_generated_implementation
Definition: IdDictDictionary.h:244
IdDictDictionary::set_file_name
void set_file_name(const std::string &name)
Set file name.
Definition: IdDictDictionary.h:269
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
IdDictDictionary::m_regions
std::vector< IdDictRegion * > m_regions
Definition: IdDictDictionary.h:235
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
mc.group_name
group_name
Definition: mc.PhPy8EG_A14NNPDF23_NNLOPS_example.py:33
IdDictDictionary::add_subdictionary_name
void add_subdictionary_name(const std::string &name)
Definition: IdDictDictionary.cxx:132
IdDictDictionary::regions_it
regions_type::iterator regions_it
Definition: IdDictDictionary.h:226
IdDictLabel
Definition: IdDictLabel.h:10
IdDictDictionary::regions_const_it
regions_type::const_iterator regions_const_it
Definition: IdDictDictionary.h:227
IdDictDictionary::file_name
const std::string & file_name(void) const
Access to file name.
Definition: IdDictDictionary.h:255
IdDictDictionary::m_date
std::string m_date
Definition: IdDictDictionary.h:218
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictDictionary.cxx:73
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
grepfile.sep
sep
Definition: grepfile.py:38
IdDictDictionary::sort
void sort()
Sort:
Definition: IdDictDictionary.cxx:1229
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
Trk::index2
@ index2
Definition: BoundarySurfaceFace.h:49
IdDictDictionary::clear
void clear()
Definition: IdDictDictionary.cxx:1245
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IdDictDictionary::entries_it
entries_type::iterator entries_it
Definition: IdDictDictionary.h:222
IdDictDictionary::add_field
void add_field(IdDictField *field)
Definition: IdDictDictionary.cxx:82
IdDictDictionary::m_do_neighbours
bool m_do_neighbours
Definition: IdDictDictionary.h:246
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
IdDictDictionary
Definition: IdDictDictionary.h:30
IdDictDictionary::find_subregion
IdDictSubRegion * find_subregion(const std::string &subregion_name) const
Definition: IdDictDictionary.cxx:91
IdDictDictionary::m_subdictionary_names
std::vector< std::string > m_subdictionary_names
Definition: IdDictDictionary.h:238
IdDictDictionary::m_name
std::string m_name
Definition: IdDictDictionary.h:216
IdDictDictionary::m_subregions
std::map< std::string, IdDictSubRegion * > m_subregions
Definition: IdDictDictionary.h:234
IdDictDictionary::add_dictentry
void add_dictentry(IdDictDictEntry *entry)
Definition: IdDictDictionary.cxx:136
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
IdDictSubRegion
Definition: IdDictSubRegion.h:13
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IdDictDictionary::set_do_neighbours
void set_do_neighbours(bool do_neighbours)
Definition: IdDictDictionary.cxx:1180
CaloCondBlobAlgs_fillNoiseFromASCII.fields
fields
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:106
IdDictField
Definition: IdDictField.h:15
Identifier::size_type
unsigned long long size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:29
IdDictDictionary::m_file_name
std::string m_file_name
Definition: IdDictDictionary.h:242
IdDictDictionary::integrate_bits
void integrate_bits()
Set up integral of bits for efficient unpacking.
Definition: IdDictDictionary.cxx:279
IdDictDictionary::copy
int copy(const Identifier &idin, size_t first_field_index, size_t begin_field_index, size_t end_field_index, size_t region_index, Identifier &idout) const
Copy a number of fields of the value_type id into another value_type id.
Definition: IdDictDictionary.cxx:1078
IdDictDictionary::add_subregion
void add_subregion(IdDictSubRegion *subregion)
Definition: IdDictDictionary.cxx:124
IdDictDictionary::entries_const_it
entries_type::const_iterator entries_const_it
Definition: IdDictDictionary.h:223
IdDictDictionary::m_all_regions
std::vector< IdDictRegion * > m_all_regions
Definition: IdDictDictionary.h:236
Identifier
Definition: IdentifierFieldParser.cxx:14
IdDictDictionary::set_do_checks
void set_do_checks(bool do_checks)
Definition: IdDictDictionary.cxx:1170