ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigEgammaHypo
src
TrigEgammaPrecisionCaloHypoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <algorithm>
6
#include "
AthenaMonitoringKernel/Monitored.h
"
7
#include "
TrigCompositeUtils/HLTIdentifier.h
"
8
#include "
TrigCompositeUtils/Combinators.h
"
9
#include "
TrigSteeringEvent/TrigRoiDescriptorCollection.h
"
10
#include "
xAODCaloEvent/CaloCluster.h
"
11
12
#include "
TrigEgammaPrecisionCaloHypoTool.h
"
13
14
15
namespace
TCU
=
TrigCompositeUtils
;
16
17
TrigEgammaPrecisionCaloHypoTool::TrigEgammaPrecisionCaloHypoTool
(
const
std::string&
type
,
18
const
std::string& name,
19
const
IInterface* parent )
20
: base_class(
type
, name, parent ),
21
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) ) {}
22
23
StatusCode
TrigEgammaPrecisionCaloHypoTool::initialize
() {
24
ATH_MSG_DEBUG
(
"Initialization completed successfully"
);
25
ATH_MSG_DEBUG
(
"EtaBins = "
<<
m_etabin
);
26
ATH_MSG_DEBUG
(
"ETthr = "
<<
m_eTthr
<<
"( lo )/"
<<
m_eT2thr
<<
"( hi )"
);
27
ATH_MSG_DEBUG
(
"dPHICLUSTERthr = "
<<
m_dphicluster
);
28
ATH_MSG_DEBUG
(
"dETACLUSTERthr = "
<<
m_detacluster
);
29
30
if
(
m_etabin
.size() == 0 ) {
31
ATH_MSG_ERROR
(
" There are no cuts set (EtaBins property is an empty list)"
);
32
return
StatusCode::FAILURE;
33
}
34
35
unsigned
int
nEtaBin =
m_etabin
.size();
36
#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \
37
{ ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; }
38
39
CHECK_SIZE
( eTthr );
40
CHECK_SIZE
( eT2thr );
41
#undef CHECK_SIZE
42
43
44
45
ATH_MSG_DEBUG
(
"Tool configured for chain/id: "
<<
m_decisionId
);
46
47
if
( not
m_monTool
.name().empty() )
48
CHECK
(
m_monTool
.retrieve() );
49
50
return
StatusCode::SUCCESS;
51
}
52
53
54
bool
TrigEgammaPrecisionCaloHypoTool::decide
(
const
ITrigEgammaPrecisionCaloHypoTool::ClusterInfo
& input )
const
{
55
56
bool
pass =
false
;
57
58
auto
mon_dEta =
Monitored::Scalar
(
"dEta"
, -1. );
59
auto
mon_dPhi =
Monitored::Scalar
(
"dPhi"
, -1. );
60
auto
mon_eta =
Monitored::Scalar
(
"Eta"
, -99. );
61
auto
mon_phi =
Monitored::Scalar
(
"Phi"
, -99. );
62
auto
mon_eT_Cluster =
Monitored::Scalar
(
"Et_em"
, -1.0 );
63
auto
cutCounter =
Monitored::Scalar<int>
(
"CutCounter"
, -1 );
64
auto
monitorIt =
Monitored::Group
(
m_monTool
, mon_dEta, mon_dPhi, mon_eta, mon_phi, mon_eT_Cluster,cutCounter);
65
66
67
// when leaving scope it will ship data to monTool
68
69
float
dEta(0), dPhi(0),
eta
(0),
phi
(0), eT_Cluster(0);
70
71
auto
roiDescriptor = input.roi;
72
73
74
if
( fabs( roiDescriptor->eta() ) > 2.6 ) {
75
ATH_MSG_DEBUG
(
"REJECT The cluster had eta coordinates beyond the EM fiducial volume : "
<< roiDescriptor->eta() <<
"; stop the chain now"
);
76
pass=
false
;
// special case
77
return
pass;
78
}
79
80
cutCounter++;
81
ATH_MSG_DEBUG
(
"; RoI ID = "
<< roiDescriptor->roiId()
82
<<
": Eta = "
<< roiDescriptor->eta()
83
<<
", Phi = "
<< roiDescriptor->phi() );
84
85
// fill local variables for RoI reference position
86
double
etaRef = roiDescriptor->eta();
87
double
phiRef = roiDescriptor->phi();
88
89
// correct phi the to right range ( probably not needed anymore )
90
if
( fabs( phiRef ) >
M_PI
) phiRef -= 2*
M_PI
;
// correct phi if outside range
91
92
93
auto
pClus = input.cluster;
94
eta
= pClus->eta();
95
phi
= pClus->phi();
96
97
float
absEta = fabs( pClus->eta() );
98
const
int
cutIndex =
findCutIndex
( absEta );
99
100
dEta = pClus->eta() - etaRef;
101
// Deal with angle diferences greater than Pi
102
dPhi = fabs( pClus->phi() - phiRef );
103
dPhi = ( dPhi <
M_PI
? dPhi : 2*
M_PI
- dPhi );
// TB why only <
104
eT_Cluster = pClus->et();
105
// apply cuts: DeltaEta( clus-ROI )
106
ATH_MSG_DEBUG
(
"CaloCluster: eta="
<< pClus->eta()
107
<<
" roi eta="
<< etaRef <<
" DeltaEta="
<< dEta
108
<<
" cut: <"
<<
m_detacluster
);
109
110
if
( fabs(dEta) >
m_detacluster
) {
111
ATH_MSG_DEBUG
(
"REJECT Cluster dEta cut failed"
);
112
return
pass;
113
}
114
mon_eta =
eta
;
115
mon_dEta = dEta;
116
cutCounter++;
//Deta
117
118
// DeltaPhi( clus-ROI )
119
ATH_MSG_DEBUG
(
": phi="
<< pClus->phi()
120
<<
" roi phi="
<< phiRef <<
" DeltaPhi="
<< dPhi
121
<<
" cut: <"
<<
m_dphicluster
);
122
123
if
( dPhi >
m_dphicluster
) {
124
ATH_MSG_DEBUG
(
"REJECT Clsuter dPhi cut failed"
);
125
return
pass;
126
}
127
mon_dPhi = dPhi;
128
mon_phi =
phi
;
129
cutCounter++;
//DPhi
130
131
// eta range
132
if
( cutIndex == -1 ) {
// VD
133
ATH_MSG_DEBUG
(
"Cluster eta: "
<< absEta <<
" outside eta range "
<<
m_etabin
[
m_etabin
.size()-1] );
134
return
pass;
135
}
else
{
136
ATH_MSG_DEBUG
(
"eta bin used for cuts "
<< cutIndex );
137
}
138
cutCounter++;
// passed eta cut
139
140
// ET_em
141
ATH_MSG_DEBUG
(
"PrecisionCaloCluster: ET_em="
<< eT_Cluster <<
" cut: >"
<<
m_eTthr
[cutIndex] );
142
if
( eT_Cluster <
m_eTthr
[cutIndex] ) {
143
ATH_MSG_DEBUG
(
"REJECT et cut failed"
);
144
return
pass;
145
}
146
mon_eT_Cluster = eT_Cluster;
147
148
// got this far => passed!
149
pass =
true
;
150
cutCounter++;
151
// Reach this point successfully
152
ATH_MSG_DEBUG
(
"pass = "
<< pass );
153
154
return
pass;
155
156
}
157
158
int
TrigEgammaPrecisionCaloHypoTool::findCutIndex
(
float
eta
)
const
{
159
const
float
absEta = std::abs(
eta
);
160
161
auto
binIterator = std::adjacent_find(
m_etabin
.begin(),
m_etabin
.end(), [=](
float
left,
float
right){ return left < absEta and absEta < right; } );
162
if
( binIterator ==
m_etabin
.end() ) {
163
return
-1;
164
}
165
return
binIterator -
m_etabin
.begin();
166
}
167
168
169
StatusCode
TrigEgammaPrecisionCaloHypoTool::decide
( std::vector<ClusterInfo>& input )
const
{
170
for
(
auto
& i: input ) {
171
if
(
TCU::passed
(
m_decisionId
.
numeric
(), i.previousDecisionIDs ) ) {
172
if
(
decide
( i ) ) {
173
TCU::addDecisionID
(
m_decisionId
, i.decision );
174
}
175
}
176
}
177
return
StatusCode::SUCCESS;
178
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CaloCluster.h
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
Combinators.h
HLTIdentifier.h
CHECK_SIZE
#define CHECK_SIZE(__n)
TrigEgammaPrecisionCaloHypoTool.h
TrigRoiDescriptorCollection.h
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition
TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:41
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
TrigEgammaPrecisionCaloHypoTool::m_etabin
Gaudi::Property< std::vector< float > > m_etabin
selection variable for PRECISION calo selection:eta bins
Definition
TrigEgammaPrecisionCaloHypoTool.h:34
TrigEgammaPrecisionCaloHypoTool::decide
virtual StatusCode decide(std::vector< ITrigEgammaPrecisionCaloHypoTool::ClusterInfo > &input) const override
TrigEgammaPrecisionCaloHypoTool::m_dphicluster
Gaudi::Property< float > m_dphicluster
Definition
TrigEgammaPrecisionCaloHypoTool.h:38
TrigEgammaPrecisionCaloHypoTool::m_eTthr
Gaudi::Property< std::vector< float > > m_eTthr
Definition
TrigEgammaPrecisionCaloHypoTool.h:35
TrigEgammaPrecisionCaloHypoTool::TrigEgammaPrecisionCaloHypoTool
TrigEgammaPrecisionCaloHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TrigEgammaPrecisionCaloHypoTool.cxx:17
TrigEgammaPrecisionCaloHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
TrigEgammaPrecisionCaloHypoTool.h:40
TrigEgammaPrecisionCaloHypoTool::m_detacluster
Gaudi::Property< float > m_detacluster
Definition
TrigEgammaPrecisionCaloHypoTool.h:37
TrigEgammaPrecisionCaloHypoTool::m_eT2thr
Gaudi::Property< std::vector< float > > m_eT2thr
Definition
TrigEgammaPrecisionCaloHypoTool.h:36
TrigEgammaPrecisionCaloHypoTool::initialize
virtual StatusCode initialize() override
Definition
TrigEgammaPrecisionCaloHypoTool.cxx:23
TrigEgammaPrecisionCaloHypoTool::findCutIndex
int findCutIndex(float eta) const
Definition
TrigEgammaPrecisionCaloHypoTool.cxx:158
TrigEgammaPrecisionCaloHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
TrigEgammaPrecisionCaloHypoTool.h:31
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
Identifier
Definition
IdentifierFieldParser.cxx:14
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
type
ITrigEgammaPrecisionCaloHypoTool::ClusterInfo
Definition
ITrigEgammaPrecisionCaloHypoTool.h:25
Generated on
for ATLAS Offline Software by
1.17.0