ATLAS Offline Software
LArConditionsChannelSet.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
16 #ifndef LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
17 #define LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
18 
33 #include <vector>
34 
35 template<class T>
37 {
38 public:
39 
41  typedef unsigned int ChannelId;
42  typedef typename std::pair<ChannelId, T> ChanIdTPair;
43  typedef typename std::vector<ChanIdTPair> ChannelVector;
44  typedef typename ChannelVector::const_iterator ConstChannelIt;
46 
49 
51  virtual ~LArConditionsChannelSet();
52 
54  ConstChannelIt find(ChannelId id) const;
55 
57  ConstChannelIt begin() const;
58  ConstChannelIt end() const;
59 
61  size_t size() const;
62 
63 
66  void insert (ChannelId id, const T& cond);
67 
68 private:
69 
70  class PairSort
71  {
72  public:
73  bool operator () (const ChanIdTPair& x, const ChanIdTPair& y)
74  {
75  return (x.first < y.first);
76  }
77  bool operator () (const ChanIdTPair& x, const unsigned int& id)
78  {
79  return (x.first < id);
80  }
81  };
82 
84 };
85 
86 
87 // INLINE FUNCTIONS
88 
89 
90 template<class T>
91 inline
93 {}
94 
95 
96 template<class T>
97 inline
99 {}
100 
101 
102 template<class T>
103 inline
106 {
107  ConstChannelIt result = std::lower_bound(m_channelVec.begin(),
108  m_channelVec.end(),
109  id,
110  PairSort());
111 
112  if (result == m_channelVec.end()) return (result);
113  if ((*result).first == id) {
114  return (result);
115  } else {
116  return m_channelVec.end() ;
117  }
118 }
119 
120 
121 
122 template<class T>
123 inline
126 {
127  return (m_channelVec.begin());
128 }
129 
130 template<class T>
131 inline
134 {
135  return (m_channelVec.end());
136 }
137 
138 
139 
140 template<class T>
141 inline
142 size_t
144 {
145  return (m_channelVec.size());
146 }
147 
148 template<class T>
149 inline
150 void
152 {
153  m_channelVec.push_back(ChanIdTPair(id,cond));
154  std::sort(m_channelVec.begin(), m_channelVec.end(), PairSort());
155 }
156 
157 #endif // LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArConditionsChannelSet::ChannelIt
ChannelVector::iterator ChannelIt
Definition: LArConditionsChannelSet.h:45
get_generator_info.result
result
Definition: get_generator_info.py:21
LArConditionsChannelSet::insert
void insert(ChannelId id, const T &cond)
Insert a new channel id / T pair.
Definition: LArConditionsChannelSet.h:151
LArConditionsChannelSet::ChannelVector
std::vector< ChanIdTPair > ChannelVector
Definition: LArConditionsChannelSet.h:43
LArConditionsChannelSet::PairSort
Definition: LArConditionsChannelSet.h:71
x
#define x
LArConditionsChannelSet::LArConditionsChannelSet
LArConditionsChannelSet()
Default constructor.
Definition: LArConditionsChannelSet.h:92
LArConditionsChannelSet::find
ConstChannelIt find(ChannelId id) const
Access to a conditions object pair for a given channel id.
Definition: LArConditionsChannelSet.h:105
LArConditionsChannelSet
template class for use for I/O of conditions data correction sets
Definition: LArConditionsChannelSet.h:37
LArConditionsChannelSet::ConstChannelIt
ChannelVector::const_iterator ConstChannelIt
Definition: LArConditionsChannelSet.h:44
LArConditionsChannelSet::begin
ConstChannelIt begin() const
Iterators over channel set.
Definition: LArConditionsChannelSet.h:125
LArConditionsChannelSet::ChanIdTPair
std::pair< ChannelId, T > ChanIdTPair
Definition: LArConditionsChannelSet.h:42
y
#define y
LArConditionsChannelSet::ChannelId
unsigned int ChannelId
Public typedefs.
Definition: LArConditionsChannelSet.h:41
LArConditionsChannelSet::end
ConstChannelIt end() const
Definition: LArConditionsChannelSet.h:133
LArConditionsChannelSet::size
size_t size() const
Size of channel set.
Definition: LArConditionsChannelSet.h:143
LArConditionsChannelSet::~LArConditionsChannelSet
virtual ~LArConditionsChannelSet()
destructor
Definition: LArConditionsChannelSet.h:98
LArConditionsChannelSet::PairSort::operator()
bool operator()(const ChanIdTPair &x, const ChanIdTPair &y)
Definition: LArConditionsChannelSet.h:73
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
LArConditionsChannelSet::m_channelVec
ChannelVector m_channelVec
Definition: LArConditionsChannelSet.h:83