15 for (
unsigned int n = 0;
n <
p->nChildren();
n++) {
19 if (!child)
return nullptr;
21 return getCharmChild(child);
38 for (
size_t iC = 0; iC < p->nChildren(); iC++) {
40 if (!cc) {
continue; }
44 if (
isChild(cc, c)) {
return true; }
51 if (!p)
return {NAN, NAN, NAN};
52 return {p->x(), p->y(), p->z()};
55 return {j.
px(), j.
py(), j.
pz()};
58 if (events.empty())
return {NAN, NAN, NAN};
59 return p3(events.at(0)->signalProcessVertex());
64 (
const std::vector<const xAOD::TruthParticle*>& parents
65 , std::vector<const xAOD::TruthParticle*>& children
68 if ( &parents == &children ) {
71 const std::vector<const xAOD::TruthParticle*> copyParents = parents;
93 auto chk = [](
const std::string& s,
const std::string& varname) {
94 if (s.empty())
throw std::runtime_error(
95 "name for '" + varname +
"' is not specified in particle jet tools"
98#define CHECK(var) chk(var, #var)
132 acc_uid(n.useBarcode ?
"barcode" :
"uid")
141 const std::string& linkname):
147 const std::vector<const xAOD::TruthParticle*>& ipv)
const
155 IPLV::value_type link;
158 link.toIndexedElement(*ipc, ip->index());
159 links.push_back(link);
170 if (
container.size() == 0)
return nullptr;
172 [](
auto* p1,
auto* p2) {
173 return p1->pt() < p2->pt();
183 if (particles.b.size()) {
185 labelling_particle = getMaxPtPart(particles.b);
186 child_particle = getCharmChild(labelling_particle);
187 }
else if (particles.c.size()) {
189 labelling_particle = getMaxPtPart(particles.c);
190 }
else if (particles.tau.size()) {
192 labelling_particle = getMaxPtPart(particles.tau);
230 int double_label = 0;
231 if (particles.b.size()) {
232 if (particles.b.size() >= 2)
235 else if (particles.c.size())
241 }
else if (particles.c.size()) {
242 if (particles.c.size() >= 2)
248 }
else if (particles.tau.size()){
250 bool hasElectrondecay =
false;
251 bool hasMuondecay =
false;
252 bool hasHadronicdecay =
false;
253 for (
auto itau: particles.tau){
254 for (
size_t i = 0; i< itau->nChildren(); i++){
255 if (itau->child(i)->absPdgId() == 12 || itau->child(i)->absPdgId() == 14 || itau->child(i)->absPdgId() == 16)
continue;
256 if (
MC::isMuon(itau->child(i))) hasMuondecay =
true;
258 else hasHadronicdecay =
true;
262 if (particles.tau.size() >= 2){
264 if (hasHadronicdecay){
266 if (hasMuondecay) double_label = 151513;
268 else if (hasElectrondecay) double_label = 151511;
270 else double_label = 1515;
274 if (hasHadronicdecay) double_label = 15;
290 if (!part)
return NAN;
294 if (!part)
return NAN;
295 if (
const auto* vx = part->decayVtx() )
return (
p3(vx) - origin).perp();
299 if (!part)
return NAN;
300 return part->p4().DeltaR(
jet.p4());
304 return part->pdgId();
309 if (!part)
return NAN;
310 if (
const auto* vx = part->decayVtx() ) {
312 return p3(
jet).deltaPhi(displacement);
319 if (!part)
return NAN;
320 if (
const auto* vx = part->decayVtx() ) {
322 return displacement.eta() -
jet.eta();
#define CHECK(...)
Evaluate an expression and check for errors.
ATLAS-specific HepMC functions.
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)
Property holding a SG store/key/clid from which a ReadHandle is made.
float py() const
The y-component of the jet's momentum.
float px() const
The x-component of the jet's momentum.
float pz() const
The z-component of the jet's momentum.
int pdgId() const
PDG ID code.
std::string label(const std::string &format, int i)
Eigen::Matrix< double, 3, 1 > Vector3D
constexpr int INVALID_PARTICLE_ID
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
bool hasCharm(const T &p)
bool isElectron(const T &p)
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)
bool isChild(const xAOD::TruthParticle *p, const xAOD::TruthParticle *c)
Amg::Vector3D signalProcessP3(const xAOD::TruthEventContainer &)
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)
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
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.
TruthParticle_v1 TruthParticle
Typedef to implementation.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
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::ConstAccessor< int > acc_uid
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
LabelDecorators(const LabelNames &)
SG::AuxElement::Decorator< float > positionDPhi
SG::AuxElement::Decorator< float > childLxy
SG::AuxElement::Decorator< float > childPt
SG::AuxElement::Decorator< int > singleint
std::string childPositionDPhi
std::string childPositionDEta