ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1TGC
src
TGCTMDB.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1TGC/TGCTMDB.h
"
6
7
#include "
AthenaBaseComps/AthCheckMacros.h
"
8
9
namespace
LVL1TGC
{
10
11
TGCTMDB::TGCTMDB
()
12
:
AthMessaging
(
"LVL1TGC::TGCTMDB"
)
13
{
14
for
(
size_t
side=0; side <
TGCSide::kNSide
; side++) {
15
for
(
size_t
mod=0; mod <
kNTileModule
; mod++) {
16
m_buffer
[side][mod] = std::make_shared<TGCTMDBOut>(side, mod);
17
}
18
}
19
}
20
21
22
StatusCode
TGCTMDB::retrieve
(
const
SG::ReadHandleKey<TileMuonReceiverContainer>
& key,
23
const
EventContext& ctx)
24
{
25
ATH_MSG_DEBUG
(
"fillTMDB"
);
26
27
// clear TMDB
28
this->
eraseOutput
();
29
30
SG::ReadHandle<TileMuonReceiverContainer>
readTileMuonReceiverContainer(key, ctx);
31
ATH_CHECK
( readTileMuonReceiverContainer.
isValid
() );
32
33
// loop over all TileMuonReceiverObj in container
34
TileMuonReceiverContainer::const_iterator
tmItr = readTileMuonReceiverContainer->begin();
35
36
const
TileMuonReceiverObj
* tmObj_Thresholds = *tmItr;
37
if
( (tmObj_Thresholds->
GetThresholds
()).size() == 4) {
38
float
thresholds[4];
39
for
(
size_t
ip=0;ip<4;ip++){
40
thresholds[ip] = (tmObj_Thresholds->
GetThresholds
()).at(ip);
41
}
42
ATH_MSG_DEBUG
(
"thresholds[] :"
<< thresholds[0] << thresholds[1] << thresholds[2] << thresholds[3] );
43
ATH_MSG_DEBUG
(
"type of GetThreshold : "
<<
typeid
((tmObj_Thresholds->
GetThresholds
())).name()
44
<<
" ID of GetThreshold : "
45
<< tmObj_Thresholds->
GetID
() );
46
}
47
48
49
//clear tmobj_Threshols
50
tmObj_Thresholds = 0;
51
// m_id and decision , etc ... from
52
++tmItr;
53
54
for
( ; tmItr != readTileMuonReceiverContainer->end(); ++tmItr) {
55
56
const
TileMuonReceiverObj
* tmObj = *tmItr;
57
// Tile Module
58
unsigned
int
moduleID =
static_cast<
unsigned
int
>
(tmObj->
GetID
());
59
unsigned
int
sideID = (moduleID & 0xf00) >> 8;
60
unsigned
int
mod = (moduleID & 0x0ff);
// 0...63
61
// TMDB decision
62
bool
tile2SL[4];
63
// [0] [1] [2] [3]
64
// d5d6_hi d5d6_lo d6_hi d6_lo
65
for
(
size_t
ip=0;ip<4;ip++){
66
tile2SL[ip] = (tmObj->
GetDecision
()).at(ip);
67
}
68
//if ( moduleID < 300 || (moduleID > 363 && moduleID < 400) || moduleID > 463 ||
69
if
( mod > 63 || (sideID !=3 && sideID !=4) ||
70
((tmObj->
GetDecision
()).size() != 4) ) {
71
continue
;
72
}
else
{
73
74
TGCSide
side =
TGCSide::kNSide
;
75
if
(sideID == 3) {
76
side =
TGCSide::ASIDE
;
77
}
else
if
(sideID == 4) {
78
side =
TGCSide::CSIDE
;
79
}
80
// setOutput(side, mod, hit56, hit6) -> hit56, 6
81
TGCTMDBOut::TileModuleHit
hit56 =
TGCTMDBOut::TM_NA
;
82
TGCTMDBOut::TileModuleHit
hit6 =
TGCTMDBOut::TM_NA
;
83
if
(tile2SL[0] ==
true
&& tile2SL[1] ==
false
) {
84
hit56 =
TGCTMDBOut::TM_HIGH
;
85
}
else
if
(tile2SL[0] ==
false
&& tile2SL[1] ==
true
) {
86
hit56 =
TGCTMDBOut::TM_LOW
;
87
}
else
if
(tile2SL[0] ==
false
&& tile2SL[1] ==
false
) {
88
hit56 =
TGCTMDBOut::TM_NOHIT
;
89
}
90
91
if
(tile2SL[2] ==
true
&& tile2SL[3] ==
false
) {
92
hit6 =
TGCTMDBOut::TM_HIGH
;
93
}
else
if
(tile2SL[2] ==
false
&& tile2SL[3] ==
true
) {
94
hit6 =
TGCTMDBOut::TM_LOW
;
95
}
else
if
(tile2SL[2] ==
false
&& tile2SL[3] ==
false
) {
96
hit6 =
TGCTMDBOut::TM_NOHIT
;
97
}
98
99
TGCTMDBOut::TileModuleHit
prehit56 = this->
getOutput
(side, mod)->getHit56();
100
TGCTMDBOut::TileModuleHit
prehit6 = this->
getOutput
(side, mod)->getHit6();
101
if
(prehit56 !=
TGCTMDBOut::TM_NA
&& prehit56 > hit56) { hit56=prehit56; }
102
if
(prehit6 !=
TGCTMDBOut::TM_NA
&& prehit6 > hit6) { hit6=prehit6; }
103
104
this->
setOutput
(side, mod, hit56, hit6);
105
}
106
}
107
108
return
StatusCode::SUCCESS;
109
}
110
111
112
113
std::shared_ptr<const TGCTMDBOut>
TGCTMDB::getOutput
(
const
TGCSide
side,
unsigned
int
mod)
const
{
114
if
(side >=
TGCSide::kNSide
)
return
0;
115
if
(mod >=
kNTileModule
)
return
0;
116
return
m_buffer
[side][mod];
117
}
118
119
std::shared_ptr<const TGCTMDBOut>
TGCTMDB::getOutput
(
const
TGCSide
side,
int
sector,
unsigned
int
mod)
const
120
{
121
if
(side >=
TGCSide::kNSide
)
return
0;
122
if
((sector<0)||(sector>47))
return
0;
123
if
(mod>3)
return
0;
124
int
octant = sector / 6;
125
int
sec = sector % 6;
126
int
offset = 0;
127
if
(sec==0) offset = -4;
128
else
if
(sec==1) offset = -4;
// same SL board as sec#0
129
else
if
(sec==2) offset = 0;
130
else
if
(sec==3) offset = 0;
// same SL board as sec#1
131
else
if
(sec==4) offset = 2;
132
else
if
(sec==5) offset = 2;
// same SL board as sec#2
133
int
moduleID = (octant*(
kNTileModule
/8) + offset +
kNTileModule
) %
kNTileModule
;
134
moduleID = (moduleID + mod) %
kNTileModule
;
135
return
m_buffer
[side][moduleID];
136
}
137
138
void
TGCTMDB::setOutput
(
const
TGCSide
side,
const
unsigned
int
module,
139
const
TGCTMDBOut::TileModuleHit
hit56,
140
const
TGCTMDBOut::TileModuleHit
hit6)
141
{
142
if
(module>=
kNTileModule
)
return
;
143
m_buffer
.at(side)[module]->setHit56(hit56);
144
m_buffer
.at(side)[module]->setHit6(hit6);
145
}
146
147
void
TGCTMDB::eraseOutput
() {
148
for
(
auto
&perside :
m_buffer
) {
149
for
(
auto
&mod : perside) mod->clear();
150
}
151
}
152
153
int
TGCTMDB::getInnerTileBits
(
const
TGCSide
side,
int
sector)
const
154
{
155
int
inner_tile = 0;
156
157
for
(
int
ii = 0; ii < 4; ii++) {
158
TGCTMDBOut::TileModuleHit
hit56 =
getOutput
(side, sector, ii)->getHit56();
159
TGCTMDBOut::TileModuleHit
hit6 =
getOutput
(side, sector, ii)->getHit6();
160
161
int
tmp_56 = (hit56 ==
TGCTMDBOut::TM_LOW
|| hit56 ==
TGCTMDBOut::TM_HIGH
) ? 1 : 0;
162
int
tmp_6 = (hit6 ==
TGCTMDBOut::TM_LOW
|| hit6 ==
TGCTMDBOut::TM_HIGH
) ? 1 : 0;
163
164
int
tmp_all = (tmp_6 << 1) | (tmp_56);
165
166
inner_tile |= (tmp_all << (ii*2));
167
}
168
169
return
inner_tile;
170
}
171
172
void
TGCTMDB::print
()
const
{
173
for
(
auto
&perside :
m_buffer
) {
174
for
(
auto
&mod : perside) mod->print();
175
}
176
}
177
178
179
}
// end of namespace
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TGCTMDB.h
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
TileContainer< TileMuonReceiverObj >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
LVL1TGC::TGCTMDBOut::TileModuleHit
TileModuleHit
Definition
TGCTMDBOut.h:13
LVL1TGC::TGCTMDBOut::TM_NA
@ TM_NA
Definition
TGCTMDBOut.h:13
LVL1TGC::TGCTMDBOut::TM_LOW
@ TM_LOW
Definition
TGCTMDBOut.h:13
LVL1TGC::TGCTMDBOut::TM_HIGH
@ TM_HIGH
Definition
TGCTMDBOut.h:13
LVL1TGC::TGCTMDBOut::TM_NOHIT
@ TM_NOHIT
Definition
TGCTMDBOut.h:13
LVL1TGC::TGCTMDB::print
void print() const
Definition
TGCTMDB.cxx:172
LVL1TGC::TGCTMDB::eraseOutput
void eraseOutput()
Definition
TGCTMDB.cxx:147
LVL1TGC::TGCTMDB::retrieve
StatusCode retrieve(const SG::ReadHandleKey< TileMuonReceiverContainer > &key, const EventContext &ctx)
Definition
TGCTMDB.cxx:22
LVL1TGC::TGCTMDB::getOutput
std::shared_ptr< const TGCTMDBOut > getOutput(const TGCSide side, unsigned int moduleID) const
Definition
TGCTMDB.cxx:113
LVL1TGC::TGCTMDB::TGCTMDB
TGCTMDB()
Definition
TGCTMDB.cxx:11
LVL1TGC::TGCTMDB::m_buffer
std::array< std::array< std::shared_ptr< TGCTMDBOut >, kNTileModule >, TGCSide::kNSide > m_buffer
Definition
TGCTMDB.h:46
LVL1TGC::TGCTMDB::getInnerTileBits
int getInnerTileBits(const TGCSide side, int sectorID) const
Definition
TGCTMDB.cxx:153
LVL1TGC::TGCTMDB::setOutput
void setOutput(const TGCSide side, const unsigned int module, const TGCTMDBOut::TileModuleHit hit56, const TGCTMDBOut::TileModuleHit hit6)
Definition
TGCTMDB.cxx:138
LVL1TGC::TGCTMDB::kNTileModule
static constexpr unsigned int kNTileModule
Definition
TGCTMDB.h:38
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileMuonReceiverObj
Definition
TileMuonReceiverObj.h:28
TileMuonReceiverObj::GetThresholds
const std::vector< float > & GetThresholds() const
Definition
TileMuonReceiverObj.h:115
TileMuonReceiverObj::GetID
int GetID() const
Definition
TileMuonReceiverObj.h:110
TileMuonReceiverObj::GetDecision
const std::vector< bool > & GetDecision() const
Definition
TileMuonReceiverObj.h:114
LVL1TGC
Definition
BigWheelCoincidenceLUT.cxx:20
LVL1TGC::TGCSide
TGCSide
The sides of TGC (A- or C-side).
Definition
TGCNumbering.h:13
LVL1TGC::ASIDE
@ ASIDE
Definition
TGCNumbering.h:14
LVL1TGC::kNSide
@ kNSide
Definition
TGCNumbering.h:16
LVL1TGC::CSIDE
@ CSIDE
Definition
TGCNumbering.h:15
Generated on
for ATLAS Offline Software by
1.17.0