ATLAS Offline Software
Trigger
TrigT1
TrigT1CaloMonitoring
src
GfexMonitorAlgorithm.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
GfexMonitorAlgorithm.h
"
6
#include "CaloDetDescr/CaloDetDescrElement.h"
7
#include "
CaloIdentifier/CaloGain.h
"
8
#include "Identifier/Identifier.h"
9
#include "
Identifier/HWIdentifier.h
"
10
#include "
CaloIdentifier/CaloCell_ID.h
"
11
#include "
CaloDetDescr/CaloDetDescrManager.h
"
12
#include <istream>
13
14
GfexMonitorAlgorithm::GfexMonitorAlgorithm
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
15
:
AthMonitorAlgorithm
(
name
,pSvcLocator)
16
{
17
}
18
19
StatusCode
GfexMonitorAlgorithm::initialize
() {
20
ATH_MSG_DEBUG
(
"GfexMonitorAlgorithm::initialize"
);
21
ATH_MSG_DEBUG
(
"Package Name "
<<
m_packageName
);
22
23
ATH_CHECK
(
m_gFexJetTobKeyList
.initialize() ) ;
24
ATH_CHECK
(
m_gFexRhoTobKeyList
.initialize() ) ;
25
ATH_CHECK
(
m_gFexGlobalTobKeyList
.initialize() ) ;
26
27
// TOBs may come from trigger bytestream - renounce from scheduler
28
renounceArray
(
m_gFexJetTobKeyList
);
29
renounceArray
(
m_gFexRhoTobKeyList
);
30
renounceArray
(
m_gFexGlobalTobKeyList
);
31
32
// Fill variable name map for global TOBs
33
m_globTobVarMap
.insert({
"gScalarEJwoj"
, {
"gFexMet"
,
"gFexSumEt"
}});
34
m_globTobVarMap
.insert({
"gMETComponentsJwoj"
, {
"METx"
,
"METy"
}});
35
m_globTobVarMap
.insert({
"gMHTComponentsJwoj"
, {
"MHTx"
,
"MHTy"
}});
36
m_globTobVarMap
.insert({
"gMSTComponentsJwoj"
, {
"MSTx"
,
"MSTy"
}});
37
// NC and Rho commented out for future
38
// m_globTobVarMap.insert({"gMETComponentsNoiseCut", {"METx_NoiseCut", "METy_NoiseCut"}});
39
// m_globTobVarMap.insert({"gMETComponentsRms", {"METx_Rms", "METy_Rms"}});
40
// m_globTobVarMap.insert({"gScalarENoiseCut", {"gFexMet_NoiseCut", "gFexSumEt_NoiseCut"}});
41
// m_globTobVarMap.insert({"gScalarERms", {"gFexMet_Rms", "gFexSumEt_Rms"}});
42
43
return
AthMonitorAlgorithm::initialize
();
44
}
45
46
StatusCode
GfexMonitorAlgorithm::fillHistograms
(
const
EventContext& ctx )
const
{
47
ATH_MSG_DEBUG
(
"GfexMonitorAlgorithm::fillHistograms"
);
48
49
// Small-R and large-R jets container loop
50
for
(
const
auto
&
key
:
m_gFexJetTobKeyList
){
51
SG::ReadHandle<xAOD::gFexJetRoIContainer>
jetContainer (
key
, ctx);
52
auto
lumi
=
GetEventInfo
(ctx)->lumiBlock();
53
54
// Check that this container is present
55
if
( !jetContainer.
isValid
() ) {
56
ATH_MSG_WARNING
(
"No gFex jet container found in storegate: "
<<
key
.key());
57
}
58
59
else
{
60
if
(
key
.key() ==
"L1_gFexLRJetRoI"
){
61
const
xAOD::gFexJetRoIContainer
* jetContainerPtr = jetContainer.
cptr
();
62
// Loop over all required pt cut values - LRJets
63
for
(
auto
ptCut :
m_ptCutValuesgLJ
){
64
ATH_CHECK
(
fillJetHistograms
(
key
.key(), jetContainerPtr, ptCut,
lumi
));
65
}
66
}
67
if
(
key
.key() ==
"L1_gFexSRJetRoI"
){
68
const
xAOD::gFexJetRoIContainer
* jetContainerPtr = jetContainer.
cptr
();
69
// Loop over all required pt cut values - SRJets
70
for
(
auto
ptCut :
m_ptCutValuesgJ
){
71
ATH_CHECK
(
fillJetHistograms
(
key
.key(), jetContainerPtr, ptCut,
lumi
));
72
}
73
}
74
}
75
}
// end jet loop
76
77
// Rho container loop
78
for
(
const
auto
&
key
:
m_gFexRhoTobKeyList
){
79
SG::ReadHandle<xAOD::gFexJetRoIContainer>
rhoContainer (
key
, ctx);
80
// Check that this container is present
81
if
( !rhoContainer.
isValid
() ) {
82
ATH_MSG_WARNING
(
"No gFex rho container found in storegate: "
<<
key
.key());
83
}
84
else
{
85
const
xAOD::gFexJetRoIContainer
* rhoContainerPtr = rhoContainer.
cptr
();
86
ATH_CHECK
(
fillRhoHistograms
(
key
.key(), rhoContainerPtr));
87
}
88
}
// end rho container loop
89
90
// Global TOB container loop
91
for
(
const
auto
&
key
:
m_gFexGlobalTobKeyList
){
92
SG::ReadHandle<xAOD::gFexGlobalRoIContainer>
globalTobContainer (
key
, ctx);
93
// Check that this container is present
94
if
( !globalTobContainer.
isValid
() ) {
95
ATH_MSG_WARNING
(
"No gFex global TOB container found in storegate: "
<<
key
.key());
96
}
97
else
{
98
const
xAOD::gFexGlobalRoIContainer
* globalTobContainerPtr = globalTobContainer.
cptr
();
99
ATH_CHECK
(
fillGlobalTobHistograms
(
key
.key(), globalTobContainerPtr));
100
}
101
}
// end global TOBs container loop
102
return
StatusCode::SUCCESS;
103
}
104
105
StatusCode
GfexMonitorAlgorithm::fillJetHistograms
(
const
std::string& handleKey,
const
xAOD::gFexJetRoIContainer
* container,
const
float
& ptCutValue ,
const
auto
& lbn)
const
{
106
107
// Define name extension based on pT cut value
108
std::string histNameExt = ptCutValue != -1. ? (std::string(
"_CutPt"
) +
std::to_string
(
int
(ptCutValue))) :
""
;
109
auto
gtype =
Monitored::Scalar<int>
(handleKey +
"gFexType"
, 0.0);
110
auto
jetEta =
Monitored::Scalar<float>
(handleKey +
"Eta"
+ histNameExt, 0.0);
111
auto
jetPhi =
Monitored::Scalar<float>
(handleKey +
"Phi"
+ histNameExt, 0.0);
112
auto
jetPt =
Monitored::Scalar<float>
(handleKey +
"Pt"
+ histNameExt, 0.0);
113
auto
binNumber =
Monitored::Scalar<int>
(handleKey+
"binNumber"
+histNameExt,0);
114
auto
lumiNumber =
Monitored::Scalar<int>
(handleKey+
"LBN"
+histNameExt, lbn );
115
116
117
118
119
for
(
const
xAOD::gFexJetRoI
*
gFexJetRoI
: *container){
120
121
float
eta =
gFexJetRoI
->
eta
();
122
float
phi =
gFexJetRoI
->
phi
();
123
jetPt =
gFexJetRoI
->
gFexTobEt
();
124
125
if
(eta < -3.17 && eta > -3.25){ eta = -3.225;}
126
if
(eta < 3.3 && eta > 3.17){ eta = 3.275;}
127
jetEta = eta;
128
129
if
(jetPt > ptCutValue){
130
131
if
(std::abs(eta) >= 3.2 ){
132
jetPhi = (phi > 0.0) ? phi + 0.1 : phi - 0.1;
133
float
phi_new = (phi > 0.0) ? phi + 0.1 : phi - 0.1;
134
binNumber =
getBinNumberJet
(eta,phi_new,0,0);
135
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
136
fill
(
m_packageName
,lumiNumber,binNumber);
137
jetPhi = phi;
138
binNumber =
getBinNumberJet
(eta,phi,0,0);
139
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
140
fill
(
m_packageName
,lumiNumber,binNumber);
141
}
142
else
{
143
jetPhi = phi;
144
binNumber =
getBinNumberJet
(eta,phi,0,0);
145
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
146
fill
(
m_packageName
,lumiNumber,binNumber);
147
}
148
}}
149
return
StatusCode::SUCCESS;
150
}
151
152
StatusCode
GfexMonitorAlgorithm::fillRhoHistograms
(
const
std::string& handleKey,
const
xAOD::gFexJetRoIContainer
* container)
const
{
153
auto
gFexRhoeT =
Monitored::Scalar<float>
(handleKey, 0.0);
154
for
(
const
xAOD::gFexJetRoI
* gFexRhoRoI : *container){
155
gFexRhoeT=gFexRhoRoI->gFexTobEt();
156
fill
(
m_packageName
, gFexRhoeT);
157
}
158
return
StatusCode::SUCCESS;
159
}
160
161
StatusCode
GfexMonitorAlgorithm::fillGlobalTobHistograms
(
const
std::string& handleKey,
const
xAOD::gFexGlobalRoIContainer
* container)
const
{
162
// Find the variable names corresponding to the current key handle
163
std::pair<std::string, std::string> varNames;
164
for
(
const
auto
& [
key
,
value
] :
m_globTobVarMap
) {
165
if
(handleKey.find(
key
) != std::string::npos) {
166
varNames =
value
;
167
break
;
168
}
169
}
170
auto
varOne =
Monitored::Scalar<float>
(varNames.first,0.0);
171
auto
varTwo =
Monitored::Scalar<float>
(varNames.second,0.0);
172
173
for
(
const
xAOD::gFexGlobalRoI
* globRoI : *container) {
174
varOne = globRoI->METquantityOne();
175
varTwo = globRoI->METquantityTwo();
176
fill
(
m_packageName
, varOne, varTwo);
177
}
178
return
StatusCode::SUCCESS;
179
}
180
181
GfexMonitorAlgorithm::FPGAType
GfexMonitorAlgorithm::getFPGAType
(
const
float
&
eta
)
const
{
182
if
(eta < 0 && eta > -2.5)
return
FPGAType::FPGAa
;
183
if
(eta > 0 && eta < 2.5)
return
FPGAType::FPGAb
;
184
if
(std::abs(eta) > 2.5 && std::abs(eta))
return
FPGAType::FPGAc
;
185
return
FPGAType::None
;
186
}
187
188
int
GfexMonitorAlgorithm::getBinNumberJet
(
float
inputEta,
float
inputPhi,
int
xbin,
int
ybin)
const
{
189
const
std::vector<float> eta = {-4.9, -4.1,-3.5,-3.25,-3.2,-3.1,-2.9,-2.7,-2.5,-2.2,-2.0,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0,6,-0.4,-0.2,0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.5,2.7,2.9,3.1,3.3,3.25,3.5,4.1,4.9};
190
for
(
int
i
= 0;
i
<= 40;
i
++){
191
if
(inputEta >= eta[
i
] && inputEta < eta[
i
+1]){
192
xbin =
i
+1;
193
continue
;
194
}
195
}
196
int
j=1;
197
for
(
float
phi = -3.2; phi <= 3.2;phi = phi+ 0.2){
198
if
(inputPhi >= phi && inputPhi < phi+0.2){
199
ybin = j;
200
break
;
201
}
202
j++;
203
}
204
int
binN = 40*(ybin-1)+xbin;
205
return
binN;
206
}
207
208
GfexMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition:
GfexMonitorAlgorithm.cxx:46
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
xAOD::gFexJetRoI_v1::eta
float eta() const
retrieves the Eta index from the 32-bit word
Definition:
gFexJetRoI_v1.cxx:167
GfexMonitorAlgorithm::FPGAType::FPGAb
@ FPGAb
GfexMonitorAlgorithm::GfexMonitorAlgorithm
GfexMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
GfexMonitorAlgorithm.cxx:14
eta
Scalar eta() const
pseudorapidity method
Definition:
AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
xAOD::gFexGlobalRoI_v1
Class describing properties of a LVL1 gFEX global Trigger Object (TOB) in the xAOD format.
Definition:
gFexGlobalRoI_v1.h:25
GfexMonitorAlgorithm::m_gFexJetTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexJetRoIContainer > m_gFexJetTobKeyList
Definition:
GfexMonitorAlgorithm.h:29
athena.value
value
Definition:
athena.py:124
xAOD::gFexJetRoI_v1::gFexTobEt
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray
void renounceArray(SG::VarHandleKeyArray &handlesArray)
remove all handles from I/O resolution
Definition:
AthCommonDataStore.h:364
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloCell_ID.h
GfexMonitorAlgorithm::m_gFexRhoTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexJetRoIContainer > m_gFexRhoTobKeyList
Definition:
GfexMonitorAlgorithm.h:30
GfexMonitorAlgorithm::m_gFexGlobalTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexGlobalRoIContainer > m_gFexGlobalTobKeyList
Definition:
GfexMonitorAlgorithm.h:31
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition:
AthMonitorAlgorithm.h:36
xAOD::gFexJetRoI_v1::phi
float phi() const
High value of phi corresponding to phi index (using gFex convention, phi in [0, 2pi]).
Definition:
gFexJetRoI_v1.cxx:300
GfexMonitorAlgorithm.h
GfexMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition:
GfexMonitorAlgorithm.cxx:19
lumiFormat.i
int i
Definition:
lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
xAOD::gFexJetRoI_v1
Class describing properties of a LVL1 gFEX jet Trigger Object (TOB) in the xAOD format.
Definition:
gFexJetRoI_v1.h:25
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
GfexMonitorAlgorithm::m_ptCutValuesgLJ
FloatArrayProperty m_ptCutValuesgLJ
Definition:
GfexMonitorAlgorithm.h:26
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
GfexMonitorAlgorithm::fillRhoHistograms
StatusCode fillRhoHistograms(const std::string &handleKey, const xAOD::gFexJetRoIContainer *container) const
Definition:
GfexMonitorAlgorithm.cxx:152
GfexMonitorAlgorithm::m_globTobVarMap
std::map< std::string, std::pair< std::string, std::string > > m_globTobVarMap
Definition:
GfexMonitorAlgorithm.h:24
GfexMonitorAlgorithm::fillGlobalTobHistograms
StatusCode fillGlobalTobHistograms(const std::string &handleKey, const xAOD::gFexGlobalRoIContainer *container) const
Definition:
GfexMonitorAlgorithm.cxx:161
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition:
AthMonitorAlgorithm.cxx:107
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:794
GfexMonitorAlgorithm::FPGAType::None
@ None
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
HWIdentifier.h
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
xAOD::gFexJetRoI
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
Definition:
gFexJetRoI.h:16
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition:
GeometryDefs.h:34
GfexMonitorAlgorithm::FPGAType
FPGAType
Definition:
GfexMonitorAlgorithm.h:23
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition:
AthMonitorAlgorithm.cxx:18
lumiFormat.lumi
lumi
Definition:
lumiFormat.py:106
GfexMonitorAlgorithm::getBinNumberJet
int getBinNumberJet(float, float, int, int) const
Definition:
GfexMonitorAlgorithm.cxx:188
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
GfexMonitorAlgorithm::m_ptCutValuesgJ
FloatArrayProperty m_ptCutValuesgJ
Definition:
GfexMonitorAlgorithm.h:27
GfexMonitorAlgorithm::FPGAType::FPGAa
@ FPGAa
GfexMonitorAlgorithm::m_packageName
StringProperty m_packageName
Definition:
GfexMonitorAlgorithm.h:25
GfexMonitorAlgorithm::getFPGAType
FPGAType getFPGAType(const float &eta) const
Definition:
GfexMonitorAlgorithm.cxx:181
Monitored::Scalar
Declare a monitored scalar variable.
Definition:
MonitoredScalar.h:34
GfexMonitorAlgorithm::fillJetHistograms
StatusCode fillJetHistograms(const std::string &handleKey, const xAOD::gFexJetRoIContainer *container, const float &ptCutValue, const auto &lbn) const
Definition:
GfexMonitorAlgorithm.cxx:105
CaloGain.h
mapkey::key
key
Definition:
TElectronEfficiencyCorrectionTool.cxx:37
GfexMonitorAlgorithm::FPGAType::FPGAc
@ FPGAc
Generated on Tue Dec 24 2024 21:10:56 for ATLAS Offline Software by
1.8.18