ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagDiscriminants
Root
VRJetOverlapDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
FlavorTagDiscriminants/VRJetOverlapDecorator.h
"
5
6
namespace
{
7
8
struct
VRConfig {
9
VRConfig();
10
double
min;
11
double
max;
12
double
scale;
13
};
14
VRConfig::VRConfig():
15
min
(NAN),
16
max
(NAN),
17
scale
(NAN)
18
{}
19
20
21
double
getRadius(
const
TLorentzVector&
vec
,
const
VRConfig& cfg) {
22
return
std::max(
cfg
.min, std::min(
cfg
.max,
cfg
.scale /
vec
.Pt()));
23
}
24
struct
VRJetDR {
25
double
relative;
26
double
absolute;
27
};
28
29
std::vector<VRJetDR> getMinimumRelativeDR(
const
xAOD::JetContainer
& jets,
30
const
VRConfig& cfg) {
31
const
size_t
n_jets =
jets
.size();
32
std::vector<VRJetDR> min_dr(n_jets, {INFINITY,INFINITY});
33
for
(
size_t
iii = 0; iii < n_jets; iii++) {
34
const
xAOD::Jet
*
j1
=
jets
.at(iii);
35
const
TLorentzVector j1p4 =
j1
->p4();
36
const
double
j1_radius = getRadius(j1p4, cfg);
37
for
(
size_t
jjj = iii+1; jjj < n_jets; jjj++) {
38
const
xAOD::Jet
*
j2
=
jets
.at(jjj);
39
const
TLorentzVector j2p4 =
j2
->p4();
40
const
double
j2_radius = getRadius(j2p4, cfg);
41
const
double
min_radius = std::min(j1_radius, j2_radius);
42
const
double
dR = j1p4.DeltaR(j2p4);
43
const
double
rel_dR = dR / min_radius;
44
// check both jets, if the relative dR is less than whatever
45
// we have recorded, save this relative dR and absolute dR
46
for
(
const
size_t
idx: {iii,jjj}) {
47
if
(rel_dR < min_dr.at(idx).relative) {
48
VRJetDR vrstruct;
49
vrstruct.relative = rel_dR;
50
vrstruct.absolute = dR;
51
min_dr.at(idx) = vrstruct;
52
}
53
}
54
}
55
}
56
return
min_dr;
57
}
58
59
}
60
61
VRJetOverlapConfig::VRJetOverlapConfig
(
VRJetParameters
param_source):
62
relative_name
(
"relativeDeltaRToVRJet"
),
63
absolute_name
(
"deltaRToVRJet"
),
64
jet_parameters_source
(param_source)
65
{}
66
67
68
VRJetOverlapDecorator::VRJetOverlapDecorator
(
const
VRJetOverlapConfig
& cfg):
69
m_param_source
(cfg.jet_parameters_source),
70
m_rel_decorator
(cfg.relative_name),
71
m_abs_decorator
(cfg.absolute_name),
72
m_min_radius
(
"VariableRMinRadius"
),
73
m_max_radius
(
"SizeParameter"
),
74
m_mass_scale
(
"VariableRMassScale"
)
75
{
76
}
77
78
void
VRJetOverlapDecorator::decorate
(
const
xAOD::JetContainer
& jets)
const
{
79
// if no jet is present, do nothing
80
if
(jets.empty() &&
m_param_source
==
VRJetParameters::EDM
)
return
;
81
82
VRConfig cfg;
83
if
(
m_param_source
==
VRJetParameters::EDM
) {
84
// we'll assume all the jets have the same parameters, I don't
85
// know of counterexamples but if they exist we'd have to rethink
86
// all the code here.
87
const
xAOD::Jet
*
jet
= jets.at(0);
88
cfg.min =
m_min_radius
(*
jet
);
89
cfg.max =
m_max_radius
(*
jet
);
90
cfg.scale =
m_mass_scale
(*
jet
);
91
}
else
if
(
m_param_source
==
VRJetParameters::RHO30MIN02MAX4
) {
92
// right now we only have one set of VR jets where we'd use this
93
// tool thus the hardcoded numbers here.
94
cfg.min = 0.02;
95
cfg.max = 0.4;
96
cfg.scale = 30e3;
97
}
else
{
98
throw
std::logic_error(
"unknown jet parameter lookup"
);
99
}
100
auto
min_dr = getMinimumRelativeDR(jets, cfg);
101
for
(
size_t
iii = 0; iii < jets.size(); iii++) {
102
const
xAOD::Jet
*
jet
= jets.at(iii);
103
const
auto
drs = min_dr.at(iii);
104
m_rel_decorator
(*
jet
) = drs.relative;
105
m_abs_decorator
(*
jet
) = drs.absolute;
106
}
107
}
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
VRJetOverlapDecorator.h
VRJetParameters
VRJetParameters
Definition
VRJetOverlapDecorator.h:9
VRJetParameters::RHO30MIN02MAX4
@ RHO30MIN02MAX4
Definition
VRJetOverlapDecorator.h:9
VRJetParameters::EDM
@ EDM
Definition
VRJetOverlapDecorator.h:9
min
#define min(a, b)
Definition
cfImp.cxx:40
max
#define max(a, b)
Definition
cfImp.cxx:41
VRJetOverlapDecorator::m_rel_decorator
SG::AuxElement::Decorator< float > m_rel_decorator
Definition
VRJetOverlapDecorator.h:25
VRJetOverlapDecorator::m_mass_scale
SG::AuxElement::ConstAccessor< float > m_mass_scale
Definition
VRJetOverlapDecorator.h:29
VRJetOverlapDecorator::m_min_radius
SG::AuxElement::ConstAccessor< float > m_min_radius
Definition
VRJetOverlapDecorator.h:27
VRJetOverlapDecorator::m_param_source
VRJetParameters m_param_source
Definition
VRJetOverlapDecorator.h:24
VRJetOverlapDecorator::m_abs_decorator
SG::AuxElement::Decorator< float > m_abs_decorator
Definition
VRJetOverlapDecorator.h:26
VRJetOverlapDecorator::m_max_radius
SG::AuxElement::ConstAccessor< float > m_max_radius
Definition
VRJetOverlapDecorator.h:28
VRJetOverlapDecorator::VRJetOverlapDecorator
VRJetOverlapDecorator(const VRJetOverlapConfig &=VRJetOverlapConfig())
Definition
VRJetOverlapDecorator.cxx:68
VRJetOverlapDecorator::decorate
void decorate(const xAOD::JetContainer &jets) const
Definition
VRJetOverlapDecorator.cxx:78
WriteCaloSwCorrections.cfg
cfg
Definition
WriteCaloSwCorrections.py:23
defineDB.jets
list jets
Definition
JetTagCalibration/share/defineDB.py:24
doubleTestComp.j2
j2
Definition
doubleTestComp.py:22
doubleTestComp.j1
j1
Definition
doubleTestComp.py:21
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
yodamerge_tmp.scale
scale
Definition
yodamerge_tmp.py:138
VRJetOverlapConfig
Definition
VRJetOverlapDecorator.h:11
VRJetOverlapConfig::absolute_name
std::string absolute_name
Definition
VRJetOverlapDecorator.h:14
VRJetOverlapConfig::VRJetOverlapConfig
VRJetOverlapConfig(VRJetParameters=VRJetParameters::RHO30MIN02MAX4)
Definition
VRJetOverlapDecorator.cxx:61
VRJetOverlapConfig::jet_parameters_source
VRJetParameters jet_parameters_source
Definition
VRJetOverlapDecorator.h:15
VRJetOverlapConfig::relative_name
std::string relative_name
Definition
VRJetOverlapDecorator.h:13
Generated on
for ATLAS Offline Software by
1.17.0