 |
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);
38 const std::string&
date ,
39 const std::string&
author )
48 std::map <std::string, IdDictField*>::const_iterator
it;
70 if (!idField)
return nullptr;
78 if (!idLabel || !idLabel->
valued())
return(1);
85 if (
field == 0)
return;
92 std::map <std::string, IdDictSubRegion*>::const_iterator
it;
109 if ((region_name !=
"") && (
region->
name() != region_name))
continue;
125 if (subregion == 0)
return;
167 (*it)->resolve_references(idd, *
this,
index);
173 const std::string&
tag) {
175 std::cout <<
"IdDictDictionary::generate_implementation>" << std::endl;
183 (*it)->generate_implementation(idd, *
this,
tag);
187 for (it1 = regions.begin(); it1 != regions.end(); ++it1) {
200 if (
"dummy" == (*it)->name())
continue;
210 g->build_region_tree();
216 (*itr)->find_neighbours(*
this);
228 (*it)->reset_implementation();
246 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
272 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
300 for (
unsigned int i = 0;
i < group_mr.
size(); ++
i) {
311 const std::string& last_field)
const {
315 if (
"" == last_field) {
351 for (
size_t i = 0;
i < nimpl; ++
i) {
355 new_range.
add(
impl.range()->build_range());
357 if (last_field ==
impl.range()->field()->name()) {
361 result.add(std::move(new_range));
372 const std::string& last_field)
const {
376 if (
"" == last_field) {
412 for (
size_t i = 0;
i < nimpl; ++
i) {
416 new_range.
add(
impl.range()->build_range());
418 if (last_field ==
impl.range()->field()->name()) {
422 result.add(std::move(new_range));
478 bool selected =
true;
491 if (!
impl.field().match(
id[
i])) {
505 if (0 == position &&
impl.bits() > 0) {
509 position -=
impl.bits();
510 packedId |= (
index << position);
526 size_t first_field_index)
const {
532 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
539 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
540 << region_index <<
" " <<
m_regions.size() << std::endl;
551 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
555 if (
index1 < first_field_index) {
556 std::cout <<
"IdDictDictionary::pack32 - first_field_index > index1 "
557 << first_field_index <<
" " <<
index1 << std::endl;
564 if (!first_field_index) {
566 position -=
impl.bits_offset();
569 size_t field_index = 0;
575 if (!
impl.ored_field().match(
fields[field_index])) {
576 std::cout <<
"IdDictDictionary::pack32 - field does NOT match: value, allowed values "
577 <<
fields[field_index] <<
" " << (std::string)
impl.ored_field()
584 if (0 == position &&
impl.bits() > 0) {
585 std::cout <<
"IdDictDictionary::pack32 - going past 0" << std::endl;
591 if (
impl.decode_index()) {
597 position -=
impl.bits();
598 packedId |= (
index << position);
617 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
624 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
625 << region_index <<
" " <<
m_regions.size() << std::endl;
636 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
642 size_t field_index = 0;
689 const std::string&
sep,
690 std::string& unpackedId)
const
694 std::vector<const IdDictFieldImplementation*> impls;
700 assert (unpacked.
fields() == impls.size());
701 for (
size_t i = 0;
i < unpacked.
fields(); ++
i) {
704 std::string str_value(
"nil");
718 switch (
range->specification()) {
729 str_value +=
range->field()->name() +
' ';
731 str_value +=
range->label();
740 if (
label->valued()) {
741 str_value +=
range->label();
749 for (
int v :
range->values()) {
756 str_value +=
range->field()->name() +
' ';
760 std::cout <<
"IdDictDictionary::unpack - Could not find value." << std::endl;
761 std::cout <<
"value " <<
value << std::endl;
762 std::cout <<
"field values " << std::endl;
763 for (
int v :
range->values()) {
764 std::cout <<
v <<
" ";
766 std::cout << std::endl;
773 std::cout <<
"unknown" << std::endl;
778 if (
i > 0) unpackedId +=
sep;
779 unpackedId += str_value;
796 size_t first_field_index,
805 std::cout <<
"IdDictDictionary::unpack - region index too large. Index, nregions "
806 << region_index <<
" " <<
m_regions.size() << std::endl;
816 std::cout <<
"IdDictDictionary::unpack - field index too large. Index, nfields "
824 size_t prefix_offset = 0;
829 if (first_field_index) {
832 std::cout <<
"IdDictDictionary::unpack - first_field_index too large. Index, nfields "
844 if (
impl.bits() == 0) {
845 std::cout <<
"IdDictDictionary::unpack - no bits for this field. Region, field indexes "
846 << region_index <<
" " << field_index << std::endl;
851 if (
impl.bits() +
impl.bits_offset() - prefix_offset > position) {
852 std::cout <<
"IdDictDictionary::unpack - bits + offset too large. Region, field indexes, bits, offset "
853 << region_index <<
" " << field_index <<
" "
854 <<
impl.bits() <<
" " <<
impl.bits_offset() <<
" " << prefix_offset
863 size_t index =
id.extract(position -=
impl.bits() +
impl.bits_offset() - prefix_offset,
mask);
883 size_t first_field_index,
884 size_t begin_field_index,
885 size_t end_field_index,
890 std::cout <<
"IdDictDictionary::copy - region index too large. Index, nregions "
891 << region_index <<
" " <<
m_regions.size() << std::endl;
900 std::cout <<
"IdDictDictionary::copy - field index too large. Indexes first, begin, end, nfields "
901 << first_field_index <<
" "
902 << begin_field_index <<
" "
903 << end_field_index <<
" "
909 size_t missing_offset = 0;
910 if (first_field_index) {
911 if (first_field_index > begin_field_index) {
912 std::cout <<
"IdDictDictionary::copy - first_field_index > begin_field_index. Indexes "
913 << first_field_index <<
" " << begin_field_index << std::endl;
920 size_t prefix_offset = 0;
921 if (begin_field_index) {
922 if (begin_field_index > end_field_index) {
923 std::cout <<
"IdDictDictionary::copy - begin_field_index > end_field_index. Indexes "
924 << begin_field_index <<
" " << end_field_index << std::endl;
932 size_t suffix_offset =
impl.bits() +
impl.bits_offset();
936 if (position < prefix_offset - missing_offset) {
937 std::cout <<
"IdDictDictionary::copy - position < prefix + missing. "
938 << prefix_offset <<
" " << missing_offset << std::endl;
943 if (position < suffix_offset + missing_offset) {
944 std::cout <<
"IdDictDictionary::copy - position < suffix + missing. "
945 << suffix_offset <<
" " << missing_offset << std::endl;
955 prefix_offset ? (
static_cast<Identifier::value_type>(1) << (position - prefix_offset + missing_offset)) - 1 : 0;
960 mask -= prefix_mask + suffix_mask;
1017 if (
mr.has_overlap())
return(
false);
1036 std::map< ExpandedIdentifier, IdDictDictEntry* > regions;
1044 std::cout <<
"IdDictDictionary::sort - WARNING verify is FALSE - cannot sort "
1091 std::cout <<
"=== IdDictDictionary " <<
m_name <<
" " <<
m_version <<
" "
JetConstituentVector::iterator iterator
IdDictRegion * find_region(const std::string ®ion_name) const
void dump() const
Dump regions and trees for each group.
virtual void clear() override
MultiRange build_multirange() const
Get MultiRange for full dictionary.
virtual Range build_range() const override
int reset(size_t index1, size_t index2, size_t region_index, Identifier &packedId) const
Reset fields from index1 to index2.
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
std::vector< IdDictGroup * > m_groups
void get_bits(const RV ®ions, size_t level, const std::string &group)
const IdDictRegion & region(size_t i) const
Region at index i.
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
IdDictLabel * find_label(const std::string &name) const
const std::string & name() const
Dictionary name.
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
const IdDictFieldImplementation & implementation(size_t i) const
std::map< std::string, IdDictField * > m_fields
IdDictGroup * find_group(const std::string &group_name) const
static constexpr value_type ALL_BITS
static constexpr unsigned int NBITS
bool m_generated_implementation
size_type bits_offset() const
groups_type::iterator groups_it
std::vector< IdDictRegion * > m_regions
groups_type::const_iterator groups_const_it
void add_subdictionary_name(const std::string &name)
regions_type::const_iterator regions_const_it
bool do_checks() const
Checks are performed by default in debug compilation and NOT in optimized compilation.
size_t n_implementation() const
int get_label_value(const std::string &field, const std::string &label, int &value) const
int unpack(const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix...
A MultiRange combines several Ranges.
void add_region(IdDictRegion *region)
std::string to_string(const DetectorType &type)
void add_field(IdDictField *field)
bool do_neighbours() const
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
regions_type::iterator regions_it
std::vector< IdDictRegion * > regions_type
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Identifier::size_type size_type
IdDictSubRegion * find_subregion(const std::string &subregion_name) const
std::vector< std::string > m_subdictionary_names
std::map< std::string, IdDictSubRegion * > m_subregions
void add_dictentry(IdDictDictEntry *entry)
void set_parent_dict(IdDictDictionary *parent_dict)
void add(element_type value)
Add a required value. (ie. low = high = value)
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.
const std::string & name() const
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)
virtual std::string group_name() const override
std::vector< IdDictRegion * > m_all_regions
virtual void resolve_references(const IdDictMgr &idd, IdDictDictionary &dictionary) override
void set_do_checks(bool do_checks)