Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ClusterFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 
8 ClusterFinder::ClusterFinder(const std::string& type,
9  const std::string& name,
10  const IInterface * parent) :
12  m_Rsubjet(0.2)
13 {
14  declareInterface<DiTauToolBase > (this);
15  declareProperty("Rsubjet", m_Rsubjet);
16 }
17 
18 
20 
21 
23 
24  return StatusCode::SUCCESS;
25 }
26 
27 
29  const EventContext& /*ctx*/) const {
30 
31  ATH_MSG_DEBUG("execute ClusterFinder...");
32 
33  // get ditau and its seed jet
34 
35  xAOD::DiTauJet* pDiTau = data->xAODDiTau;
36  if (!pDiTau) {
37  ATH_MSG_ERROR("no di-tau candidate given");
38  return StatusCode::FAILURE;
39  }
40 
41  const xAOD::Jet* pSeed = data->seed;
42  if (!pSeed) {
43  ATH_MSG_WARNING("No jet seed given.");
44  return StatusCode::FAILURE;
45  }
46 
47  std::vector<fastjet::PseudoJet> vSubjets = data->subjets;
48  if (vSubjets.empty()) {
49  ATH_MSG_WARNING("No subjets given. Continue without cluster information.");
50  return StatusCode::SUCCESS;
51  }
52 
53  std::vector<const xAOD::CaloCluster*> subjetClusters;
54  // loop over seed jet constituents
55  for (const auto *const seedConst: pSeed->getConstituents()) {
56 
57  // cast jet constituent to cluster object
58  const xAOD::CaloCluster* cluster = dynamic_cast<const xAOD::CaloCluster*>( seedConst->rawConstituent() );
59  if(cluster == NULL) continue;
60 
61  for (const auto& subjet : vSubjets) {
62  TLorentzVector temp_sub_p4;
63  temp_sub_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m());
64  if (cluster->p4().DeltaR(temp_sub_p4) < m_Rsubjet) {
65  subjetClusters.push_back(cluster);
66  }
67  }
68  }
69 
70  ATH_MSG_DEBUG("subjetCluster.size()=" << subjetClusters.size());
71 
72  std::vector<float> vec_f_core(vSubjets.size(), 0);
73  for (unsigned int i = 0; i < vSubjets.size(); i++) {
74  const fastjet::PseudoJet& subjet = vSubjets.at(i);
75  float ptAll = 0.;
76  float ptCore = 0.;
77  float f_core = 0.;
78 
79  TLorentzVector temp_sub_p4;
80  temp_sub_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m());
81 
82  for (const auto& cc : subjetClusters) {
83 
84  if (cc->p4().DeltaR(temp_sub_p4) < data->Rsubjet) {
85  ptAll += cc->pt();
86  }
87 
88  if (cc->p4().DeltaR(temp_sub_p4) < data->Rcore) {
89  ptCore += cc->pt();
90  }
91  }
92 
93  if (ptAll != 0.)
94  f_core = ptCore/ptAll;
95  else
96  f_core = -999.;
97 
98  ATH_MSG_DEBUG("subjet "<< i << ": f_cluster_core=" << f_core);
99  vec_f_core.at(i) = f_core;
100  }
101 
102  const static SG::Decorator<std::vector<float>> mDecor("f_cluster_core");
103  mDecor(*pDiTau) = std::move(vec_f_core);
104 
105  return StatusCode::SUCCESS;
106 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
FlavorTagDiscriminants::hbb_key::subjet
const std::string subjet
Definition: HbbConstants.h:18
ClusterFinder::ClusterFinder
ClusterFinder(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ClusterFinder.cxx:8
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:62
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ClusterFinder::m_Rsubjet
float m_Rsubjet
Definition: ClusterFinder.h:28
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
ClusterFinder.h
ClusterFinder::initialize
virtual StatusCode initialize() override
Tool initializer.
Definition: ClusterFinder.cxx:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DiTauToolBase
The base class for all tau tools.
Definition: DiTauToolBase.h:20
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
ClusterFinder::execute
virtual StatusCode execute(DiTauCandidateData *data, const EventContext &ctx) const override
Execute - called for each Ditau candidate.
Definition: ClusterFinder.cxx:28
DiTauCandidateData
Definition: DiTauCandidateData.h:15
ClusterFinder::~ClusterFinder
virtual ~ClusterFinder()
python.handimod.cc
int cc
Definition: handimod.py:523