ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRec
Root
JetPruner.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// JetPruner.cxx
6
7
#include "
JetRec/JetPruner.h
"
8
#include <iomanip>
9
#include "fastjet/PseudoJet.hh"
10
#include "fastjet/tools/Pruner.hh"
11
#include "
JetEDM/PseudoJetVector.h
"
12
#include "
JetEDM/FastJetUtils.h
"
13
#include "
JetRec/JetDumper.h
"
14
15
using
std::setw;
16
using
fastjet::PseudoJet;
17
using
xAOD::JetContainer
;
18
19
//**********************************************************************
20
21
JetPruner::JetPruner
(
const
std::string& name)
22
:
AsgTool
(name),
m_bld
(
""
,this) {
23
declareProperty
(
"JetAlgorithm"
,
m_jetalg
=
"CamKt"
);
24
declareProperty
(
"RCut"
,
m_rcut
=0.3);
25
declareProperty
(
"ZCut"
,
m_zcut
=0.10);
26
declareProperty
(
"JetBuilder"
,
m_bld
);
27
}
28
29
//**********************************************************************
30
31
JetPruner::~JetPruner
() =
default
;
32
33
//**********************************************************************
34
35
StatusCode
JetPruner::initialize
() {
36
xAOD::JetAlgorithmType::ID
ialg =
xAOD::JetAlgorithmType::algId
(
m_jetalg
);
37
m_fjalg
=
xAOD::JetAlgorithmType::fastJetDef
(ialg);
38
if
(
m_fjalg
== fastjet::undefined_jet_algorithm ) {
39
ATH_MSG_ERROR
(
"Invalid jet algorithm name: "
<<
m_jetalg
);
40
ATH_MSG_ERROR
(
"Allowed values are Kt, CamKt, AntiKt, etc."
);
41
return
StatusCode::FAILURE;
42
}
43
if
(
m_rcut < 0.0 || m_rcut >
10.0 ) {
44
ATH_MSG_ERROR
(
"Invalid value for RCut "
<<
m_rcut
);
45
return
StatusCode::FAILURE;
46
}
47
if
(
m_zcut < 0.0 || m_zcut >
1.0 ) {
48
ATH_MSG_ERROR
(
"Invalid value for ZCut "
<<
m_zcut
);
49
return
StatusCode::FAILURE;
50
}
51
if
(
m_bld
.empty() ) {
52
ATH_MSG_ERROR
(
"Unable to retrieve jet builder."
);
53
return
StatusCode::FAILURE;
54
}
55
return
StatusCode::SUCCESS;
56
}
57
58
//**********************************************************************
59
60
int
JetPruner::groom
(
const
xAOD::Jet
& jin,
61
const
PseudoJetContainer
& pjContainer,
62
xAOD::JetContainer
& jets)
const
{
63
if
(
pseudojetRetriever
() ==
nullptr
) {
64
ATH_MSG_WARNING
(
"Pseudojet retriever is null."
);
65
return
1;
66
}
67
const
PseudoJet* ppjin =
pseudojetRetriever
()->
pseudojet
(jin);
68
if
( ppjin ==
nullptr
) {
69
ATH_MSG_WARNING
(
"Jet does not have a pseudojet."
);
70
return
1;
71
}
72
// Prune.
73
fastjet::Pruner pruner(
m_fjalg
,
m_zcut
,
m_rcut
);
74
PseudoJet pjprun = pruner(*ppjin);
75
ATH_MSG_VERBOSE
(
" Input cluster sequence: "
<< ppjin->associated_cluster_sequence());
76
ATH_MSG_VERBOSE
(
" Pruned cluster sequence: "
<< pjprun.associated_cluster_sequence());
77
// Add jet to collection.
78
xAOD::Jet
* pjet =
m_bld
->add(pjprun, pjContainer, jets, &jin);
79
pjet->
setAttribute
<
float
>(
"RCut"
,
m_rcut
);
80
pjet->
setAttribute
<
float
>(
"ZCut"
,
m_zcut
);
81
pjet->
setAttribute
<
int
>(
"TransformType"
,
xAOD::JetTransform::Prune
);
82
ATH_MSG_DEBUG
(
"Properties after pruning:"
);
83
ATH_MSG_DEBUG
(
" ncon: "
<< pjprun.constituents().size() <<
"/"
84
<< ppjin->constituents().size());
85
ATH_MSG_DEBUG
(
" nsub: "
<< pjprun.pieces().size());
86
return
0;
87
}
88
89
//**********************************************************************
90
91
void
JetPruner::print
()
const
{
92
ATH_MSG_INFO
(
" Jet algorithm: "
<<
m_jetalg
);
93
ATH_MSG_INFO
(
" R cut factor: "
<<
m_rcut
);
94
ATH_MSG_INFO
(
" Z cut: "
<<
m_zcut
);
95
ATH_MSG_INFO
(
" Jet builder: "
<<
m_bld
.name());
96
}
97
98
//**********************************************************************
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FastJetUtils.h
JetDumper.h
JetPruner.h
PseudoJetVector.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
IJetGroomer::pseudojetRetriever
virtual const IJetPseudojetRetriever * pseudojetRetriever() const
Return the pseudojet retriever associated with this tool.
Definition
IJetGroomer.cxx:21
IJetPseudojetRetriever::pseudojet
virtual const fastjet::PseudoJet * pseudojet(const xAOD::Jet &jet) const =0
Retrieve the pseudojet associate with a jet.
JetPruner::groom
int groom(const xAOD::Jet &jin, const PseudoJetContainer &, xAOD::JetContainer &jout) const
Transform jet.
Definition
JetPruner.cxx:60
JetPruner::m_bld
ToolHandle< IJetFromPseudojet > m_bld
Definition
JetPruner.h:51
JetPruner::JetPruner
JetPruner(const std::string &name)
Definition
JetPruner.cxx:21
JetPruner::m_zcut
float m_zcut
Definition
JetPruner.h:49
JetPruner::m_rcut
float m_rcut
Definition
JetPruner.h:50
JetPruner::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition
JetPruner.cxx:35
JetPruner::m_jetalg
std::string m_jetalg
Definition
JetPruner.h:48
JetPruner::print
void print() const
Print the state of the tool.
Definition
JetPruner.cxx:91
JetPruner::~JetPruner
~JetPruner()
JetPruner::m_fjalg
fastjet::JetAlgorithm m_fjalg
Definition
JetPruner.h:54
PseudoJetContainer
Definition
PseudoJetContainer.h:48
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
xAOD::Jet_v1::setAttribute
void setAttribute(const std::string &name, const T &v)
xAOD::JetAlgorithmType::algId
ID algId(const std::string &n)
Converts a string into a JetAlgorithmType::ID.
Definition
JetContainerInfo.cxx:76
xAOD::JetAlgorithmType::fastJetDef
fastjet::JetAlgorithm fastJetDef(ID id)
Definition
FastJetUtils.cxx:20
xAOD::JetAlgorithmType::ID
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...
Definition
JetContainerInfo.h:29
xAOD::JetTransform::Prune
@ Prune
Definition
JetContainerInfo.h:116
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
Generated on
for ATLAS Offline Software by
1.17.0