ATLAS Offline Software
Loading...
Searching...
No Matches
IndexSet.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6// 09.05.2005, AUTHOR: OLIVER KORTNER
7// Modified: 16.07.2006 by O. Kortner, vector size check in initialization
8// added,
9// != operator corrected.
10//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
12#ifndef IndexSetHXX
13#define IndexSetHXX
14
15//::::::::::::::::::::
16//:: CLASS IndexSet ::
17//::::::::::::::::::::
18
27
29// HEADER FILES //
31
32// standard C++ libraries //
33#include <iostream>
34
35// STEL //
36#include <vector>
37
38namespace MuonCalib {
39
40 class IndexSet {
41 private:
42 // internal index memory //
43 unsigned int m_nb_indices; // number of indices
44 std::vector<int> m_index; // indices
45
46 // initialization methods //
47 void init();
48 // default initiailization method; the number of indices is set to 0
49 void init(const unsigned int& r_nb_indices);
50 // initialization method; the number of indices is set to r_nb_indices
51 void init(const unsigned int& r_nb_indices, const std::vector<int>& r_index);
52 // initialization method; the number of indices is set to
53 // r_nb_indices, the vector r_index contains the indices
54
55 public:
56 // Constructors //
57 IndexSet() { init(); }
59
60 IndexSet(const unsigned int& r_nb_indices) { init(r_nb_indices); }
62
63 IndexSet(const unsigned int& r_nb_indices, const std::vector<int>& r_index) { init(r_nb_indices, r_index); }
66
67 // Methods //
68 unsigned int size() const;
70 void resize(const unsigned int& r_size);
74 int operator[](const unsigned int& r_k);
75 int operator[](const unsigned int& r_k) const;
81 void sort();
83 bool operator==(const IndexSet& r_index_set) const;
84 bool operator!=(const IndexSet& r_index_set) const;
90 };
91
92} // namespace MuonCalib
93
94#endif
int operator[](const unsigned int &r_k)
:::::::::::::::::::::::
Definition IndexSet.cxx:121
void sort()
sort the indices in ascending order
Definition IndexSet.cxx:137
IndexSet(const unsigned int &r_nb_indices)
constructor: the number of indices is set to r_nb_indices
Definition IndexSet.h:60
bool operator==(const IndexSet &r_index_set) const
Definition IndexSet.cxx:148
unsigned int m_nb_indices
Definition IndexSet.h:43
unsigned int size() const
get the number of indices
Definition IndexSet.cxx:82
void resize(const unsigned int &r_size)
resize the index set to r_size; the index store is preserved as far as possible
Definition IndexSet.cxx:90
IndexSet()
default constructor: the number of indices is set to 0
Definition IndexSet.h:57
IndexSet(const unsigned int &r_nb_indices, const std::vector< int > &r_index)
constructor: the number of indices is set to r_nb_indices, the vector r_index contains the indices
Definition IndexSet.h:63
bool operator!=(const IndexSet &r_index_set) const
comparison of two index sets; two index sets are considered equal if they are of the same size and th...
Definition IndexSet.cxx:164
std::vector< int > m_index
Definition IndexSet.h:44
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.