ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetSubStructureMomentTools
Root
SubjetRecorderTool.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
#include "
JetSubStructureMomentTools/SubjetRecorderTool.h
"
6
#include "
xAODJet/JetContainer.h
"
7
#include "
xAODJet/JetAuxContainer.h
"
8
#include "
JetEDM/JetConstituentFiller.h
"
9
#include "
JetEDM/FastJetUtils.h
"
10
11
SubjetRecorderTool::SubjetRecorderTool
(
const
std::string& name) :
12
AsgTool
(name),
m_subjetlabel
(
""
),
m_subjetcontainername
(
""
)
13
{
14
declareProperty
(
"SubjetLabel"
,
m_subjetlabel
);
15
declareProperty
(
"SubjetContainerName"
,
m_subjetcontainername
);
16
}
17
18
std::vector<xAOD::Jet *>
SubjetRecorderTool::recordSubjets
(
const
std::vector<fastjet::PseudoJet>& subjets,
xAOD::Jet
&
jet
)
const
19
{
20
// Retrieve or set up subjet container
21
std::string subjet_name =
m_subjetlabel
;
22
std::string subjet_container_name =
m_subjetcontainername
;
23
if
(subjet_name.empty() || subjet_container_name.empty()) {
24
ATH_MSG_ERROR
(
"Invalid subjet label or container name"
);
25
return
{};
26
}
27
xAOD::JetContainer
*subjet_container =
nullptr
;
28
#ifdef ROOTCORE
29
subjet_container =
evtStore
()->retrieve<
xAOD::JetContainer
>(subjet_container_name);
30
#else
31
// Need tryRetrieve to supress some Athena warning. Unfortuantely tryRetrieve isn't in RootCore
32
subjet_container =
evtStore
()->tryRetrieve<
xAOD::JetContainer
>(subjet_container_name);
33
#endif
34
if
(subjet_container ==
nullptr
) {
35
StatusCode
sc
;
36
subjet_container =
new
xAOD::JetContainer
;
37
subjet_container->setStore(
new
xAOD::JetAuxContainer
);
38
sc
=
evtStore
()->record(subjet_container, subjet_container_name);
39
if
(
sc
.isFailure()) {
40
ATH_MSG_ERROR
(
"Error recording subjet container ("
<< subjet_container_name <<
")"
);
41
return
{};
42
}
43
sc
=
evtStore
()->record(
dynamic_cast<
xAOD::JetAuxContainer
*
>
(subjet_container->getStore()), subjet_container_name +
"Aux."
);
44
if
(
sc
.isFailure()) {
45
ATH_MSG_ERROR
(
"Error recording subjet aux container ("
<< subjet_container_name <<
"Aux.)"
);
46
return
{};
47
}
48
}
49
50
// Create xAOD::Jet's
51
std::vector<const xAOD::Jet *> subj_ptrs_const;
52
std::vector<xAOD::Jet *> subj_ptrs;
53
for
(
auto
it = subjets.begin(); it != subjets.end(); it++) {
54
xAOD::Jet
*subj =
new
xAOD::Jet
();
55
subjet_container->
push_back
(subj);
56
subj_ptrs.push_back(subj);
57
subj_ptrs_const.push_back(subj);
58
59
// Set 4-mom
60
subj->
setJetP4
(
xAOD::JetFourMom_t
(it->pt(), it->eta(), it->phi(), it->m()));
61
subj->
setJetP4
(
xAOD::JetConstitScaleMomentum
, subj->
jetP4
());
62
63
// Set constituents
64
jet::JetConstituentFiller
confiller;
65
confiller.
extractConstituents
(*subj, &(*it));
66
67
// Set author/radius
68
double
radius = it->associated_cluster_sequence()->jet_def().R();
69
subj->
setSizeParameter
(radius);
70
xAOD::JetAlgorithmType::ID
alg =
xAOD::JetAlgorithmType::algId
(it->associated_cluster_sequence()->jet_def().jet_algorithm());
71
subj->
setAlgorithmType
(alg);
72
73
// Set association to parent
74
const
xAOD::JetContainer
*parent_container =
dynamic_cast<
const
xAOD::JetContainer
*
>
(
jet
.container());
75
ElementLink<xAOD::JetContainer>
el_parent(*parent_container,
jet
.index());
76
subj->
setAttribute
(
"Parent"
, el_parent);
77
}
78
79
// Set association to subjets
80
jet
.setAssociatedObjects(subjet_name, subj_ptrs_const);
81
82
return
subj_ptrs;
83
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
FastJetUtils.h
JetAuxContainer.h
JetConstituentFiller.h
JetContainer.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
SubjetRecorderTool.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SubjetRecorderTool::m_subjetlabel
std::string m_subjetlabel
Definition
SubjetRecorderTool.h:28
SubjetRecorderTool::m_subjetcontainername
std::string m_subjetcontainername
Definition
SubjetRecorderTool.h:29
SubjetRecorderTool::recordSubjets
std::vector< xAOD::Jet * > recordSubjets(const std::vector< fastjet::PseudoJet > &subjets, xAOD::Jet &jet) const
Definition
SubjetRecorderTool.cxx:18
SubjetRecorderTool::SubjetRecorderTool
SubjetRecorderTool(const std::string &name)
Definition
SubjetRecorderTool.cxx:11
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
jet::JetConstituentFiller
Definition
JetConstituentFiller.h:27
jet::JetConstituentFiller::extractConstituents
int extractConstituents(xAOD::Jet &jet, const NameList *pghostlabs, const fastjet::PseudoJet *ppj=0)
Build and fill constituents of jet from its PseudoJet (or from ppj) Returns the number of pseudojet c...
Definition
JetConstituentFiller.cxx:41
xAOD::Jet_v1::setAlgorithmType
void setAlgorithmType(JetAlgorithmType::ID a)
Definition
Jet_v1.cxx:269
xAOD::Jet_v1::setAttribute
void setAttribute(const std::string &name, const T &v)
xAOD::Jet_v1::setJetP4
void setJetP4(const JetFourMom_t &p4)
Definition
Jet_v1.cxx:182
xAOD::Jet_v1::setSizeParameter
void setSizeParameter(float p)
Definition
Jet_v1.cxx:268
xAOD::Jet_v1::jetP4
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition
Jet_v1.cxx:76
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::JetAlgorithmType::algId
ID algId(const std::string &n)
Converts a string into a JetAlgorithmType::ID.
Definition
JetContainerInfo.cxx:76
xAOD::JetAlgorithmType::ID
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...
Definition
JetContainerInfo.h:29
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetAuxContainer
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
Definition
JetAuxContainer.h:22
xAOD::JetConstitScaleMomentum
@ JetConstitScaleMomentum
Definition
JetTypes.h:29
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition
JetTypes.h:17
Generated on
for ATLAS Offline Software by
1.17.0