ATLAS Offline Software
Loading...
Searching...
No Matches
JetIRCSafeLabelTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef JETIRCSafeLabelTool_H
6#define JETIRCSafeLabelTool_H
7
9#include "AsgTools/AsgTool.h"
13#include "fastjet/JetDefinition.hh"
14#include "fastjet/Selector.hh"
15#include "fastjet/contrib/FlavInfo.hh"
17#include "fastjet/PseudoJet.hh"
19
20#include <memory>
21#include <array>
22#include <string>
23#include <vector>
24
27public:
28
30 enum class Algo : std::size_t {
31 IFN = 0,
32 CMP = 1,
33 GHS = 2,
34 SDF = 3,
35 AKT = 4,
36 COUNT = 5
37 };
38 static constexpr std::size_t N_ALGOS = static_cast<std::size_t>(Algo::COUNT);
39
41 static constexpr double DEFAULT_TRUTH_JET_PT_MIN = 5000.0;
42 static constexpr double DEFAULT_RECO_JET_PT_MIN = 10000.0;
43 static constexpr double DEFAULT_DR_MAX = 0.3;
44 static constexpr double DEFAULT_TRUTH_R = 0.4;
45
46 static constexpr double IFN_RFACTOR = 1.0;
47 static constexpr double IFN_BETA = 2.0;
48 static constexpr double CMP_A = 0.1;
49 static constexpr double GHS_ALPHA = 1.0;
50 static constexpr double GHS_OMEGA = 0.0;
51 static constexpr double GHS_PT_CUT = 5000.0;
52
53 static constexpr int LABEL_B = 5;
54 static constexpr int LABEL_C = 4;
55 static constexpr int LABEL_LIGHT = 0;
56 static constexpr int LABEL_DISABLED = -99;
57
59 JetIRCSafeLabelTool(const std::string& name);
60
61 StatusCode initialize() override;
62
63 StatusCode decorate(const xAOD::JetContainer& jets) const override;
64
65protected:
67 std::vector< std::vector<fastjet::PseudoJet> > getJetInputs(
69 const xAOD::TruthParticleContainer& label_bs,
70 const xAOD::TruthParticleContainer& label_cs) const;
71
73 std::vector< std::vector<const fastjet::PseudoJet*> > match(
74 std::vector<fastjet::PseudoJet>& tagged_jets,
75 const xAOD::JetContainer& jets) const;
76
78 Gaudi::Property<std::string> m_labelNameIFN{this, "LabelNameIFN", "IRCSafeLabelIFN",
79 "Name of the jet label attribute to be added (IFN)"};
80 Gaudi::Property<std::string> m_labelNameCMP{this, "LabelNameCMP", "IRCSafeLabelCMP",
81 "Name of the jet label attribute to be added (CMP)"};
82 Gaudi::Property<std::string> m_labelNameGHS{this, "LabelNameGHS", "IRCSafeLabelGHS",
83 "Name of the jet label attribute to be added (GHS)"};
84 Gaudi::Property<std::string> m_labelNameSDF{this, "LabelNameSDF", "IRCSafeLabelSDF",
85 "Name of the jet label attribute to be added (SDF, Marzani et al.)"};
86 Gaudi::Property<std::string> m_labelNameAKT{this, "LabelNameAKT", "IRCSafeLabelAKT",
87 "Name of the jet label attribute to be added (anti-kt with net flavour - NOT IRC SAFE)"};
88
90 Gaudi::Property<std::vector<std::string>> m_enabledAlgorithms{this, "EnabledAlgorithms",
91 {"IFN", "CMP", "GHS", "SDF", "AKT"},
92 "Subset of IRCSafe algorithms to run (IFN, CMP, GHS, SDF, AKT)"};
93
95 Gaudi::Property<double> m_truthJetPtMin{this, "TruthJetPtMin", DEFAULT_TRUTH_JET_PT_MIN,
96 "Minimum pT of truth jets that are matched to reco for labeling [MeV]"};
97 Gaudi::Property<double> m_jetPtMin{this, "JetPtMin", DEFAULT_RECO_JET_PT_MIN,
98 "Minimum pT of reco jets to be labeled [MeV]"};
99 Gaudi::Property<double> m_drMax{this, "DRMax", DEFAULT_DR_MAX,
100 "Maximum deltaR between a particle and jet to be labeled"};
101 Gaudi::Property<double> m_truthR{this, "TruthR", DEFAULT_TRUTH_R,
102 "Radius with which truth particles will be clustered when determining the flavour "
103 "(should be equal to the radius of the tagged jets)"};
104
107 std::unique_ptr<ParticleJetTools::IRCSafeLabelDecorators> m_ircsafelabeldecs;
108
110 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_bottomPartCollectionKey{this, "BParticleCollection", "", "ReadHandleKey for bottomPartCollection"};
111 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_charmPartCollectionKey{this, "CParticleCollection", "", "ReadHandleKey for charmPartCollection"};
112 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_outTruthPartKey{this, "TruthParticleCollection", "", "ReadHandleKey of the TruthParticle collection"};
113
115 std::array<bool, N_ALGOS> m_doAlgo{};
116
118 std::unique_ptr<fastjet::Selector> m_selectPt;
119 std::unique_ptr<fastjet::contrib::FlavRecombiner> m_flavRecombiner;
120 std::unique_ptr<fastjet::JetDefinition> m_aktJetDef;
121 std::unique_ptr<fastjet::JetDefinition> m_ifnJetDef;
122 std::unique_ptr<fastjet::JetDefinition> m_cmpJetDef;
123
125 bool doAlgo(Algo a) const { return m_doAlgo[static_cast<std::size_t>(a)]; }
126};
127
128#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid from which a ReadHandle is made.
static Double_t a
Interface for adding a decoration to a jet container.
StatusCode initialize() override
Dummy implementation of the initialisation function.
static constexpr double DEFAULT_TRUTH_R
Gaudi::Property< std::vector< std::string > > m_enabledAlgorithms
Algorithm selection property.
JetIRCSafeLabelTool(const std::string &name)
Constructor.
static constexpr std::size_t N_ALGOS
static constexpr int LABEL_LIGHT
std::unique_ptr< fastjet::contrib::FlavRecombiner > m_flavRecombiner
static constexpr double DEFAULT_RECO_JET_PT_MIN
static constexpr double DEFAULT_TRUTH_JET_PT_MIN
Algorithm configuration constants.
Gaudi::Property< double > m_truthJetPtMin
Cut and configuration properties.
bool doAlgo(Algo a) const
Convenience function to check if an algorithm is enabled.
static constexpr double GHS_OMEGA
Gaudi::Property< std::string > m_labelNameCMP
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_bottomPartCollectionKey
Read handles for truth particle collections.
static constexpr double DEFAULT_DR_MAX
static constexpr double IFN_BETA
std::vector< std::vector< const fastjet::PseudoJet * > > match(std::vector< fastjet::PseudoJet > &tagged_jets, const xAOD::JetContainer &jets) const
Match truth-level pseudo-jets to reconstructed jets.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_outTruthPartKey
static constexpr int LABEL_DISABLED
static constexpr double IFN_RFACTOR
static constexpr int LABEL_B
std::unique_ptr< fastjet::JetDefinition > m_aktJetDef
Gaudi::Property< std::string > m_labelNameGHS
std::unique_ptr< fastjet::JetDefinition > m_cmpJetDef
Gaudi::Property< double > m_truthR
static constexpr int LABEL_C
Algo
Enumeration of supported IRC-safe flavour tagging algorithms.
@ GHS
Gauld-Huss-Stagnitto flavour dressing.
@ COUNT
Number of algorithms.
@ CMP
Czakon-Mitov-Poncelet algorithm.
@ AKT
Anti-kt with net flavour (NOT IRC-safe, for comparison).
@ SDF
SDFlav algorithm (Marzani et al.).
@ IFN
Interleaved Flavour Neutralisation.
static constexpr double CMP_A
StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Gaudi::Property< double > m_jetPtMin
Gaudi::Property< std::string > m_labelNameIFN
Label name properties.
Gaudi::Property< std::string > m_labelNameSDF
ParticleJetTools::IRCSafeLabelNames m_ircsafelabelnames
Name of jet label attributes.
std::unique_ptr< fastjet::JetDefinition > m_ifnJetDef
std::vector< std::vector< fastjet::PseudoJet > > getJetInputs(const xAOD::TruthParticleContainer &parts, const xAOD::TruthParticleContainer &label_bs, const xAOD::TruthParticleContainer &label_cs) const
Collect truth particles and cluster them into jets using the enabled algorithms.
Gaudi::Property< std::string > m_labelNameAKT
std::array< bool, N_ALGOS > m_doAlgo
Compact array storing enabled algorithms (true = enabled).
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_charmPartCollectionKey
std::unique_ptr< ParticleJetTools::IRCSafeLabelDecorators > m_ircsafelabeldecs
std::unique_ptr< fastjet::Selector > m_selectPt
FastJet configuration cached at initialize to avoid per-event allocations.
static constexpr double GHS_PT_CUT
Gaudi::Property< double > m_drMax
static constexpr double GHS_ALPHA
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.