ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypo
src
UHT1TauCondition.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 "
./UHT1TauCondition.h
"
6
#include "
./ITrigJetHypoInfoCollector.h
"
7
#include "
TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h
"
8
#include "
TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJet.h
"
9
#include "
TrigBjetHypo/safeLogRatio.h
"
10
11
#include <sstream>
12
#include <cmath>
13
#include <TLorentzVector.h>
14
15
UHT1TauCondition::UHT1TauCondition
(
float
workingPoint,
16
const
std::string &decName_ptau,
17
const
std::string &decName_pu,
18
const
std::string &decName_isValid) :
19
m_workingPoint
(workingPoint),
20
m_decName_ptau
(decName_ptau),
21
m_decName_pu
(decName_pu),
22
m_decName_isValid
(decName_isValid)
23
{
24
25
}
26
27
float
UHT1TauCondition::getUHT1TauDecValue
(
const
pHypoJet
&ip,
28
const
std::unique_ptr<ITrigJetHypoInfoCollector> &collector,
29
const
std::string &decName)
const
30
{
31
32
float
momentValue = -1;
33
if
(!(ip->getAttribute(decName, momentValue)))
34
{
35
if
(collector)
36
{
37
auto
j_addr =
static_cast<
const
void
*
>
(ip.get());
38
39
std::stringstream ss0;
40
ss0 <<
"UHT1TauCondition: "
41
<<
" unable to retrieve "
<< decName <<
'\n'
;
42
std::stringstream ss1;
43
ss1 <<
" jet : ("
<< j_addr <<
")"
;
44
collector->collect(ss0.str(), ss1.str());
45
}
46
47
throw
std::runtime_error(
"Impossible to retrieve decorator \'"
+ decName +
"\' for jet hypo"
);
48
}
49
50
return
momentValue;
51
}
52
53
float
UHT1TauCondition::evaluateUHT1Tau
(
const
float
&ptau,
54
const
float
&pu)
const
{
55
return
safeLogRatio
(ptau, pu);
56
}
57
58
bool
UHT1TauCondition::isSatisfied
(
const
pHypoJet
&ip,
59
const
std::unique_ptr<ITrigJetHypoInfoCollector> &collector)
const
60
{
61
if
(!
m_decName_isValid
.empty()) {
62
// short circuit if uht1tau is invalid and we ask for a check
63
//
64
// we have to dynamic cast to xAOD jets here because there's no char
65
// accessor on IJet and it's not clear if we need one generally.
66
const
auto
*
jet
=
dynamic_cast<
const
HypoJet::xAODJetAsIJet
*
>
(ip.get());
67
if
(!
jet
)
throw
std::runtime_error(
"Fast uht1tau has to run on xAOD::Jet"
);
68
char
valid = (*
jet
->xAODJet())->getAttribute<
char
>(
m_decName_isValid
);
69
if
(valid == 0)
return
false
;
70
}
71
72
// if we got this far check the uht1tau hypo
73
float
ptau =
getUHT1TauDecValue
(ip, collector,
m_decName_ptau
);
74
float
pu =
getUHT1TauDecValue
(ip, collector,
m_decName_pu
);
75
float
output =
evaluateUHT1Tau
(ptau, pu);
76
77
bool
pass = (output >=
m_workingPoint
);
78
79
if
(collector)
80
{
81
const
void
*address =
static_cast<
const
void
*
>
(
this
);
82
83
std::stringstream ss0;
84
ss0 <<
"UHT1TauCondition: ("
<< address
85
<<
")"
86
<<
" pass: "
<< std::boolalpha << pass <<
'\n'
;
87
88
auto
j_addr =
static_cast<
const
void
*
>
(ip.get());
89
std::stringstream ss1;
90
ss1 <<
" jet : ("
<< j_addr <<
") "
91
<<
m_decName_ptau
<<
" value: "
<< ptau <<
'\n'
;
92
93
collector->collect(ss0.str(), ss1.str());
94
}
95
96
return
pass;
97
}
98
99
bool
100
UHT1TauCondition::isSatisfied
(
const
HypoJetVector
& ips,
101
const
std::unique_ptr<ITrigJetHypoInfoCollector>& c)
const
{
102
auto
result =
isSatisfied
(ips[0], c);
103
return
result;
104
}
105
106
107
std::string
UHT1TauCondition::toString
()
const
{
108
std::stringstream
ss
;
109
ss
<<
"UHT1TauCondition ("
<<
this
<<
") "
110
<<
" Cleaning decs: "
111
<<
m_decName_ptau
<<
", "
112
<<
m_decName_pu
<<
", "
113
<<
'\n'
;
114
115
return
ss
.str();
116
}
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition
HypoJetDefs.h:27
pHypoJet
std::shared_ptr< const HypoJet::IJet > pHypoJet
Definition
HypoJetDefs.h:25
IJet.h
ITrigJetHypoInfoCollector.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
UHT1TauCondition.h
HypoJet::xAODJetAsIJet
Definition
xAODJetAsIJet.h:16
UHT1TauCondition::getUHT1TauDecValue
float getUHT1TauDecValue(const pHypoJet &ip, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, const std::string &decName) const
Definition
UHT1TauCondition.cxx:27
UHT1TauCondition::m_decName_pu
std::string m_decName_pu
Definition
UHT1TauCondition.h:50
UHT1TauCondition::evaluateUHT1Tau
float evaluateUHT1Tau(const float &uht1tau_ptau, const float &uht1tau_pu) const
Definition
UHT1TauCondition.cxx:53
UHT1TauCondition::isSatisfied
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition
UHT1TauCondition.cxx:100
UHT1TauCondition::toString
std::string toString() const override
Definition
UHT1TauCondition.cxx:107
UHT1TauCondition::UHT1TauCondition
UHT1TauCondition(float workingPoint, const std::string &decName_ptau, const std::string &decName_pu, const std::string &decName_isValid="")
Definition
UHT1TauCondition.cxx:15
UHT1TauCondition::m_decName_ptau
std::string m_decName_ptau
Definition
UHT1TauCondition.h:49
UHT1TauCondition::m_workingPoint
float m_workingPoint
Definition
UHT1TauCondition.h:48
UHT1TauCondition::m_decName_isValid
std::string m_decName_isValid
Definition
UHT1TauCondition.h:51
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
safeLogRatio
float safeLogRatio(float num, float denom)
Definition
safeLogRatio.cxx:10
safeLogRatio.h
xAODJetAsIJet.h
Generated on
for ATLAS Offline Software by
1.17.0