12 return decVtx->
v4().Vect().Mag() / decVtx->
genvecV4().Gamma();
17 double logRatio{-99.};
23 else logRatio = std::log10(
double(1./EMF - 1.));
40 if (!mother)
return {};
42 std::vector<const xAOD::TruthParticle*> children{};
43 for (
size_t i=0; i<mother->
nChildren(); ++i) {
46 if (!child || child == mother)
continue;
47 children.push_back(child);
57 std::vector<const xAOD::TruthParticle*> stableChildren;
59 if (!particle || visited.count(particle))
return stableChildren;
60 visited.insert(particle);
63 bool particleIsStable = findOnlyGenStable ? particle->isGenStable() : particle->isStable();
64 if (particleIsStable) {
65 stableChildren.push_back(particle);
66 return stableChildren;
70 std::vector<const xAOD::TruthParticle*> children =
getChildren(particle);
75 if (std::none_of(stableChildren.begin(), stableChildren.end(), [&](
const auto&
x) {return x==c;})) stableChildren.push_back(c);
79 return stableChildren;
86 std::unordered_set<const xAOD::TruthParticle*> visited;
93 std::vector<const xAOD::TruthParticle*> decayProducts;
94 if (!vtx)
return decayProducts;
99 decayProducts.push_back(tp);
102 return decayProducts;
111 std::set<const xAOD::TruthVertex*> seenVertices;
112 std::vector<ActiveVertex> actVertices;
113 std::vector<const xAOD::TruthParticle*> children;
117 if (!tp || !tp->isStable() ||
jet->p4().DeltaR(tp->p4()) > 0.4)
continue;
120 size_t decayDepth{0};
123 if (decayDepth > 200)
break;
128 if (!prodVtx || seenVertices.count(prodVtx))
break;
129 if (prodVtx->
v4().Mag2() < 0)
break;
130 seenVertices.insert(prodVtx);
134 nChildren = children.size();
136 if (nChildren >= 2) {
137 TLorentzVector vtx4Vec;
138 float scalarPtSum{0.};
140 vtx4Vec += child->p4();
141 scalarPtSum += child->p4().Pt();
143 actVertices.push_back({prodVtx, vtx4Vec.E(), vtx4Vec.M(), vtx4Vec.Pt(), scalarPtSum, nChildren, decayDepth});
154 double trackIso_pT,
double softTrackIso_R,
double jetIso_pT,
double jetIso_LogRatio){
165 double hardTrack_mindR{99.};
169 if(
Track->pt() >= trackIso_pT && dR < hardTrack_mindR) hardTrack_mindR = dR;
174 iso.
track_mindR = hardTrack_mindR != 99. ? hardTrack_mindR : -1.;
175 iso.
track_pTsum = softTrack_pTsum.mag() != 0. ? softTrack_pTsum.perp()/Gaudi::Units::GeV : -1.;
178 double jet_mindR{99.};
180 if(
Jet->
pt() < jetIso_pT)
continue;
183 if(logratio >= jetIso_LogRatio)
continue;
190 iso.
jet_mindR = jet_mindR != 99. ? jet_mindR : -1.;
virtual double eta() const
pseudo rapidity
virtual double phi() const
phi in [-pi,pi[
virtual double pt() const
transverse momentum
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
size_t nChildren() const
Number of children of this particle.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
FourVec_t v4() const
The full 4-vector of the vertex.
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
GenVecFourVec_t genvecV4() const
The full 4-vector of the particle : GenVector form.
const Amg::Vector3D & position() const
Returns the 3-pos.
void zero(TH2 *h)
zero the contents of a 2d histogram
Eigen::Matrix< double, 3, 1 > Vector3D
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
bool greater_equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
std::vector< const xAOD::TruthParticle * > getDecayProducts(const xAOD::TruthVertex *vtx)
std::vector< const xAOD::TruthParticle * > getStableChildren(const xAOD::TruthParticle *particle, bool findOnlyGenStable)
double getCTau(const xAOD::TruthVertex *decVtx)
std::vector< const xAOD::TruthParticle * > getChildren(const xAOD::TruthParticle *mother)
std::vector< const xAOD::TruthParticle * > getStableChildrenRecursive(const xAOD::TruthParticle *particle, bool findOnlyGenStable, std::unordered_set< const xAOD::TruthParticle * > &visited)
VtxIso getIso(const xAOD::Vertex *vtx, const xAOD::TrackParticleContainer &Tracks, const xAOD::JetContainer &Jets, double trackIso_pT, double softTrackIso_R, double jetIso_pT, double jetIso_LogRatio)
std::vector< ActiveVertex > getActiveVertices(const xAOD::Jet *jet, const xAOD::TruthParticleContainer &truthParticles)
double getCalEnergyLogRatio(double EMF)
bool comparePt(const xAOD::TruthParticle *part1, const xAOD::TruthParticle *part2)
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Jet_v1 Jet
Definition of the current "jet version".
TruthVertex_v1 TruthVertex
Typedef to implementation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.