ATLAS Offline Software
JetBottomUpSoftDrop.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 // JetBottomUpSoftDrop.cxx
6 
8 #include <iomanip>
9 #include "fastjet/PseudoJet.hh"
10 #include "fastjet/JetDefinition.hh"
11 #include "fastjet/Selector.hh"
12 #include "fastjet/tools/Filter.hh"
13 #include "JetEDM/PseudoJetVector.h"
14 
15 
16 using std::setw;
17 using fastjet::PseudoJet;
18 using xAOD::JetContainer;
19 
20 //**********************************************************************
21 
23  : AsgTool(name), m_bld("",this) {
24  declareProperty("ZCut", m_zcut =0.1);
25  declareProperty("Beta", m_beta =0.0);
26  declareProperty("R0", m_R0 =1.0);
27  declareProperty("JetBuilder", m_bld);
28 }
29 
30 //**********************************************************************
31 
33 
34 //**********************************************************************
35 
37  if ( m_zcut < 0.0 || m_zcut > 10.0 ) {
38  ATH_MSG_ERROR("Invalid value for ZCut " << m_zcut);
39  return StatusCode::FAILURE;
40  }
41  if ( m_beta < 0.0 || m_beta > 10.0 ) {
42  ATH_MSG_ERROR("Invalid value for Beta " << m_beta);
43  return StatusCode::FAILURE;
44  }
45  if ( m_R0 < 0.0 || m_R0 > 10.0 ) {
46  ATH_MSG_ERROR("Invalid value for R0 " << m_R0);
47  return StatusCode::FAILURE;
48  }
49  if ( m_bld.empty() ) {
50  ATH_MSG_ERROR("Unable to retrieve jet builder.");
51  return StatusCode::FAILURE;
52  }
53  return StatusCode::SUCCESS;
54 }
55 
56 //**********************************************************************
57 
59  const PseudoJetContainer& pjContainer,
60  xAOD::JetContainer& jets) const {
61  if ( pseudojetRetriever() == nullptr ) {
62  ATH_MSG_WARNING("Pseudojet retriever is null.");
63  return 1;
64  }
65  const PseudoJet* ppjin = pseudojetRetriever()->pseudojet(jin);
66  if ( ppjin == nullptr ) {
67  ATH_MSG_WARNING("Jet does not have a pseudojet.");
68  return 1;
69  }
70 
72  //configure bottom up soft drop tool
73  //https://fastjet.hepforge.org/trac/browser/contrib/contribs/RecursiveTools/tags/2.0.0-beta1
75  fastjet::contrib::BottomUpSoftDrop softdropper(m_beta, m_zcut, m_R0);
76  PseudoJet pjsoftdrop = softdropper(*ppjin);
77  int npsoftdrop = pjsoftdrop.pieces().size();
78  xAOD::Jet* pjet = m_bld->add(pjsoftdrop, pjContainer, jets, &jin);
79  if ( pjet == nullptr ) {
80  ATH_MSG_ERROR("Unable to add jet to container");
81  return 1;
82  }
83  pjet->setAttribute<float>("ZCut", m_zcut);
84  pjet->setAttribute<float>("SoftDropBeta", m_beta);
85  pjet->setAttribute<float>("SoftDropR0", m_R0);
86  pjet->setAttribute<int>("NSoftDropSubjets", npsoftdrop);
87 
88  ATH_MSG_DEBUG("Properties after softdrop:");
89  ATH_MSG_DEBUG(" ncon: " << pjsoftdrop.constituents().size() << "/"
90  << ppjin->constituents().size());
91  ATH_MSG_DEBUG(" nsub: " << npsoftdrop);
92 
93  ATH_MSG_DEBUG("Added jet to container.");
94 
95  return 0;
96 }
97 
98 //**********************************************************************
99 
101  ATH_MSG_INFO(" Asymmetry measure min: " << m_zcut);
102  ATH_MSG_INFO(" Angular exponent: " << m_beta);
103  ATH_MSG_INFO(" Characteristic jet radius: " << m_R0);
104  ATH_MSG_INFO(" Jet builder: " << m_bld.name());
105 }
106 
107 //**********************************************************************
JetBottomUpSoftDrop::JetBottomUpSoftDrop
JetBottomUpSoftDrop(const std::string &name)
Definition: JetBottomUpSoftDrop.cxx:22
JetBottomUpSoftDrop::m_zcut
float m_zcut
Definition: JetBottomUpSoftDrop.h:58
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
JetBottomUpSoftDrop::print
void print() const
Print the state of the tool.
Definition: JetBottomUpSoftDrop.cxx:100
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PseudoJetVector.h
IJetGroomer::pseudojetRetriever
virtual const IJetPseudojetRetriever * pseudojetRetriever() const
Return the pseudojet retriever associated with this tool.
Definition: IJetGroomer.cxx:21
PseudoJetContainer
Definition: PseudoJetContainer.h:48
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
JetBottomUpSoftDrop::groom
int groom(const xAOD::Jet &jin, const PseudoJetContainer &, xAOD::JetContainer &jout) const
Transform jet.
Definition: JetBottomUpSoftDrop.cxx:58
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::Jet_v1::setAttribute
void setAttribute(const std::string &name, const T &v)
JetBottomUpSoftDrop::m_bld
ToolHandle< IJetFromPseudojet > m_bld
Definition: JetBottomUpSoftDrop.h:61
JetBottomUpSoftDrop::m_R0
float m_R0
Definition: JetBottomUpSoftDrop.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IJetPseudojetRetriever::pseudojet
virtual const fastjet::PseudoJet * pseudojet(const xAOD::Jet &jet) const =0
Retrieve the pseudojet associate with a jet.
JetBottomUpSoftDrop::~JetBottomUpSoftDrop
~JetBottomUpSoftDrop()
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetBottomUpSoftDrop::m_beta
float m_beta
Definition: JetBottomUpSoftDrop.h:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
JetBottomUpSoftDrop.h
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition: JetContainer.h:17
JetBottomUpSoftDrop::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetBottomUpSoftDrop.cxx:36