ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArBadChannelTool
LArBadChannelTool
BadChanContainerHashed.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef BadChanContainerHashed_H
6
#define BadChanContainerHashed_H
7
8
template
<
class
Chan,
class
State,
class
Hasher>
9
class
BadChanContainerHashed
{
10
public
:
11
12
typedef
std::pair<Chan,State>
BadChanEntry
;
13
typedef
std::vector<BadChanEntry>
BadChanVec
;
14
typedef
typename
BadChanVec::const_iterator
const_iterator
;
15
typedef
typename
BadChanVec::size_type
size_type
;
16
17
public
:
18
19
BadChanContainerHashed
() {}
20
21
explicit
BadChanContainerHashed
(
const
Hasher&
h
) :
m_hasher
(
h
) {}
22
23
BadChanContainerHashed
(
const
BadChanVec
&
vec
) {
set
(
vec
);}
24
25
State
status
(
const
Chan& channel)
const
;
26
27
State
status
(
const
Chan& feb,
int
ch)
const
{
return
m_vec
.at(
m_hasher
.hash( feb, ch));}
28
29
const_iterator
begin
()
const
{
return
m_bcv
.begin();}
30
const_iterator
end
()
const
{
return
m_bcv
.end();}
31
size_type
size
()
const
{
return
m_bcv
.size();}
32
34
void
clear
() {
m_vec
.clear();
m_bcv
.clear();}
35
36
void
set
(
const
BadChanVec
& cont);
37
38
void
setHasher
(
const
Hasher& hasher) {
m_hasher
= hasher;}
39
40
private
:
41
42
typedef
unsigned
int
HashType
;
43
44
std::vector<State>
m_vec
;
45
Hasher
m_hasher
;
46
BadChanVec
m_bcv
;
47
48
// these methods should move to a Hasher class
49
HashType
hash
( Chan ch)
const
{
return
m_hasher
.hash(ch);}
50
// Chan unhash( HashType h) const;
51
HashType
maxHash
()
const
{
return
m_hasher
.maxHash();}
52
53
};
54
55
template
<
class
Chan,
class
State,
class
Hasher>
56
inline
State
BadChanContainerHashed<Chan,State,Hasher>::status
(
const
Chan& channel)
const
57
{
58
return
m_vec
[
hash
( channel)];
59
}
60
61
template
<
class
Chan,
class
State,
class
Hasher>
62
inline
void
BadChanContainerHashed<Chan,State,Hasher>::set
(
const
BadChanVec
& cont)
63
{
64
State good;
// default constructed state is good
65
if
(
m_vec
.size() ==
maxHash
()) {
66
for
(
typename
std::vector<State>::iterator i=
m_vec
.begin(); i!=
m_vec
.end(); ++i) {
67
*i = good;
// reset all channels to good
68
}
69
}
70
else
{
71
std::vector<State> tmp(
maxHash
(), good);
// all channels good
72
m_vec
.swap(tmp);
73
}
74
for
(
typename
BadChanVec::const_iterator i=cont.begin(); i!=cont.end(); ++i) {
75
// m_vec.at( hash( i->first)) = i->second; // skip invalid hash values
76
HashType
h
=
hash
( i->first);
77
if
(
h
<
maxHash
())
m_vec
[
h
] = i->second;
78
}
79
80
m_bcv
= cont;
81
}
82
83
84
#endif
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
h
Header file for AthHistogramAlgorithm.
BadChanContainerHashed::BadChanContainerHashed
BadChanContainerHashed(const Hasher &h)
Definition
BadChanContainerHashed.h:21
BadChanContainerHashed::m_bcv
BadChanVec m_bcv
Definition
BadChanContainerHashed.h:46
BadChanContainerHashed::begin
const_iterator begin() const
Definition
BadChanContainerHashed.h:29
BadChanContainerHashed::status
State status(const Chan &feb, int ch) const
Definition
BadChanContainerHashed.h:27
BadChanContainerHashed::BadChanContainerHashed
BadChanContainerHashed()
Definition
BadChanContainerHashed.h:19
BadChanContainerHashed::m_hasher
Hasher m_hasher
Definition
BadChanContainerHashed.h:45
BadChanContainerHashed::BadChanVec
std::vector< BadChanEntry > BadChanVec
Definition
BadChanContainerHashed.h:13
BadChanContainerHashed::maxHash
HashType maxHash() const
Definition
BadChanContainerHashed.h:51
BadChanContainerHashed::setHasher
void setHasher(const Hasher &hasher)
Definition
BadChanContainerHashed.h:38
BadChanContainerHashed::HashType
unsigned int HashType
Definition
BadChanContainerHashed.h:42
BadChanContainerHashed::status
State status(const Chan &channel) const
Definition
BadChanContainerHashed.h:56
BadChanContainerHashed::size_type
BadChanVec::size_type size_type
Definition
BadChanContainerHashed.h:15
BadChanContainerHashed::BadChanContainerHashed
BadChanContainerHashed(const BadChanVec &vec)
Definition
BadChanContainerHashed.h:23
BadChanContainerHashed::const_iterator
BadChanVec::const_iterator const_iterator
Definition
BadChanContainerHashed.h:14
BadChanContainerHashed::BadChanEntry
std::pair< Chan, State > BadChanEntry
Definition
BadChanContainerHashed.h:12
BadChanContainerHashed::set
void set(const BadChanVec &cont)
Definition
BadChanContainerHashed.h:62
BadChanContainerHashed::end
const_iterator end() const
Definition
BadChanContainerHashed.h:30
BadChanContainerHashed::size
size_type size() const
Definition
BadChanContainerHashed.h:31
BadChanContainerHashed::m_vec
std::vector< State > m_vec
Definition
BadChanContainerHashed.h:44
BadChanContainerHashed::clear
void clear()
Deletes the contents and sets size to 0 (same as stl::vector<T>::clear()).
Definition
BadChanContainerHashed.h:34
BadChanContainerHashed::hash
HashType hash(Chan ch) const
Definition
BadChanContainerHashed.h:49
Generated on
for ATLAS Offline Software by
1.17.0