ATLAS Offline Software
SubjetBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "xAODJet/Jet.h"
10 #include "xAODJet/JetContainer.h"
12 
13 // fastjet includes
14 #include "fastjet/Selector.hh"
15 #include "fastjet/PseudoJet.hh"
16 #include "fastjet/JetDefinition.hh"
17 #include "fastjet/ClusterSequenceArea.hh"
18 #include "fastjet/AreaDefinition.hh"
19 #include "fastjet/tools/Filter.hh"
20 #include "fastjet/tools/Pruner.hh"
21 
22 
24  const std::string& name,
25  const IInterface * parent) :
27  m_Rsubjet(0.2),
28  m_ptmin(10000)
29 {
30  declareInterface<DiTauToolBase > (this);
31  declareProperty("Rsubjet", m_Rsubjet);
32  declareProperty("ptminsubjet", m_ptmin);
33 }
34 
35 
37 
38 
40 
41  return StatusCode::SUCCESS;
42 }
43 
44 
46  const EventContext& /*ctx*/) const {
47 
48  ATH_MSG_DEBUG("subjet builder executing...");
49 
50  // get seed jet
51  xAOD::DiTauJet* pDiTau = data->xAODDiTau;
52 
53  if (pDiTau == nullptr) {
54  ATH_MSG_ERROR("no di-tau candidate given");
55  return StatusCode::FAILURE;
56  }
57 
58  const xAOD::Jet* pSeed = data->seed;
59  if (!pSeed) {
60  ATH_MSG_WARNING("no seed given. Di-Tau can not be reconstructed.");
61  return StatusCode::FAILURE;
62  }
63 
64  // retrieve seed jet clusters
65 
66  using namespace fastjet;
67  const xAOD::JetConstituentVector vConst = pSeed->getConstituents();
68 
69  if (vConst.empty()) {
70  ATH_MSG_WARNING("cluster constituents could not be retrieved from seed jet");
71  return StatusCode::FAILURE;
72  }
73 
74  std::vector<PseudoJet> vpjClusters;
75 
76  for (const auto *cl: vConst) {
77 
78  TLorentzVector temp_p4;
79  temp_p4.SetPtEtaPhiM(cl->pt(), cl->eta(), cl->phi(), cl->m());
80  PseudoJet c( temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E());
81 
82  vpjClusters.push_back(c);
83  }
84 
85  // reconstruct subjets
86 
87  // Jet and area definitions
88  JetDefinition jd = JetDefinition(antikt_algorithm, m_Rsubjet);
89  AreaDefinition area_def(active_area_explicit_ghosts,GhostedAreaSpec(SelectorAbsRapMax(4.0)));
90  ClusterSequenceArea cs(vpjClusters, jd, area_def);
91 
92  // store (pt-sorted) subjets
93  std::vector<PseudoJet> vSubjets = sorted_by_pt( cs.inclusive_jets(m_ptmin) );
94  if (vSubjets.size()<=1) {
95  ATH_MSG_DEBUG("Found less than 2 subjets. Reject ditau candidate");
96  return StatusCode::FAILURE;
97  }
98 
99  ATH_MSG_DEBUG("found "<< vSubjets.size() << " subjets");
100  for (const auto& subjet: vSubjets) {
101  ATH_MSG_DEBUG("pt: " << subjet.pt() << " eta: " << subjet.eta() << " phi: " << subjet.phi());
102  }
103 
104  data->subjets = vSubjets;
105  vSubjets.clear();
106 
107  return StatusCode::SUCCESS;
108 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Jet.h
FlavorTagDiscriminants::hbb_key::subjet
const std::string subjet
Definition: HbbConstants.h:18
DiTauToolBase.h
fastjet
Definition: FastJetLinkBase.h:22
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DiTauCandidateData.h
SubjetBuilder::m_ptmin
float m_ptmin
Definition: SubjetBuilder.h:36
xAOD::Jet_v1::getConstituents
JetConstituentVector getConstituents() const
Return a vector of consituents. The object behaves like vector<const IParticle*>. See JetConstituentV...
Definition: Jet_v1.cxx:147
JetConstituentVector.h
This file defines helper classes to deal with jet constituents.
SubjetBuilder::SubjetBuilder
SubjetBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: SubjetBuilder.cxx:23
SubjetBuilder::m_Rsubjet
float m_Rsubjet
Definition: SubjetBuilder.h:35
xAOD::JetConstituentVector::empty
bool empty() const
true if vector is empty()
Definition: JetConstituentVector.cxx:101
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DiTauToolBase
The base class for all tau tools.
Definition: DiTauToolBase.h:20
SubjetBuilder::execute
virtual StatusCode execute(DiTauCandidateData *data, const EventContext &ctx) const override
Execute - called for each Ditau candidate.
Definition: SubjetBuilder.cxx:45
xAOD::JetAlgorithmType::antikt_algorithm
@ antikt_algorithm
Definition: JetContainerInfo.h:33
SubjetBuilder::initialize
virtual StatusCode initialize() override
Tool initializer.
Definition: SubjetBuilder.cxx:39
SubjetBuilder::~SubjetBuilder
virtual ~SubjetBuilder()
Destructor.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetContainer.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
DiTauCandidateData
Definition: DiTauCandidateData.h:15
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
SubjetBuilder.h