ATLAS Offline Software
MultiRange.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 IDENTIFIER_MULTIRANGE_H
6 #define IDENTIFIER_MULTIRANGE_H
7 
8 
10 #include "Identifier/Range.h"
12 #include <vector>
13 #include <iosfwd>
14 #include <string>
15 
17 class MultiRange {
18 public:
19  using range_vector = std::vector<Range> ;
22  using const_iterator = range_vector::const_iterator;
23 
31  public:
32  identifier_factory () = default;
33  identifier_factory (const MultiRange& multirange);
34  void operator ++ ();
35  const ExpandedIdentifier& operator * () const;
36  bool operator == (const identifier_factory& other) const;
37 
38  private:
39  using id_vec = std::vector<ExpandedIdentifier>;
41  using id_const_iterator = id_vec::const_iterator;
42 
46  range_vector::const_iterator m_range_it;
47  range_vector::const_iterator m_range_end;
50  };
51 
53  public:
55  const_identifier_factory (const MultiRange& multirange);
56  void operator ++ ();
57  const ExpandedIdentifier& operator * () const;
58  bool operator == (const const_identifier_factory& other) const;
59 
60  private:
61  using id_vec = std::vector<ExpandedIdentifier>;
63  using id_const_iterator = id_vec::const_iterator;
64 
68  range_vector::const_iterator m_range_it;
69  range_vector::const_iterator m_range_end;
72  };
73 
74  MultiRange () = default;
79  MultiRange (const Range& r, const Range& s);
80 
81  void clear ();
82 
83  void add (const Range& range);
84 
86  void add (Range&& range);
87 
89  void add (const ExpandedIdentifier& id);
90 
92  void remove_range (const ExpandedIdentifier& id);
93 
95  Range& back ();
96 
98  int match (const ExpandedIdentifier& id) const;
99 
101  const Range& operator [] (size_type index) const;
102  size_type size () const;
103  const_iterator begin () const;
104  const_iterator end () const;
105 
109  size_type cardinality () const;
110 
111  // Up to a given id
112  size_type cardinalityUpTo (const ExpandedIdentifier& id) const;
113 
115  bool has_overlap() const;
116 
117  // identifier_factory management
122  void show () const;
123  void show (std::ostream& s) const;
125  operator std::string () const;
126 
127  private:
128  friend class identifier_factory;
130  using id_vec = std::vector<ExpandedIdentifier>;
132 };
133 
134 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
beamspotman.r
def r
Definition: beamspotman.py:676
ConstRangeIterator
Definition: RangeIterator.h:46
MultiRange::const_identifier_factory::operator==
bool operator==(const const_identifier_factory &other) const
Definition: MultiRange.cxx:232
MultiRange::const_identifier_factory::m_id_fac_it
ConstRangeIterator m_id_fac_it
Definition: MultiRange.h:66
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MultiRange::operator[]
const Range & operator[](size_type index) const
Accessors.
Definition: MultiRange.cxx:63
MultiRange::identifier_factory::operator==
bool operator==(const identifier_factory &other) const
Definition: MultiRange.cxx:181
MultiRange::id_vec
std::vector< ExpandedIdentifier > id_vec
Definition: MultiRange.h:130
MultiRange::identifier_factory::operator++
void operator++()
Definition: MultiRange.cxx:155
MultiRange::factory_begin
identifier_factory factory_begin()
Definition: MultiRange.cxx:112
index
Definition: index.py:1
MultiRange::factory_end
identifier_factory factory_end()
Definition: MultiRange.cxx:124
MultiRange::add
void add(const Range &range)
Definition: MultiRange.cxx:22
MultiRange::identifier_factory::m_id_fac_end
ConstRangeIterator m_id_fac_end
Definition: MultiRange.h:45
MultiRange::clear
void clear()
Definition: MultiRange.cxx:17
MultiRange::range_vector
std::vector< Range > range_vector
Definition: MultiRange.h:19
MultiRange::cardinalityUpTo
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
Definition: MultiRange.cxx:88
Range.h
MultiRange::identifier_factory::id_const_iterator
id_vec::const_iterator id_const_iterator
Definition: MultiRange.h:41
MultiRange::size_type
ExpandedIdentifier::size_type size_type
Definition: MultiRange.h:21
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
ExpandedIdentifier.h
MultiRange::const_identifier_factory::m_range_it
range_vector::const_iterator m_range_it
Definition: MultiRange.h:68
MultiRange::element_type
ExpandedIdentifier::element_type element_type
Definition: MultiRange.h:20
MultiRange::identifier_factory
This factory is able to generate all possible identifiers, from a fully bounded Range.
Definition: MultiRange.h:30
MultiRange::identifier_factory::m_id_vec_it
id_iterator m_id_vec_it
Definition: MultiRange.h:48
MultiRange::identifier_factory::m_range_it
range_vector::const_iterator m_range_it
Definition: MultiRange.h:46
MultiRange::const_identifier_factory::id_vec
std::vector< ExpandedIdentifier > id_vec
Definition: MultiRange.h:61
MultiRange::m_ranges
range_vector m_ranges
Definition: MultiRange.h:131
MultiRange::const_identifier_factory::m_range_end
range_vector::const_iterator m_range_end
Definition: MultiRange.h:69
MultiRange::identifier_factory::id_iterator
id_vec::iterator id_iterator
Definition: MultiRange.h:40
MultiRange::const_identifier_factory::m_id_fac_end
ConstRangeIterator m_id_fac_end
Definition: MultiRange.h:67
MultiRange::const_identifier_factory
Definition: MultiRange.h:52
MultiRange::remove_range
void remove_range(const ExpandedIdentifier &id)
Remove a Range made from a single ExpandedIdentifier.
Definition: MultiRange.cxx:43
MultiRange::const_identifier_factory::const_identifier_factory
const_identifier_factory()=default
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
MultiRange::const_identifier_factory::m_id
ExpandedIdentifier m_id
Definition: MultiRange.h:65
MultiRange::begin
const_iterator begin() const
Definition: MultiRange.cxx:74
MultiRange::identifier_factory::identifier_factory
identifier_factory()=default
ExpandedIdentifier::size_type
boost::container::small_vector< element_type, 12 >::size_type size_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:112
MultiRange::back
Range & back()
Get the last entered Range.
Definition: MultiRange.cxx:52
MultiRange::has_overlap
bool has_overlap() const
Check if there are overlaps between any couple of Ranges.
Definition: MultiRange.cxx:98
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
RangeIterator.h
MultiRange::const_identifier_factory::m_id_vec_it
id_iterator m_id_vec_it
Definition: MultiRange.h:70
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
MultiRange::identifier_factory::m_id_fac_it
ConstRangeIterator m_id_fac_it
Definition: MultiRange.h:44
MultiRange::const_identifier_factory::id_const_iterator
id_vec::const_iterator id_const_iterator
Definition: MultiRange.h:63
MultiRange::const_iterator
range_vector::const_iterator const_iterator
Definition: MultiRange.h:22
MultiRange::MultiRange
MultiRange()=default
MultiRange::match
int match(const ExpandedIdentifier &id) const
Match an identifier.
Definition: MultiRange.cxx:57
MultiRange::const_identifier_factory::operator*
const ExpandedIdentifier & operator*() const
Definition: MultiRange.cxx:227
MultiRange::const_identifier_factory::operator++
void operator++()
Definition: MultiRange.cxx:206
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MultiRange::end
const_iterator end() const
Definition: MultiRange.cxx:78
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
MultiRange::const_identifier_factory::id_iterator
id_vec::iterator id_iterator
Definition: MultiRange.h:62
MultiRange::identifier_factory::m_range_end
range_vector::const_iterator m_range_end
Definition: MultiRange.h:47
MultiRange::show
void show() const
Definition: MultiRange.cxx:237
MultiRange::identifier_factory::operator*
const ExpandedIdentifier & operator*() const
Definition: MultiRange.cxx:176
MultiRange::cardinality
size_type cardinality() const
Computes a possible cardinality from all ranges.
Definition: MultiRange.cxx:82
MultiRange::const_identifier_factory::m_id_vec_end
id_iterator m_id_vec_end
Definition: MultiRange.h:71
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
MultiRange::identifier_factory::m_id
ExpandedIdentifier m_id
Definition: MultiRange.h:43
MultiRange::identifier_factory::id_vec
std::vector< ExpandedIdentifier > id_vec
Definition: MultiRange.h:39
MultiRange::identifier_factory::m_id_vec_end
id_iterator m_id_vec_end
Definition: MultiRange.h:49