 |
ATLAS Offline Software
|
Go to the documentation of this file.
25 for (
unsigned int i = 0;
i <
str.size(); ++
i) {
26 if (!isdigit(
str[
i]))
return(
false);
28 if (0 ==
str.size())
return(
false);
37 std::map <std::string, IdDictField*>::const_iterator
it;
59 if (!idField)
return nullptr;
67 if (!idLabel || !idLabel->
m_valued)
return(1);
74 if (
field == 0)
return;
83 std::map <std::string, IdDictSubRegion*>::const_iterator
it;
100 if ((region != 0) && (region_name == region->
m_name))
return(region);
116 if (subregion == 0)
return;
135 group->add_dictentry(region);
144 field->resolve_references(idd);
160 (*it)->resolve_references(idd, *
this,
index);
166 const std::string&
tag) {
168 std::cout <<
"IdDictDictionary::generate_implementation>" << std::endl;
176 (*it)->generate_implementation(idd, *
this,
tag);
180 for (
it1 = regions.begin();
it1 != regions.end(); ++
it1) {
193 if (
"dummy" == (*it)->name())
continue;
205 (*itr)->find_neighbours(*
this);
217 (*it)->reset_implementation();
235 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
261 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
275 size_t bits_offset = 0;
278 impl.set_bits_offset(bits_offset);
279 bits_offset +=
impl.bits();
283 if ((not
field.isBounded()) || (0 !=
field.get_minimum())) {
284 impl.set_decode_index(
true);
300 for (
unsigned int i = 0;
i < group_mr.
size(); ++
i) {
311 const std::string& last_field)
const {
315 if (
"" == last_field) {
321 if (
"dummy" == region.
m_name)
continue;
337 if (
"dummy" == region.
m_name)
continue;
350 std::vector <IdDictFieldImplementation>::const_iterator
fit;
357 new_range.
add(
impl.range()->build_range());
359 if (last_field ==
impl.range()->m_field->m_name) {
363 result.add(std::move(new_range));
374 const std::string& last_field)
const {
378 if (
"" == last_field) {
384 if (
"dummy" == region.
m_name)
continue;
400 if (
"dummy" == region.
m_name)
continue;
413 std::vector <IdDictFieldImplementation>::const_iterator
fit;
420 new_range.
add(
impl.range()->build_range());
422 if (last_field ==
impl.range()->m_field->m_name) {
426 result.add(std::move(new_range));
482 bool selected =
true;
495 if (!
impl.field().match(
id[
i])) {
509 if (0 == position &&
impl.bits() > 0) {
513 position -=
impl.bits();
514 packedId |= (
index << position);
530 size_t first_field_index)
const {
536 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
543 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
544 << region_index <<
" " <<
m_regions.size() << std::endl;
555 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
559 if (
index1 < first_field_index) {
560 std::cout <<
"IdDictDictionary::pack32 - first_field_index > index1 "
561 << first_field_index <<
" " <<
index1 << std::endl;
568 if (!first_field_index) {
570 position -=
impl.bits_offset();
573 size_t field_index = 0;
579 if (!
impl.ored_field().match(
fields[field_index])) {
580 std::cout <<
"IdDictDictionary::pack32 - field does NOT match: value, allowed values "
581 <<
fields[field_index] <<
" " << (std::string)
impl.ored_field()
588 if (0 == position &&
impl.bits() > 0) {
589 std::cout <<
"IdDictDictionary::pack32 - going past 0" << std::endl;
595 if (
impl.decode_index()) {
601 position -=
impl.bits();
602 packedId |= (
index << position);
621 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
628 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
629 << region_index <<
" " <<
m_regions.size() << std::endl;
640 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
646 size_t field_index = 0;
665 #if defined(FLATTEN) && defined(__GNUC__)
681 if (localPrefix.
isValid()) unpackedId = localPrefix;
692 bool selected =
false;
701 if (
i >= localPrefix.
fields()) {
713 if (!
impl.field().match(localPrefix[
i])) {
729 if (
impl.bits() == 0)
continue;
731 if (position <
impl.bits())
break;
734 if (
index >=
impl.ored_field().get_indices()) {
765 position -=
impl.bits();
789 const std::string&
sep,
790 std::string& unpackedId)
const {
803 bool selected =
false;
813 if (
i >= localPrefix.
fields()) {
825 if (!
impl.field().match(localPrefix[
i])) {
844 if (
impl.bits() == 0)
continue;
848 if (position <
impl.bits())
break;
851 if (
index >=
impl.ored_field().get_indices()) {
872 std::string str_value(
"nil");
884 switch (
range->m_specification) {
887 str_value =
range->m_field->m_name +
' ';
888 sprintf(temp,
"%d",
value);
897 str_value +=
range->m_field->m_name +
' ';
899 str_value +=
range->m_label;
908 if (
label->m_valued) {
909 str_value +=
range->m_label;
924 if (index1 < range->m_labels.size()) {
926 str_value +=
range->m_field->m_name +
' ';
930 std::cout <<
"IdDictDictionary::unpack - Could not find value." << std::endl;
931 std::cout <<
"value " <<
value << std::endl;
932 std::cout <<
"field values " << std::endl;
933 for (
unsigned int i = 0;
i <
range->m_values.size(); ++
i) {
934 std::cout <<
range->m_values[
i] <<
" ";
936 std::cout << std::endl;
943 std::cout <<
"unknown" << std::endl;
950 unpackedId += str_value;
953 position -=
impl.bits();
978 size_t first_field_index,
987 std::cout <<
"IdDictDictionary::unpack - region index too large. Index, nregions "
988 << region_index <<
" " <<
m_regions.size() << std::endl;
998 std::cout <<
"IdDictDictionary::unpack - field index too large. Index, nfields "
1006 size_t prefix_offset = 0;
1011 if (first_field_index) {
1014 std::cout <<
"IdDictDictionary::unpack - first_field_index too large. Index, nfields "
1026 if (
impl.bits() == 0) {
1027 std::cout <<
"IdDictDictionary::unpack - no bits for this field. Region, field indexes "
1028 << region_index <<
" " << field_index << std::endl;
1033 if (
impl.bits() +
impl.bits_offset() - prefix_offset > position) {
1034 std::cout <<
"IdDictDictionary::unpack - bits + offset too large. Region, field indexes, bits, offset "
1035 << region_index <<
" " << field_index <<
" "
1036 <<
impl.bits() <<
" " <<
impl.bits_offset() <<
" " << prefix_offset
1045 size_t index =
id.extract(position -=
impl.bits() +
impl.bits_offset() - prefix_offset,
mask);
1065 size_t first_field_index,
1066 size_t begin_field_index,
1067 size_t end_field_index,
1068 size_t region_index,
1072 std::cout <<
"IdDictDictionary::copy - region index too large. Index, nregions "
1073 << region_index <<
" " <<
m_regions.size() << std::endl;
1082 std::cout <<
"IdDictDictionary::copy - field index too large. Indexes first, begin, end, nfields "
1083 << first_field_index <<
" "
1084 << begin_field_index <<
" "
1085 << end_field_index <<
" "
1091 size_t missing_offset = 0;
1092 if (first_field_index) {
1093 if (first_field_index > begin_field_index) {
1094 std::cout <<
"IdDictDictionary::copy - first_field_index > begin_field_index. Indexes "
1095 << first_field_index <<
" " << begin_field_index << std::endl;
1102 size_t prefix_offset = 0;
1103 if (begin_field_index) {
1104 if (begin_field_index > end_field_index) {
1105 std::cout <<
"IdDictDictionary::copy - begin_field_index > end_field_index. Indexes "
1106 << begin_field_index <<
" " << end_field_index << std::endl;
1114 size_t suffix_offset =
impl.bits() +
impl.bits_offset();
1118 if (position < prefix_offset - missing_offset) {
1119 std::cout <<
"IdDictDictionary::copy - position < prefix + missing. "
1120 << prefix_offset <<
" " << missing_offset << std::endl;
1125 if (position < suffix_offset + missing_offset) {
1126 std::cout <<
"IdDictDictionary::copy - position < suffix + missing. "
1127 << suffix_offset <<
" " << missing_offset << std::endl;
1137 prefix_offset ? (
static_cast<Identifier::value_type>(1) << (position - prefix_offset + missing_offset)) - 1 : 0;
1142 mask -= prefix_mask + suffix_mask;
1199 if (
mr.has_overlap())
return(
false);
1218 std::map< ExpandedIdentifier, IdDictDictEntry* > regions;
1226 std::cout <<
"IdDictDictionary::sort - WARNING verify is FALSE - cannot sort "
JetConstituentVector::iterator iterator
IdDictRegion * find_region(const std::string ®ion_name) const
MultiRange build_multirange() const
Get MultiRange for full dictionary.
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...
void resolve_references(const IdDictMgr &idd, IdDictDictionary &dictionary)
int reset(size_t index1, size_t index2, size_t region_index, Identifier &packedId) const
Reset fields from index1 to index2.
bool do_neighbours(void) const
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
std::vector< IdDictGroup * > m_groups
bool do_checks(void) const
Checks are performed by default in debug compilation and NOT in optimized compilation.
void get_bits(const RV ®ions, size_t level, const std::string &group)
IdDictLabel * find_label(const std::string &field, const std::string &label) const
value_type mask_shift(value_type mask, size_type shift) const
extract field(s) by masking first, then shifting
groups_type::const_iterator groups_const_it
void add(element_type value)
Append a value into a new field.
std::vector< IdDictRegion * > regions_type
IdDictLabel * find_label(const std::string &name) const
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,...
IdDictField * find_field(const std::string &name) const
void resolve_references(const IdDictMgr &idd)
bool verify() const
Here, we verify global constraints : (this must only be applied after the resolve_references and gene...
void reset_implementation()
IdDictDictionary * m_parent_dict
Identifier::size_type size_type
groups_type::iterator groups_it
std::map< std::string, IdDictField * > m_fields
IdDictGroup * find_group(const std::string &group_name) const
static constexpr value_type ALL_BITS
Range build_range() const
static constexpr unsigned int NBITS
std::vector< HWIdentifier >::iterator it1
bool m_generated_implementation
std::vector< IdDictRegion * > m_regions
std::string group_name() const
void add_subdictionary_name(const std::string &name)
regions_type::iterator regions_it
regions_type::const_iterator regions_const_it
int get_label_value(const std::string &field, const std::string &label, int &value) const
A MultiRange combines several Ranges.
void add_field(IdDictField *field)
bool isValid() const
Returns whether the expanded Identifier contains any information.
virtual std::string group_name() const =0
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
void add()
Add a wild card field.
IdDictSubRegion * find_subregion(const std::string &subregion_name) const
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
std::vector< std::string > m_subdictionary_names
std::map< std::string, IdDictSubRegion * > m_subregions
void add_dictentry(IdDictDictEntry *entry)
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
unsigned long long value_type
bool isNumber(const std::string &s)
void set_do_neighbours(bool do_neighbours)
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
void integrate_bits()
Set up integral of bits for efficient unpacking.
std::vector< IdDictFieldImplementation > m_implementation
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.
void add_subregion(IdDictSubRegion *subregion)
void set_do_checks(bool do_checks)