ATLAS Offline Software
ParticleJetLabelCommon.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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"
11 #include "xAODTruth/TruthVertex.h"
14 
15 // Eigen needed for Vector3D
17 
18 #include <vector>
19 
20 namespace 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 barcode; // FIXME barcode-based
32  std::string childLxy;
33  std::string childPt;
34  std::string childPdgId;
35  std::string childPositionDPhi;
36  std::string childPositionDEta;
37  void check();
38  };
39 
40  struct LabelDecorators {
50  SG::AuxElement::Decorator<int> barcode; // FIXME barcode-based
56  };
57 
59  public:
61  const std::string& linkName);
62  void decorate(const xAOD::Jet&,
63  const std::vector<const xAOD::TruthParticle*>&) const;
64  private:
65  using IPLV = std::vector<ElementLink<xAOD::IParticleContainer>>;
67  };
68 
69  struct Particles {
70  std::vector<const xAOD::TruthParticle*> b;
71  std::vector<const xAOD::TruthParticle*> c;
72  std::vector<const xAOD::TruthParticle*> tau;
74  };
75 
77  Amg::Vector3D p3(const xAOD::Jet& j);
79 
80  void setJetLabels(const xAOD::Jet& jet,
81  const Particles& particles,
82  const LabelNames& names);
83  void setJetLabels(const xAOD::Jet& jet,
84  const Particles& particles,
85  const LabelDecorators& decs);
86 
87  float partPt(const xAOD::TruthParticle* part);
88  float partLxy(const xAOD::TruthParticle* part, const Amg::Vector3D& origin);
89  float partDR(const xAOD::TruthParticle* part, const xAOD::Jet& jet);
92  const xAOD::Jet& jet,
93  const Amg::Vector3D& origin);
95  const xAOD::Jet& jet,
96  const Amg::Vector3D& origin);
97 
98 
99  void childrenRemoved
100  ( const std::vector<const xAOD::TruthParticle*>& parents
101  , std::vector<const xAOD::TruthParticle*>& children
102  );
103 
104  template<typename T>
106  tool.declareProperty("LabelName", n->singleint="", "Jet label attribute to be added.");
107  tool.declareProperty("DoubleLabelName", n->doubleint="", "Jet label attribute to be added (with the possibility of up to 2 matched hadrons).");
108  tool.declareProperty("LabelPtName", n->pt="", "Attribute for labelling particle pt");
109  tool.declareProperty("LabelLxyName", n->Lxy="", "Attribute for Lxy of labelling particle");
110  tool.declareProperty("LabelDRName", n->dr="", "Attribute for dR(part, jet) for labelling particle");
111  tool.declareProperty("LabelPdgIdName", n->pdgId="", "Attribute for pdgID of labelling particle");
112  tool.declareProperty("LabelPositionDPhiName", n->positionDPhi="", "Attribute for the position dPhi of the labeling particle ");
113  tool.declareProperty("LabelPositionDEtaName", n->positionDEta="", "Attribute for the position dEta of the labeling particle ");
114  tool.declareProperty("LabelBarcodeName", n->barcode="", "Attribute for barcode of labeling particle"); // FIXME barcode-based
115  tool.declareProperty("ChildLxyName", n->childLxy="", "Attribute for the labeling particle child Lxy");
116  tool.declareProperty("ChildPtName", n->childPt="", "Attribute for the labeling particle child Pt");
117  tool.declareProperty("ChildPdgIdName", n->childPdgId="", "Attribute for the labeling particle child pdg ID");
118  tool.declareProperty("ChildPositionDPhiName", n->childPositionDPhi="", "Attribute for the position dPhi of the labeling particle child");
119  tool.declareProperty("ChildPositionDEtaName", n->childPositionDEta="", "Attribute for the position dEta of the labeling particle child");
120  }
121 
122 }
123 
124 #endif
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ParticleJetTools::LabelNames::dr
std::string dr
Definition: ParticleJetLabelCommon.h:27
Jet.h
ParticleJetTools::LabelNames::Lxy
std::string Lxy
Definition: ParticleJetLabelCommon.h:26
ParticleJetTools::Particles::origin
Amg::Vector3D origin
Definition: ParticleJetLabelCommon.h:73
ParticleJetTools::LabelDecorators::childLxy
SG::AuxElement::Decorator< float > childLxy
Definition: ParticleJetLabelCommon.h:51
ParticleJetTools::LabelNames::pdgId
std::string pdgId
Definition: ParticleJetLabelCommon.h:28
ParticleJetTools::IParticleLinker
Definition: ParticleJetLabelCommon.h:58
ParticleJetTools::LabelDecorators::LabelDecorators
LabelDecorators(const LabelNames &)
Definition: ParticleJetLabelCommon.cxx:116
python.DecayParser.parents
parents
print ("==> buf:",buf)
Definition: DecayParser.py:31
ParticleJetTools::LabelNames::childPositionDEta
std::string childPositionDEta
Definition: ParticleJetLabelCommon.h:36
ParticleJetTools::declareProperties
void declareProperties(T &tool, LabelNames *n)
Definition: ParticleJetLabelCommon.h:105
ParticleJetTools::partDR
float partDR(const xAOD::TruthParticle *part, const xAOD::Jet &jet)
Definition: ParticleJetLabelCommon.cxx:295
ParticleJetTools::LabelNames::childLxy
std::string childLxy
Definition: ParticleJetLabelCommon.h:32
ParticleJetTools::LabelDecorators::barcode
SG::AuxElement::Decorator< int > barcode
Definition: ParticleJetLabelCommon.h:50
ParticleJetTools::LabelNames::check
void check()
Definition: ParticleJetLabelCommon.cxx:92
SG::ReadHandleKey< xAOD::TruthParticleContainer >
ParticleJetTools::LabelNames::childPt
std::string childPt
Definition: ParticleJetLabelCommon.h:33
ParticleJetTools::positionDEta
float positionDEta(const xAOD::TruthParticle *part, const xAOD::Jet &jet, const Amg::Vector3D &origin)
Definition: ParticleJetLabelCommon.cxx:313
ParticleJetTools::LabelDecorators::Lxy
SG::AuxElement::Decorator< float > Lxy
Definition: ParticleJetLabelCommon.h:45
ParticleJetTools::p3
Amg::Vector3D p3(const xAOD::TruthVertex *p)
Definition: ParticleJetLabelCommon.cxx:50
ParticleJetTools::LabelDecorators::doubleint
SG::AuxElement::Decorator< int > doubleint
Definition: ParticleJetLabelCommon.h:43
ParticleJetTools::IParticleLinker::m_dec
SG::AuxElement::Decorator< IPLV > m_dec
Definition: ParticleJetLabelCommon.h:66
GeoPrimitives.h
ParticleJetTools::Particles::c
std::vector< const xAOD::TruthParticle * > c
Definition: ParticleJetLabelCommon.h:71
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
ParticleJetTools::Particles::tau
std::vector< const xAOD::TruthParticle * > tau
Definition: ParticleJetLabelCommon.h:72
ParticleJetTools::Particles::b
std::vector< const xAOD::TruthParticle * > b
Definition: ParticleJetLabelCommon.h:70
beamspotman.n
n
Definition: beamspotman.py:731
python.subdetectors.mmg.names
names
Definition: mmg.py:8
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
ParticleJetTools::LabelNames::doubleint
std::string doubleint
Definition: ParticleJetLabelCommon.h:24
ParticleJetTools::Particles
Definition: ParticleJetLabelCommon.h:69
ParticleJetTools::childrenRemoved
void childrenRemoved(const std::vector< const xAOD::TruthParticle * > &parents, std::vector< const xAOD::TruthParticle * > &children)
Definition: ParticleJetLabelCommon.cxx:64
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ParticleJetTools::LabelDecorators::pt
SG::AuxElement::Decorator< float > pt
Definition: ParticleJetLabelCommon.h:44
ParticleJetTools::LabelNames::singleint
std::string singleint
Definition: ParticleJetLabelCommon.h:23
TruthVertex.h
ParticleJetTools::partPt
float partPt(const xAOD::TruthParticle *part)
Definition: ParticleJetLabelCommon.cxx:286
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
ParticleJetTools::LabelDecorators::pdgId
SG::AuxElement::Decorator< int > pdgId
Definition: ParticleJetLabelCommon.h:47
ParticleJetTools::LabelDecorators::childPdgId
SG::AuxElement::Decorator< int > childPdgId
Definition: ParticleJetLabelCommon.h:53
ParticleJetTools::LabelNames::childPositionDPhi
std::string childPositionDPhi
Definition: ParticleJetLabelCommon.h:35
ParticleJetTools::IParticleLinker::IParticleLinker
IParticleLinker(const SG::ReadHandleKey< xAOD::TruthParticleContainer > &, const std::string &linkName)
Definition: ParticleJetLabelCommon.cxx:137
ParticleJetTools
Definition: ParticleJetLabelCommon.h:20
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
ParticleJetTools::LabelNames::childPdgId
std::string childPdgId
Definition: ParticleJetLabelCommon.h:34
ParticleJetTools::LabelDecorators::childPt
SG::AuxElement::Decorator< float > childPt
Definition: ParticleJetLabelCommon.h:52
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ParticleJetTools::LabelDecorators::positionDEta
SG::AuxElement::Decorator< float > positionDEta
Definition: ParticleJetLabelCommon.h:49
ParticleJetTools::signalProcessP3
Amg::Vector3D signalProcessP3(const xAOD::TruthEventContainer &)
Definition: ParticleJetLabelCommon.cxx:57
ParticleJetTools::positionDPhi
float positionDPhi(const xAOD::TruthParticle *part, const xAOD::Jet &jet, const Amg::Vector3D &origin)
Definition: ParticleJetLabelCommon.cxx:303
ParticleJetTools::setJetLabels
void setJetLabels(const xAOD::Jet &jet, const Particles &particles, const LabelNames &names)
Definition: ParticleJetLabelCommon.cxx:280
ParticleJetTools::LabelNames::positionDEta
std::string positionDEta
Definition: ParticleJetLabelCommon.h:30
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ParticleJetTools::LabelNames::pt
std::string pt
Definition: ParticleJetLabelCommon.h:25
ParticleJetTools::partLxy
float partLxy(const xAOD::TruthParticle *part, const Amg::Vector3D &origin)
Definition: ParticleJetLabelCommon.cxx:290
ParticleJetTools::partPdgId
int partPdgId(const xAOD::TruthParticle *part)
Definition: ParticleJetLabelCommon.cxx:299
ParticleJetTools::LabelDecorators::childPositionDEta
SG::AuxElement::Decorator< float > childPositionDEta
Definition: ParticleJetLabelCommon.h:55
ParticleJetTools::LabelNames::barcode
std::string barcode
Definition: ParticleJetLabelCommon.h:31
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
ParticleJetTools::LabelDecorators::positionDPhi
SG::AuxElement::Decorator< float > positionDPhi
Definition: ParticleJetLabelCommon.h:48
python.DecayParser.children
children
Definition: DecayParser.py:32
ParticleJetTools::LabelDecorators
Definition: ParticleJetLabelCommon.h:40
ParticleJetTools::IParticleLinker::decorate
void decorate(const xAOD::Jet &, const std::vector< const xAOD::TruthParticle * > &) const
Definition: ParticleJetLabelCommon.cxx:143
TruthParticle.h
TruthEventContainer.h
ParticleJetTools::LabelDecorators::childPositionDPhi
SG::AuxElement::Decorator< float > childPositionDPhi
Definition: ParticleJetLabelCommon.h:54
ParticleJetTools::LabelDecorators::singleint
SG::AuxElement::Decorator< int > singleint
Definition: ParticleJetLabelCommon.h:42
ParticleJetTools::LabelDecorators::dr
SG::AuxElement::Decorator< float > dr
Definition: ParticleJetLabelCommon.h:46
ParticleJetTools::LabelNames::positionDPhi
std::string positionDPhi
Definition: ParticleJetLabelCommon.h:29
ParticleJetTools::IParticleLinker::IPLV
std::vector< ElementLink< xAOD::IParticleContainer > > IPLV
Definition: ParticleJetLabelCommon.h:65
ParticleJetTools::LabelNames
Definition: ParticleJetLabelCommon.h:22