ATLAS Offline Software
SubjetBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // fastjet includes
8 #include "fastjet/ClusterSequenceArea.hh"
9 #include "fastjet/AreaDefinition.hh"
10 
12  const std::string& name,
13  const IInterface * parent) :
15  m_Rsubjet(0.2),
16  m_ptmin(10000)
17 {
18  declareInterface<DiTauToolBase > (this);
19  declareProperty("Rsubjet", m_Rsubjet);
20  declareProperty("ptminsubjet", m_ptmin);
21 }
22 
23 
25 
26 
28 
29  return StatusCode::SUCCESS;
30 }
31 
32 
34  const EventContext& /*ctx*/) const {
35 
36  ATH_MSG_DEBUG("subjet builder executing...");
37 
38  // get seed jet
39  xAOD::DiTauJet* pDiTau = data->xAODDiTau;
40 
41  if (pDiTau == nullptr) {
42  ATH_MSG_ERROR("no di-tau candidate given");
43  return StatusCode::FAILURE;
44  }
45 
46  const xAOD::Jet* pSeed = data->seed;
47  if (!pSeed) {
48  ATH_MSG_WARNING("no seed given. Di-Tau can not be reconstructed.");
49  return StatusCode::FAILURE;
50  }
51 
52  // retrieve seed jet clusters
53 
54  using namespace fastjet;
55  const xAOD::JetConstituentVector vConst = pSeed->getConstituents();
56 
57  if (vConst.empty()) {
58  ATH_MSG_WARNING("cluster constituents could not be retrieved from seed jet");
59  return StatusCode::FAILURE;
60  }
61 
62  std::vector<PseudoJet> vpjClusters;
63 
64  for (const auto *cl: vConst) {
65 
66  TLorentzVector temp_p4;
67  temp_p4.SetPtEtaPhiM(cl->pt(), cl->eta(), cl->phi(), cl->m());
68  PseudoJet c( temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E());
69 
70  vpjClusters.push_back(c);
71  }
72 
73  // reconstruct subjets
74 
75  // Jet and area definitions
76  JetDefinition jd = JetDefinition(antikt_algorithm, m_Rsubjet);
77  AreaDefinition area_def(active_area_explicit_ghosts,GhostedAreaSpec(SelectorAbsRapMax(4.0)));
78  ClusterSequenceArea cs(vpjClusters, jd, area_def);
79 
80  // store (pt-sorted) subjets
81  std::vector<PseudoJet> vSubjets = sorted_by_pt( cs.inclusive_jets(m_ptmin) );
82  if (vSubjets.size()<=1) {
83  ATH_MSG_DEBUG("Found less than 2 subjets. Reject ditau candidate");
84  return StatusCode::FAILURE;
85  }
86 
87  ATH_MSG_DEBUG("found "<< vSubjets.size() << " subjets");
88  for (const auto& subjet: vSubjets) {
89  ATH_MSG_DEBUG("pt: " << subjet.pt() << " eta: " << subjet.eta() << " phi: " << subjet.phi());
90  }
91 
92  data->subjets = vSubjets;
93  vSubjets.clear();
94 
95  return StatusCode::SUCCESS;
96 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
FlavorTagDiscriminants::hbb_key::subjet
const std::string subjet
Definition: HbbConstants.h:18
fastjet
Definition: FastJetLinkBase.h:22
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
SubjetBuilder::SubjetBuilder
SubjetBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: SubjetBuilder.cxx:11
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:228
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:33
xAOD::JetAlgorithmType::antikt_algorithm
@ antikt_algorithm
Definition: JetContainerInfo.h:33
SubjetBuilder::initialize
virtual StatusCode initialize() override
Tool initializer.
Definition: SubjetBuilder.cxx:27
SubjetBuilder::~SubjetBuilder
virtual ~SubjetBuilder()
Destructor.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
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