ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleJetLabelCommon.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
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
39 void check();
40 };
41
61
63 public:
65 const std::string& linkName);
66 void decorate(const xAOD::Jet&,
67 const std::vector<const xAOD::TruthParticle*>&) const;
68 private:
69 using IPLV = std::vector<ElementLink<xAOD::IParticleContainer>>;
71 };
72
73 struct Particles {
74 std::vector<const xAOD::TruthParticle*> b;
75 std::vector<const xAOD::TruthParticle*> c;
76 std::vector<const xAOD::TruthParticle*> tau;
78 };
79
81 Amg::Vector3D p3(const xAOD::Jet& j);
83
84 void setJetLabels(const xAOD::Jet& jet,
85 const Particles& particles,
86 const LabelNames& names);
87 void setJetLabels(const xAOD::Jet& jet,
88 const Particles& particles,
89 const LabelDecorators& decs);
90
91 float partPt(const xAOD::TruthParticle* part);
92 float partLxy(const xAOD::TruthParticle* part, const Amg::Vector3D& origin);
93 float partDR(const xAOD::TruthParticle* part, const xAOD::Jet& jet);
94 int partPdgId(const xAOD::TruthParticle* part);
95 float positionDPhi(const xAOD::TruthParticle* part,
96 const xAOD::Jet& jet,
97 const Amg::Vector3D& origin);
98 float positionDEta(const xAOD::TruthParticle* part,
99 const xAOD::Jet& jet,
100 const Amg::Vector3D& origin);
101
102
103 void childrenRemoved
104 ( const std::vector<const xAOD::TruthParticle*>& parents
105 , std::vector<const xAOD::TruthParticle*>& children
106 );
107
108 template<typename T>
109 void declareProperties(T& tool, LabelNames* n) {
110 tool.declareProperty("LabelName", n->singleint="", "Jet label attribute to be added.");
111 tool.declareProperty("DoubleLabelName", n->doubleint="", "Jet label attribute to be added (with the possibility of up to 2 matched hadrons).");
112 tool.declareProperty("LabelPtName", n->pt="", "Attribute for labelling particle pt");
113 tool.declareProperty("LabelLxyName", n->Lxy="", "Attribute for Lxy of labelling particle");
114 tool.declareProperty("LabelDRName", n->dr="", "Attribute for dR(part, jet) for labelling particle");
115 tool.declareProperty("LabelPdgIdName", n->pdgId="", "Attribute for pdgID of labelling particle");
116 tool.declareProperty("LabelPositionDPhiName", n->positionDPhi="", "Attribute for the position dPhi of the labeling particle ");
117 tool.declareProperty("LabelPositionDEtaName", n->positionDEta="", "Attribute for the position dEta of the labeling particle ");
118 tool.declareProperty("LabelBarcodeName", n->uniqueID="", "Attribute for uniqueID of labeling particle");
119 tool.declareProperty("ChildLxyName", n->childLxy="", "Attribute for the labeling particle child Lxy");
120 tool.declareProperty("ChildPtName", n->childPt="", "Attribute for the labeling particle child Pt");
121 tool.declareProperty("ChildPdgIdName", n->childPdgId="", "Attribute for the labeling particle child pdg ID");
122 tool.declareProperty("ChildPositionDPhiName", n->childPositionDPhi="", "Attribute for the position dPhi of the labeling particle child");
123 tool.declareProperty("ChildPositionDEtaName", n->childPositionDEta="", "Attribute for the position dEta of the labeling particle child");
124 // ATLASRECTS-8290: this is for backward compatability, remove eventually
125 tool.declareProperty("useBarcode", n->useBarcode=false, "use barcode instead of uid");
126 }
127
128}
129
130#endif
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)
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
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)
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.
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