ATLAS Offline Software
Loading...
Searching...
No Matches
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
28
// Fill variable name map for global TOBs
29
m_globTobVarMap
.insert({
"gScalarEJwoj"
, {
"gFexMet"
,
"gFexSumEt"
}});
30
m_globTobVarMap
.insert({
"gMETComponentsJwoj"
, {
"METx"
,
"METy"
}});
31
m_globTobVarMap
.insert({
"gMHTComponentsJwoj"
, {
"MHTx"
,
"MHTy"
}});
32
m_globTobVarMap
.insert({
"gMSTComponentsJwoj"
, {
"MSTx"
,
"MSTy"
}});
33
// NC and Rho commented out for future
34
// m_globTobVarMap.insert({"gMETComponentsNoiseCut", {"METx_NoiseCut", "METy_NoiseCut"}});
35
// m_globTobVarMap.insert({"gMETComponentsRms", {"METx_Rms", "METy_Rms"}});
36
// m_globTobVarMap.insert({"gScalarENoiseCut", {"gFexMet_NoiseCut", "gFexSumEt_NoiseCut"}});
37
// m_globTobVarMap.insert({"gScalarERms", {"gFexMet_Rms", "gFexSumEt_Rms"}});
38
39
return
AthMonitorAlgorithm::initialize
();
40
}
41
42
StatusCode
GfexMonitorAlgorithm::fillHistograms
(
const
EventContext& ctx )
const
{
43
ATH_MSG_DEBUG
(
"GfexMonitorAlgorithm::fillHistograms"
);
44
45
// Small-R and large-R jets container loop
46
for
(
const
auto
& key :
m_gFexJetTobKeyList
){
47
SG::ReadHandle<xAOD::gFexJetRoIContainer>
jetContainer (key, ctx);
48
auto
lumi =
GetEventInfo
(ctx)->lumiBlock();
49
50
// Check that this container is present
51
if
( !jetContainer.
isValid
() ) {
52
ATH_MSG_WARNING
(
"No gFex jet container found in storegate: "
<< key.key());
53
}
54
55
else
{
56
if
(key.key() ==
"L1_gFexLRJetRoI"
){
57
const
xAOD::gFexJetRoIContainer
* jetContainerPtr = jetContainer.
cptr
();
58
// Loop over all required pt cut values - LRJets
59
for
(
auto
ptCut :
m_ptCutValuesgLJ
){
60
ATH_CHECK
(
fillJetHistograms
(key.key(), jetContainerPtr, ptCut, lumi));
61
}
62
}
63
if
(key.key() ==
"L1_gFexSRJetRoI"
){
64
const
xAOD::gFexJetRoIContainer
* jetContainerPtr = jetContainer.
cptr
();
65
// Loop over all required pt cut values - SRJets
66
for
(
auto
ptCut :
m_ptCutValuesgJ
){
67
ATH_CHECK
(
fillJetHistograms
(key.key(), jetContainerPtr, ptCut, lumi));
68
}
69
}
70
}
71
}
// end jet loop
72
73
// Rho container loop
74
for
(
const
auto
& key :
m_gFexRhoTobKeyList
){
75
SG::ReadHandle<xAOD::gFexJetRoIContainer>
rhoContainer (key, ctx);
76
// Check that this container is present
77
if
( !rhoContainer.
isValid
() ) {
78
ATH_MSG_WARNING
(
"No gFex rho container found in storegate: "
<< key.key());
79
}
80
else
{
81
const
xAOD::gFexJetRoIContainer
* rhoContainerPtr = rhoContainer.
cptr
();
82
ATH_CHECK
(
fillRhoHistograms
(key.key(), rhoContainerPtr));
83
}
84
}
// end rho container loop
85
86
// Global TOB container loop
87
for
(
const
auto
& key :
m_gFexGlobalTobKeyList
){
88
SG::ReadHandle<xAOD::gFexGlobalRoIContainer>
globalTobContainer (key, ctx);
89
// Check that this container is present
90
if
( !globalTobContainer.
isValid
() ) {
91
ATH_MSG_WARNING
(
"No gFex global TOB container found in storegate: "
<< key.key());
92
}
93
else
{
94
const
xAOD::gFexGlobalRoIContainer
* globalTobContainerPtr = globalTobContainer.
cptr
();
95
ATH_CHECK
(
fillGlobalTobHistograms
(key.key(), globalTobContainerPtr));
96
}
97
}
// end global TOBs container loop
98
return
StatusCode::SUCCESS;
99
}
100
101
StatusCode
GfexMonitorAlgorithm::fillJetHistograms
(
const
std::string& handleKey,
const
xAOD::gFexJetRoIContainer
*
container
,
const
float
& ptCutValue ,
const
auto
& lbn)
const
{
102
103
// Define name extension based on pT cut value
104
std::string histNameExt = ptCutValue != -1. ? (std::string(
"_CutPt"
) + std::to_string(
int
(ptCutValue))) :
""
;
105
auto
gtype =
Monitored::Scalar<int>
(handleKey +
"gFexType"
, 0.0);
106
auto
jetEta =
Monitored::Scalar<float>
(handleKey +
"Eta"
+ histNameExt, 0.0);
107
auto
jetPhi =
Monitored::Scalar<float>
(handleKey +
"Phi"
+ histNameExt, 0.0);
108
auto
jetPt =
Monitored::Scalar<float>
(handleKey +
"Pt"
+ histNameExt, 0.0);
109
auto
binNumber =
Monitored::Scalar<int>
(handleKey+
"binNumber"
+histNameExt,0);
110
auto
lumiNumber =
Monitored::Scalar<int>
(handleKey+
"LBN"
+histNameExt, lbn );
111
112
113
114
115
for
(
const
xAOD::gFexJetRoI
* gFexJetRoI : *
container
){
116
117
float
eta
= gFexJetRoI->
eta
();
118
float
phi
= gFexJetRoI->
phi
();
119
jetPt = gFexJetRoI->
gFexTobEt
();
120
121
if
(
eta < -3.17 && eta >
-3.25){
eta
= -3.225;}
122
if
(
eta < 3.3 && eta >
3.17){
eta
= 3.275;}
123
jetEta =
eta
;
124
125
/*
126
FPGAc -> In the FPGAc region (abs(eta) > 3.2), the size of the gTowers in phi is twice the size of the gTowers in FPGAa and FPGAb.
127
Using one fill() method for all eta bins results in a checker pattern in the forward region. To ensure that the histogram
128
reflects the difference in the size of gTowers in the forward region, the fill() method is used twice for abs(eta) > 3.2
129
*/
130
131
if
(jetPt > ptCutValue){
132
133
if
(std::abs(
eta
) >= 3.2 ){
134
jetPhi = (
phi
> 0.0) ?
phi
+ 0.1 :
phi
- 0.1;
135
float
phi_new = (
phi
> 0.0) ?
phi
+ 0.1 :
phi
- 0.1;
136
binNumber =
getBinNumberJet
(
eta
,phi_new,0,0);
137
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
138
fill
(
m_packageName
,lumiNumber,binNumber);
139
jetPhi =
phi
;
140
binNumber =
getBinNumberJet
(
eta
,
phi
,0,0);
141
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
142
fill
(
m_packageName
,lumiNumber,binNumber);
143
}
144
else
{
145
jetPhi =
phi
;
146
binNumber =
getBinNumberJet
(
eta
,
phi
,0,0);
147
fill
(
m_packageName
,jetEta,jetPhi,jetPt);
148
fill
(
m_packageName
,lumiNumber,binNumber);
149
}
150
}}
151
return
StatusCode::SUCCESS;
152
}
153
154
StatusCode
GfexMonitorAlgorithm::fillRhoHistograms
(
const
std::string& handleKey,
const
xAOD::gFexJetRoIContainer
*
container
)
const
{
155
auto
gFexRhoeT =
Monitored::Scalar<float>
(handleKey, 0.0);
156
for
(
const
xAOD::gFexJetRoI
* gFexRhoRoI : *
container
){
157
gFexRhoeT=gFexRhoRoI->gFexTobEt();
158
fill
(
m_packageName
, gFexRhoeT);
159
}
160
return
StatusCode::SUCCESS;
161
}
162
163
StatusCode
GfexMonitorAlgorithm::fillGlobalTobHistograms
(
const
std::string& handleKey,
const
xAOD::gFexGlobalRoIContainer
*
container
)
const
{
164
// Find the variable names corresponding to the current key handle
165
std::pair<std::string, std::string> varNames;
166
for
(
const
auto
& [key, value] :
m_globTobVarMap
) {
167
if
(handleKey.find(key) != std::string::npos) {
168
varNames = value;
169
break
;
170
}
171
}
172
auto
varOne =
Monitored::Scalar<float>
(varNames.first,0.0);
173
auto
varTwo =
Monitored::Scalar<float>
(varNames.second,0.0);
174
175
for
(
const
xAOD::gFexGlobalRoI
* globRoI : *
container
) {
176
varOne = globRoI->METquantityOne();
177
varTwo = globRoI->METquantityTwo();
178
fill
(
m_packageName
, varOne, varTwo);
179
}
180
return
StatusCode::SUCCESS;
181
}
182
183
GfexMonitorAlgorithm::FPGAType
GfexMonitorAlgorithm::getFPGAType
(
const
float
&
eta
)
const
{
184
if
(
eta < 0 && eta >
-2.5)
return
FPGAType::FPGAa
;
185
if
(
eta
> 0 &&
eta
< 2.5)
return
FPGAType::FPGAb
;
186
if
(std::abs(
eta
) > 2.5 && std::abs(
eta
))
return
FPGAType::FPGAc
;
187
return
FPGAType::None
;
188
}
189
190
int
GfexMonitorAlgorithm::getBinNumberJet
(
float
inputEta,
float
inputPhi,
int
xbin,
int
ybin)
const
{
191
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.25,3.3,3.5,4.1,4.9};
192
for
(
int
i = 0; i <= 40; i++){
193
if
(inputEta >=
eta
[i] && inputEta <
eta
[i+1]){
194
xbin = i+1;
195
continue
;
196
}
197
}
198
int
j=1;
199
for
(
float
phi
= -3.2;
phi
<= 3.2;
phi
=
phi
+ 0.2){
200
if
(inputPhi >=
phi
&& inputPhi <
phi
+0.2){
201
ybin = j;
202
break
;
203
}
204
j++;
205
}
206
int
binN = 32*(xbin-1)+ybin;
207
return
binN;
208
}
209
210
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCell_ID.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloGain.h
GfexMonitorAlgorithm.h
HWIdentifier.h
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition
AthMonitorAlgorithm.cxx:22
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:111
AthMonitorAlgorithm::AthMonitorAlgorithm
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthMonitorAlgorithm.cxx:8
GfexMonitorAlgorithm::m_gFexRhoTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexJetRoIContainer > m_gFexRhoTobKeyList
Definition
GfexMonitorAlgorithm.h:30
GfexMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition
GfexMonitorAlgorithm.cxx:42
GfexMonitorAlgorithm::m_globTobVarMap
std::map< std::string, std::pair< std::string, std::string > > m_globTobVarMap
Definition
GfexMonitorAlgorithm.h:24
GfexMonitorAlgorithm::m_ptCutValuesgLJ
FloatArrayProperty m_ptCutValuesgLJ
Definition
GfexMonitorAlgorithm.h:26
GfexMonitorAlgorithm::FPGAType
FPGAType
Definition
GfexMonitorAlgorithm.h:23
GfexMonitorAlgorithm::FPGAType::None
@ None
Definition
GfexMonitorAlgorithm.h:23
GfexMonitorAlgorithm::FPGAType::FPGAc
@ FPGAc
Definition
GfexMonitorAlgorithm.h:23
GfexMonitorAlgorithm::FPGAType::FPGAa
@ FPGAa
Definition
GfexMonitorAlgorithm.h:23
GfexMonitorAlgorithm::FPGAType::FPGAb
@ FPGAb
Definition
GfexMonitorAlgorithm.h:23
GfexMonitorAlgorithm::m_ptCutValuesgJ
FloatArrayProperty m_ptCutValuesgJ
Definition
GfexMonitorAlgorithm.h:27
GfexMonitorAlgorithm::getBinNumberJet
int getBinNumberJet(float, float, int, int) const
Definition
GfexMonitorAlgorithm.cxx:190
GfexMonitorAlgorithm::getFPGAType
FPGAType getFPGAType(const float &eta) const
Definition
GfexMonitorAlgorithm.cxx:183
GfexMonitorAlgorithm::m_gFexGlobalTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexGlobalRoIContainer > m_gFexGlobalTobKeyList
Definition
GfexMonitorAlgorithm.h:31
GfexMonitorAlgorithm::fillRhoHistograms
StatusCode fillRhoHistograms(const std::string &handleKey, const xAOD::gFexJetRoIContainer *container) const
Definition
GfexMonitorAlgorithm.cxx:154
GfexMonitorAlgorithm::fillGlobalTobHistograms
StatusCode fillGlobalTobHistograms(const std::string &handleKey, const xAOD::gFexGlobalRoIContainer *container) const
Definition
GfexMonitorAlgorithm.cxx:163
GfexMonitorAlgorithm::m_gFexJetTobKeyList
SG::ReadHandleKeyArray< xAOD::gFexJetRoIContainer > m_gFexJetTobKeyList
Definition
GfexMonitorAlgorithm.h:29
GfexMonitorAlgorithm::m_packageName
StringProperty m_packageName
Definition
GfexMonitorAlgorithm.h:25
GfexMonitorAlgorithm::GfexMonitorAlgorithm
GfexMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition
GfexMonitorAlgorithm.cxx:14
GfexMonitorAlgorithm::fillJetHistograms
StatusCode fillJetHistograms(const std::string &handleKey, const xAOD::gFexJetRoIContainer *container, const float &ptCutValue, const auto &lbn) const
Definition
GfexMonitorAlgorithm.cxx:101
GfexMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition
GfexMonitorAlgorithm.cxx:19
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
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
xAOD::gFexJetRoI_v1::gFexTobEt
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
xAOD::gFexJetRoI_v1::eta
float eta() const
retrieves the Eta index from the 32-bit word
Definition
gFexJetRoI_v1.cxx:167
xAOD::gFexGlobalRoIContainer
gFexGlobalRoIContainer_v1 gFexGlobalRoIContainer
Definition
gFexGlobalRoIContainer.h:15
xAOD::gFexJetRoI
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
Definition
gFexJetRoI.h:16
xAOD::gFexGlobalRoI
gFexGlobalRoI_v1 gFexGlobalRoI
Define the latest version of the eFexEMRoI class.
Definition
gFexGlobalRoI.h:16
xAOD::gFexJetRoIContainer
gFexJetRoIContainer_v1 gFexJetRoIContainer
Definition
gFexJetRoIContainer.h:15
container
fill
void fill(H5::Group &out_file, size_t iterations)
Definition
test-half-precision.cxx:64
Generated on
for ATLAS Offline Software by
1.14.0