ATLAS Offline Software
Trigger
TrigT1
TrigT1TGC
src
TGCRPhiCoincidenceMatrix.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1TGC/TGCRPhiCoincidenceMatrix.h
"
6
7
#include <iostream>
8
#include <cstdlib>
9
10
#include "
TrigT1TGC/TGCRPhiCoincidenceOut.h
"
11
#include "
TrigT1TGC/BigWheelCoincidenceLUT.h
"
12
#include "
TrigT1TGC/TGCSectorLogic.h
"
13
14
#include "GaudiKernel/ISvcLocator.h"
15
#include "GaudiKernel/Bootstrap.h"
16
#include "GaudiKernel/MsgStream.h"
17
#include "GaudiKernel/IMessageSvc.h"
18
19
namespace
LVL1TGCTrigger
{
20
21
void
TGCRPhiCoincidenceMatrix::inputR
(
int
rIn,
int
dRIn,
int
ptRIn)
22
{
23
m_r
=rIn;
24
m_dR
=dRIn;
25
m_ptR
=ptRIn;
26
27
#ifdef TGCDEBUG
28
std::cout <<
"LVL1TGCTrigger::TGCRPhiCoincidenceMatrix "
29
<<
"inputR r="
<<
m_r
<<
" dR="
<<
m_dR
<<
" H/L="
<<
m_ptR
<<std::endl;
30
#endif
31
}
32
33
void
TGCRPhiCoincidenceMatrix::inputPhi
(
int
phiIn,
int
dPhiIn,
int
ptPhiIn)
34
{
35
if
(
m_nPhiHit
<
MaxNPhiHit
){
36
m_phi
[
m_nPhiHit
]=phiIn;
37
m_dPhi
[
m_nPhiHit
]=dPhiIn;
38
m_ptPhi
[
m_nPhiHit
]=ptPhiIn;
39
40
#ifdef TGCDEBUG
41
std::cout <<
"LVL1TGCTrigger::TGCRPhiCoincidenceMatrix "
42
<<
"inputPhi phi"
<<
m_nPhiHit
<<
"="
<<
m_phi
[
m_nPhiHit
]
43
<<
" dPhi="
<<
m_dPhi
[
m_nPhiHit
] <<
" H/L="
<<
m_ptPhi
[
m_nPhiHit
]
44
<< std::endl;
45
#endif
46
47
m_nPhiHit
++;
48
}
49
}
50
51
void
TGCRPhiCoincidenceMatrix::clear
()
52
{
53
m_SSCId
=0;
54
m_r
=
m_dR
=
m_ptR
=0;
55
56
m_nPhiHit
=0;
57
int
i
;
58
for
(
i
=0;
i
<
MaxNPhiHit
;
i
+=1)
59
m_phi
[
i
]=
m_dPhi
[
i
]=
m_ptPhi
[
i
]=0;
60
}
61
62
TGCRPhiCoincidenceOut
*
TGCRPhiCoincidenceMatrix::doCoincidence
()
63
{
64
TGCRPhiCoincidenceOut
*
out
=
new
TGCRPhiCoincidenceOut
;
65
out
->clear();
66
67
if
(
m_nPhiHit
==0)
return
out
;
68
69
out
->setIdSSC(
m_SSCId
);
70
71
int
j0 = -1;
72
int
ptMax = 1;
73
for
(
int
j=
m_nPhiHit
-1; j>=0; j-=1){
// left half-SSC has priority when both output same pT
74
int
subsector;
75
int
chargeOut = 2;
76
int
CoincidenceTypeOut=-1;
77
78
if
(
m_sectorLogic
->
getRegion
() ==
TGCRegionType::ENDCAP
) {
79
subsector = 4*(2*
m_SSCId
+
m_r
-1)+
m_phi
[j];
80
}
else
{
81
subsector = 4*(2*
m_SSCId
+
m_r
)+
m_phi
[j];
82
}
83
84
// calculate pT of muon candidate
85
int
type
=
m_lut
->getMapType(
m_ptR
,
m_ptPhi
[j]);
86
int
pt
=
m_lut
->test(
m_sideId
,
m_sectorLogic
->
getOctantID
(),
m_sectorLogic
->
getModuleID
(),
87
subsector,
type
,
m_dR
,
m_dPhi
[j]);
88
uint8_t
ptOut = std::abs(
pt
);
// 0 is no candidate.
89
chargeOut =
pt
<0 ? 0:1;
90
// the charge is inverted on the C-side.
91
chargeOut =
m_sideId
== 0 ? chargeOut : !chargeOut;
92
93
CoincidenceTypeOut=(
type
==0);
94
95
// Trigger Out (only pT>0 candidate)
96
if
(ptOut >= ptMax) {
97
ptMax = ptOut;
98
out
->clear();
99
out
->setIdSSC(
m_SSCId
);
100
out
->setpT(ptMax);
101
out
->setR(
m_r
);
102
out
->setPhi(
m_phi
[j]);
103
out
->setDR(
m_dR
);
104
out
->setDPhi(
m_dPhi
[j]);
105
out
->setRoI(subsector);
106
out
->setCharge(chargeOut);
107
out
->setCoincidenceType(CoincidenceTypeOut);
108
j0 = j;
109
}
110
}
111
112
if
(
tgcArgs
()->
MSGLEVEL
() <=
MSG::DEBUG
){
113
IMessageSvc*
msgSvc
= 0;
114
ISvcLocator* svcLocator = Gaudi::svcLocator();
115
if
(svcLocator->service(
"MessageSvc"
,
msgSvc
) != StatusCode::FAILURE) {
116
MsgStream
log
(
msgSvc
,
"LVL1TGCTrigger::TGCRPhiCoincidenceMatrix"
);
117
if
(j0>0) {
118
log
<<
MSG::DEBUG
<<
" Trigger Out : "
119
<<
" pt ="
<< ptMax+1 <<
" R="
<<
m_r
<<
" Phi="
<<
m_phi
[j0]
120
<<
" ptR="
<<
m_ptR
<<
" dR="
<<
m_dR
121
<<
" ptPhi="
<<
m_ptPhi
[j0] <<
" dPhi="
<<
m_dPhi
[j0]
122
<<
endmsg
;
123
}
else
{
124
log
<<
MSG::DEBUG
<<
"NO Trigger Out : "
<<
endmsg
;
125
}
126
}
127
}
128
129
//m_matrixOut = out;
130
return
out
;
131
}
132
133
void
TGCRPhiCoincidenceMatrix::setCoincidenceLUT
(std::shared_ptr<const LVL1TGC::BigWheelCoincidenceLUT>
lut
) {
134
this->
m_lut
=
lut
;
135
}
136
137
TGCRPhiCoincidenceMatrix::TGCRPhiCoincidenceMatrix
(
const
TGCArguments
* tgcargs,
const
TGCSectorLogic
* sL)
138
: m_sectorLogic(sL),
139
m_matrixOut(0), m_lut(0),
140
m_nPhiHit(0), m_SSCId(0), m_r(0), m_dR(0), m_ptR(0), m_sideId(0), m_tgcArgs(tgcargs)
141
{
142
for
(
int
i
=0;
i
<
MaxNPhiHit
;
i
++) {
143
m_phi
[
i
]=0;
144
m_dPhi
[
i
]=0;
145
m_ptPhi
[
i
]=0;
146
}
147
}
148
149
TGCRPhiCoincidenceMatrix::~TGCRPhiCoincidenceMatrix
()
150
{
151
m_matrixOut
=0;
152
}
153
154
TGCRPhiCoincidenceMatrix
&
TGCRPhiCoincidenceMatrix::operator=
(
const
TGCRPhiCoincidenceMatrix
& right)
155
{
156
if
(
this
!= &right){
157
m_sideId
= right.
m_sideId
;
158
m_tgcArgs
= right.
m_tgcArgs
;
159
m_sectorLogic
= right.
m_sectorLogic
;
160
delete
m_matrixOut
;
161
m_matrixOut
=0;
162
m_nPhiHit
= 0;
163
m_SSCId
= 0;
164
m_r
= 0;
165
m_dR
= 0;
166
m_ptR
= 0;
167
for
(
int
i
=0;
i
<
MaxNPhiHit
;
i
++) {
168
m_phi
[
i
]=0;
169
m_dPhi
[
i
]=0;
170
m_ptPhi
[
i
]=0;
171
}
172
}
173
return
*
this
;
174
}
175
176
}
//end of namespace bracket
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_sideId
int m_sideId
Definition:
TGCRPhiCoincidenceMatrix.h:54
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::inputR
void inputR(int rIn, int dRIn, int ptRIn)
Definition:
TGCRPhiCoincidenceMatrix.cxx:21
LVL1TGCTrigger::TGCSectorLogic::getRegion
TGCRegionType getRegion() const
Definition:
TGCSectorLogic.h:62
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_SSCId
int m_SSCId
Definition:
TGCRPhiCoincidenceMatrix.h:47
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_ptPhi
int m_ptPhi[MaxNPhiHit]
Definition:
TGCRPhiCoincidenceMatrix.h:53
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix
Definition:
TGCRPhiCoincidenceMatrix.h:20
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_ptR
int m_ptR
Definition:
TGCRPhiCoincidenceMatrix.h:50
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_matrixOut
TGCRPhiCoincidenceOut * m_matrixOut
Definition:
TGCRPhiCoincidenceMatrix.h:43
xAOD::uint8_t
uint8_t
Definition:
Muon_v1.cxx:575
LVL1TGCTrigger::TGCSectorLogic::getOctantID
int getOctantID() const
Definition:
TGCSectorLogic.h:185
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_sectorLogic
const TGCSectorLogic * m_sectorLogic
Definition:
TGCRPhiCoincidenceMatrix.h:41
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_nPhiHit
int m_nPhiHit
Definition:
TGCRPhiCoincidenceMatrix.h:46
test_pyathena.pt
pt
Definition:
test_pyathena.py:11
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
BigWheelCoincidenceLUT.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_phi
int m_phi[MaxNPhiHit]
Definition:
TGCRPhiCoincidenceMatrix.h:51
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_dPhi
int m_dPhi[MaxNPhiHit]
Definition:
TGCRPhiCoincidenceMatrix.h:52
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::tgcArgs
const TGCArguments * tgcArgs() const
Definition:
TGCRPhiCoincidenceMatrix.h:36
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_r
int m_r
Definition:
TGCRPhiCoincidenceMatrix.h:48
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_dR
int m_dR
Definition:
TGCRPhiCoincidenceMatrix.h:49
LVL1TGCTrigger::TGCSectorLogic::getModuleID
int getModuleID() const
Definition:
TGCSectorLogic.h:178
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition:
ITkPixQCoreEncodingLUT.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition:
StdJOSetup.py:36
lumiFormat.i
int i
Definition:
lumiFormat.py:92
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::doCoincidence
TGCRPhiCoincidenceOut * doCoincidence()
Definition:
TGCRPhiCoincidenceMatrix.cxx:62
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::operator=
TGCRPhiCoincidenceMatrix & operator=(const TGCRPhiCoincidenceMatrix &right)
Definition:
TGCRPhiCoincidenceMatrix.cxx:154
endmsg
#define endmsg
Definition:
AnalysisConfig_Ntuple.cxx:63
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_lut
std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > m_lut
Definition:
TGCRPhiCoincidenceMatrix.h:44
LVL1TGCTrigger::TGCArguments::MSGLEVEL
MSG::Level MSGLEVEL() const
Definition:
TGCArguments.cxx:40
TGCSectorLogic.h
LVL1TGCTrigger::TGCRPhiCoincidenceOut
Definition:
TGCRPhiCoincidenceOut.h:11
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::MaxNPhiHit
@ MaxNPhiHit
Definition:
TGCRPhiCoincidenceMatrix.h:39
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::~TGCRPhiCoincidenceMatrix
virtual ~TGCRPhiCoincidenceMatrix()
Definition:
TGCRPhiCoincidenceMatrix.cxx:149
LVL1TGCTrigger
Definition:
LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::clear
void clear()
Definition:
TGCRPhiCoincidenceMatrix.cxx:51
TGCRPhiCoincidenceMatrix.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::inputPhi
void inputPhi(int phiIn, int dPhiIn, int ptPhiIn)
Definition:
TGCRPhiCoincidenceMatrix.cxx:33
LVL1TGCTrigger::TGCArguments
Definition:
TGCArguments.h:12
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_tgcArgs
const TGCArguments * m_tgcArgs
Definition:
TGCRPhiCoincidenceMatrix.h:56
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::setCoincidenceLUT
void setCoincidenceLUT(std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > lut)
Definition:
TGCRPhiCoincidenceMatrix.cxx:133
LVL1TGCTrigger::TGCSectorLogic
Definition:
TGCSectorLogic.h:42
TGCRPhiCoincidenceOut.h
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition:
page_access.h:11
python.CaloCondTools.log
log
Definition:
CaloCondTools.py:20
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::TGCRPhiCoincidenceMatrix
TGCRPhiCoincidenceMatrix(const TGCArguments *, const TGCSectorLogic *sL=0)
Definition:
TGCRPhiCoincidenceMatrix.cxx:137
Generated on Fri Jul 5 2024 21:28:40 for ATLAS Offline Software by
1.8.18