ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleJetLabelCommon.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
6#ifndef PARTICLE_JET_LABEL_COMMON_H
7#define PARTICLE_JET_LABEL_COMMON_H
8
10#include "xAODJet/Jet.h"
14
15// Eigen needed for Vector3D
17
18#include <vector>
19
20namespace ParticleJetTools {
21
22 struct LabelNames {
23 std::string singleint;
24 std::string doubleint;
25 std::string pt;
26 std::string Lxy;
27 std::string dr;
28 std::string pdgId;
29 std::string positionDPhi;
30 std::string positionDEta;
31 std::string uniqueID;
32 std::string childLxy;
33 std::string childPt;
34 std::string childPdgId;
35 std::string childPositionDPhi;
36 std::string childPositionDEta;
37 // ATLASRECTS-8290: this is for backward compatability, remove eventually
38 bool useBarcode = false;
39 void check();
40 };
41
44 SG::AuxElement::Decorator<int> singleint;
45 SG::AuxElement::Decorator<int> doubleint;
46 SG::AuxElement::Decorator<float> pt;
47 SG::AuxElement::Decorator<float> Lxy;
48 SG::AuxElement::Decorator<float> dr;
49 SG::AuxElement::Decorator<int> pdgId;
50 SG::AuxElement::Decorator<float> positionDPhi;
51 SG::AuxElement::Decorator<float> positionDEta;
52 SG::AuxElement::Decorator<int> uniqueID;
53 SG::AuxElement::Decorator<float> childLxy;
54 SG::AuxElement::Decorator<float> childPt;
55 SG::AuxElement::Decorator<int> childPdgId;
56 SG::AuxElement::Decorator<float> childPositionDPhi;
57 SG::AuxElement::Decorator<float> childPositionDEta;
58 // ATLASRECTS-8290: this is for backward compatability, remove eventually
60 };
61
63 std::string IFNsingleint = "IRCSafeLabelIFN";
64 std::string CMPsingleint = "IRCSafeLabelCMP";
65 std::string GHSsingleint = "IRCSafeLabelGHS";
66 std::string SDFsingleint = "IRCSafeLabelSDF";
67 std::string AKTsingleint = "IRCSafeLabelAKT";
68 };
69
83
85 std::vector<const fastjet::PseudoJet*> IFN_b;
86 std::vector<const fastjet::PseudoJet*> IFN_c;
87 std::vector<const fastjet::PseudoJet*> CMP_b;
88 std::vector<const fastjet::PseudoJet*> CMP_c;
89 std::vector<const fastjet::PseudoJet*> GHS_b;
90 std::vector<const fastjet::PseudoJet*> GHS_c;
91 std::vector<const fastjet::PseudoJet*> SDF_b;
92 std::vector<const fastjet::PseudoJet*> SDF_c;
93 std::vector<const fastjet::PseudoJet*> AKT_b;
94 std::vector<const fastjet::PseudoJet*> AKT_c;
95 };
96
98 public:
100 const std::string& linkName);
101 void decorate(const xAOD::Jet&,
102 const std::vector<const xAOD::TruthParticle*>&) const;
103 private:
104 using IPLV = std::vector<ElementLink<xAOD::IParticleContainer>>;
105 SG::AuxElement::Decorator<IPLV> m_dec;
106 };
107
108 struct Particles {
109 std::vector<const xAOD::TruthParticle*> b;
110 std::vector<const xAOD::TruthParticle*> c;
111 std::vector<const xAOD::TruthParticle*> tau;
113 };
114
116 Amg::Vector3D p3(const xAOD::Jet& j);
118
119 void setJetLabels(const xAOD::Jet& jet,
120 const Particles& particles,
121 const LabelNames& names);
122 void setJetLabels(const xAOD::Jet& jet,
123 const Particles& particles,
124 const LabelDecorators& decs);
125
126 float partPt(const xAOD::TruthParticle* part);
127 float partLxy(const xAOD::TruthParticle* part, const Amg::Vector3D& origin);
128 float partDR(const xAOD::TruthParticle* part, const xAOD::Jet& jet);
129 int partPdgId(const xAOD::TruthParticle* part);
130 float positionDPhi(const xAOD::TruthParticle* part,
131 const xAOD::Jet& jet,
132 const Amg::Vector3D& origin);
133 float positionDEta(const xAOD::TruthParticle* part,
134 const xAOD::Jet& jet,
135 const Amg::Vector3D& origin);
136
137
138 void childrenRemoved
139 ( const std::vector<const xAOD::TruthParticle*>& parents
140 , std::vector<const xAOD::TruthParticle*>& children
141 );
142
143 template<typename T>
144 void declareProperties(T& tool, LabelNames* n) {
145 tool.declareProperty("LabelName", n->singleint="", "Jet label attribute to be added.");
146 tool.declareProperty("DoubleLabelName", n->doubleint="", "Jet label attribute to be added (with the possibility of up to 2 matched hadrons).");
147 tool.declareProperty("LabelPtName", n->pt="", "Attribute for labelling particle pt");
148 tool.declareProperty("LabelLxyName", n->Lxy="", "Attribute for Lxy of labelling particle");
149 tool.declareProperty("LabelDRName", n->dr="", "Attribute for dR(part, jet) for labelling particle");
150 tool.declareProperty("LabelPdgIdName", n->pdgId="", "Attribute for pdgID of labelling particle");
151 tool.declareProperty("LabelPositionDPhiName", n->positionDPhi="", "Attribute for the position dPhi of the labeling particle ");
152 tool.declareProperty("LabelPositionDEtaName", n->positionDEta="", "Attribute for the position dEta of the labeling particle ");
153 tool.declareProperty("LabelBarcodeName", n->uniqueID="", "Attribute for uniqueID of labeling particle");
154 tool.declareProperty("ChildLxyName", n->childLxy="", "Attribute for the labeling particle child Lxy");
155 tool.declareProperty("ChildPtName", n->childPt="", "Attribute for the labeling particle child Pt");
156 tool.declareProperty("ChildPdgIdName", n->childPdgId="", "Attribute for the labeling particle child pdg ID");
157 tool.declareProperty("ChildPositionDPhiName", n->childPositionDPhi="", "Attribute for the position dPhi of the labeling particle child");
158 tool.declareProperty("ChildPositionDEtaName", n->childPositionDEta="", "Attribute for the position dEta of the labeling particle child");
159 // ATLASRECTS-8290: this is for backward compatability, remove eventually
160 tool.declareProperty("useBarcode", n->useBarcode=false, "use barcode instead of uid");
161 }
162
163}
164
165#endif
166
Property holding a SG store/key/clid from which a ReadHandle is made.
SG::AuxElement::Decorator< IPLV > m_dec
void decorate(const xAOD::Jet &, const std::vector< const xAOD::TruthParticle * > &) const
std::vector< ElementLink< xAOD::IParticleContainer > > IPLV
IParticleLinker(const SG::ReadHandleKey< xAOD::TruthParticleContainer > &, const std::string &linkName)
Helper class to provide constant type-safe access to aux data.
Property holding a SG store/key/clid from which a ReadHandle is made.
Eigen::Matrix< double, 3, 1 > Vector3D
void setJetLabels(const xAOD::Jet &jet, const Particles &particles, const LabelNames &names)
float positionDEta(const xAOD::TruthParticle *part, const xAOD::Jet &jet, const Amg::Vector3D &origin)
float partDR(const xAOD::TruthParticle *part, const xAOD::Jet &jet)
float partPt(const xAOD::TruthParticle *part)
Amg::Vector3D p3(const xAOD::TruthVertex *p)
void childrenRemoved(const std::vector< const xAOD::TruthParticle * > &parents, std::vector< const xAOD::TruthParticle * > &children)
Amg::Vector3D signalProcessP3(const xAOD::TruthEventContainer &)
void declareProperties(T &tool, LabelNames *n)
float partLxy(const xAOD::TruthParticle *part, const Amg::Vector3D &origin)
float positionDPhi(const xAOD::TruthParticle *part, const xAOD::Jet &jet, const Amg::Vector3D &origin)
int partPdgId(const xAOD::TruthParticle *part)
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
Jet_v1 Jet
Definition of the current "jet version".
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthParticle_v1 TruthParticle
Typedef to implementation.
IRCSafeLabelDecorators(const IRCSafeLabelNames &n)
SG::AuxElement::Decorator< float > childPositionDEta
SG::AuxElement::Decorator< int > uniqueID
SG::AuxElement::Decorator< int > pdgId
SG::AuxElement::Decorator< float > pt
SG::AuxElement::Decorator< int > doubleint
SG::AuxElement::Decorator< float > Lxy
SG::AuxElement::Decorator< float > dr
SG::AuxElement::Decorator< int > childPdgId
SG::AuxElement::Decorator< float > positionDEta
SG::AuxElement::Decorator< float > childPositionDPhi
SG::AuxElement::Decorator< float > positionDPhi
SG::AuxElement::Decorator< float > childLxy
SG::AuxElement::Decorator< float > childPt
SG::AuxElement::Decorator< int > singleint
std::vector< const xAOD::TruthParticle * > tau
std::vector< const xAOD::TruthParticle * > b
std::vector< const xAOD::TruthParticle * > c
std::vector< const fastjet::PseudoJet * > CMP_b
std::vector< const fastjet::PseudoJet * > CMP_c
std::vector< const fastjet::PseudoJet * > AKT_b
std::vector< const fastjet::PseudoJet * > AKT_c
std::vector< const fastjet::PseudoJet * > IFN_b
std::vector< const fastjet::PseudoJet * > GHS_b
std::vector< const fastjet::PseudoJet * > SDF_c
std::vector< const fastjet::PseudoJet * > IFN_c
std::vector< const fastjet::PseudoJet * > SDF_b
std::vector< const fastjet::PseudoJet * > GHS_c