ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileIdentifier
src
TileFragHash.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
TileIdentifier/TileFragHash.h
"
7
#include "
TileIdentifier/TileHWID.h
"
8
#include <cassert>
9
#include <cstring>
10
11
// This class converts a Frag_ID into a integer, according to its
12
// value of (ROS and drawer number).
13
14
// default contructor
15
TileFragHash::TileFragHash
( )
16
:
m_size
(0)
17
,
m_offset
(0)
18
,
m_type
(
Default
)
19
{
20
memset(
m_lookup
,0,
sizeof
(
m_lookup
));
21
}
22
23
void
TileFragHash::initialize
(
const
TileHWID
* tileHWID,
TYPE
type
)
24
{
25
// std::cout << " TileFragHash Constructor "<< std::endl;
26
27
m_type
=
type
;
28
m_size
= 0;
29
if
(!tileHWID)
return
;
30
m_int2id
.clear();
31
m_int2id
.reserve(tileHWID->
drawer_hash_max
());
32
33
for
(
int
i = 0; i<
m_table_size
; ++i) {
m_lookup
[i]=-1; }
34
36
std::vector<HWIdentifier>::const_iterator first = tileHWID->
drawer_begin
();
37
std::vector<HWIdentifier>::const_iterator last = tileHWID->
drawer_end
();
38
39
switch
(
type
) {
40
case
Beam
:
41
m_offset
= 0;
42
for
( ; first!=last; ++first) {
43
ID
id
= tileHWID->
frag
(*first);
44
if
(
id
>= 0x100)
continue
;
// skip all real drawers
45
assert(
id
>=0 &&
id
<
m_table_size
);
46
47
m_int2id
.push_back(
id
);
48
m_lookup
[id] = (
m_size
++);
49
}
50
// std::cout << " Number of valid Beam frag IDs "<< m_size << std::endl;
51
break
;
52
default
:
53
m_offset
= (int)
type
* 0x1000;
54
for
( ; first!=last; ++first) {
55
ID
id
= tileHWID->
frag
(*first);
56
if
(
id
< 0x100)
continue
;
// skip Beam ROD frags
57
assert(
id
>=0 &&
id
<
m_table_size
);
58
59
m_int2id
.push_back(
id
);
60
m_lookup
[id] = (
m_size
++);
61
}
62
// std::cout << " Number of valid drawer IDs "<< m_size << std::endl;
63
break
;
64
}
65
}
66
67
TileFragHash::ID
TileFragHash::identifier
(
int
index
)
const
68
{
69
assert(
index
>=0 &&
index
<
m_size
);
70
71
return
m_int2id
[
index
];
72
}
73
74
int
TileFragHash::hash
(
const
ID
&
id
)
const
75
{
76
assert(
id
>=0 &&
id
<
m_table_size
);
77
78
return
m_lookup
[id];
79
}
80
81
85
std::string
TileFragHash::typeToString
(
TYPE
type
)
86
{
87
switch
(
type
) {
88
#define CASE(X) case TileFragHash::X: return #X
89
CASE
(
Digitizer
);
90
CASE
(
OptFilterDsp
);
91
CASE
(
OptFilterOffline
);
92
CASE
(
OptFilterDspCompressed
);
93
CASE
(
ManyAmps
);
94
CASE
(
MF
);
95
CASE
(
FitFilter
);
96
CASE
(
FitFilterCool
);
97
CASE
(
FlatFilter
);
98
CASE
(
Beam
);
99
#undef CASE
100
default
:
break
;
101
};
102
return
"UNKNOWN"
;
103
}
CASE
#define CASE(X)
TileFragHash.h
TileHWID.h
TileFragHash::TYPE
TYPE
initialize
Definition
TileFragHash.h:33
TileFragHash::FitFilter
@ FitFilter
Definition
TileFragHash.h:35
TileFragHash::OptFilterOffline
@ OptFilterOffline
Definition
TileFragHash.h:34
TileFragHash::MF
@ MF
Definition
TileFragHash.h:35
TileFragHash::Digitizer
@ Digitizer
Definition
TileFragHash.h:33
TileFragHash::FitFilterCool
@ FitFilterCool
Definition
TileFragHash.h:35
TileFragHash::Default
@ Default
Definition
TileFragHash.h:33
TileFragHash::OptFilterDspCompressed
@ OptFilterDspCompressed
Definition
TileFragHash.h:34
TileFragHash::FlatFilter
@ FlatFilter
Definition
TileFragHash.h:35
TileFragHash::ManyAmps
@ ManyAmps
Definition
TileFragHash.h:35
TileFragHash::OptFilterDsp
@ OptFilterDsp
Definition
TileFragHash.h:34
TileFragHash::Beam
@ Beam
Definition
TileFragHash.h:33
TileFragHash::initialize
void initialize(const TileHWID *tileHWID, TYPE type=Default)
Definition
TileFragHash.cxx:23
TileFragHash::m_type
TYPE m_type
Definition
TileFragHash.h:67
TileFragHash::hash
int hash(const ID &id) const
Convert ID to int (same as the converter, but easier to call from python).
Definition
TileFragHash.cxx:74
TileFragHash::ID
int ID
Definition
TileFragHash.h:28
TileFragHash::m_offset
int m_offset
Definition
TileFragHash.h:66
TileFragHash::typeToString
static std::string typeToString(TYPE type)
Printable representation of a type.
Definition
TileFragHash.cxx:85
TileFragHash::m_size
int m_size
total number of IDs
Definition
TileFragHash.h:65
TileFragHash::m_lookup
int m_lookup[m_table_size]
Definition
TileFragHash.h:71
TileFragHash::identifier
ID identifier(int i) const
reverse conversion
Definition
TileFragHash.cxx:67
TileFragHash::m_int2id
std::vector< ID > m_int2id
Definition
TileFragHash.h:73
TileFragHash::type
TYPE type() const
return hash type
Definition
TileFragHash.h:56
TileFragHash::TileFragHash
TileFragHash()
Definition
TileFragHash.cxx:15
TileFragHash::m_table_size
static const int m_table_size
lookup table
Definition
TileFragHash.h:70
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition
TileHWID.h:49
TileHWID::frag
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
Definition
TileHWID.h:181
TileHWID::drawer_end
std::vector< HWIdentifier >::const_iterator drawer_end() const
end iterator for drawer Identifiers
Definition
TileHWID.h:294
TileHWID::drawer_begin
std::vector< HWIdentifier >::const_iterator drawer_begin() const
begin iterator for drawer Identifiers
Definition
TileHWID.h:290
TileHWID::drawer_hash_max
size_type drawer_hash_max() const
drawer hash table max size
Definition
TileHWID.h:268
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0