25const std::string& name,
26const IInterface* parent)
29 declareInterface<Trk::ITruthTrajectoryBuilder>(
this);
35 return StatusCode::SUCCESS;
50 std::stack<HepMC::ConstGenParticlePtr> tmp;
52 tmp.push(current =
next);
56 const int eventNumber = input->parent_event()->event_number();
59 while (!tmp.empty()) {
81 if(vtx && (vtx->particles_in_size() == 1)) {
83 mother = vtx->particles_in().front();
85 mother = *vtx->particles_in_const_begin();
98 if (vtx->particles_out_size() <= 2) {
99 int num_passed_cuts = 0;
101 for(
const auto& candidate: *vtx) {
102 if(candidate->pdg_id() == mother->pdg_id()) {
105 if(candidate->momentum().e() > passed_cuts->momentum().e()) {
106 passed_cuts = candidate;
109 passed_cuts = candidate;
115 if(num_passed_cuts==1) {
116 daughter = std::move(passed_cuts);
123 return std::make_pair(mother, daughter);
130 if(
res.first == mother)
return res.second;
139 if(
res.second == daughter)
return res.first;
An STL vector of pointers that by default owns its pointed-to elements.
ATLAS-specific HepMC functions.
std::pair< std::vector< unsigned int >, bool > res
ElasticTruthTrajectoryBuilder(const std::string &type, const std::string &name, const IInterface *parent)
static MotherDaughter truthTrajectoryCuts(const HepMC::ConstGenVertexPtr &vtx)
Decides if the vertex connects two particles on the same TruthTrajectory.
virtual StatusCode initialize()
HepMC::ConstGenParticlePtr getMother(const HepMC::ConstGenParticlePtr &particle) const
Returns an umambiguous mother of the truth particle on a TruthTrajectory, or 0.
void buildTruthTrajectory(TruthTrajectory *result, const HepMC::ConstGenParticlePtr &input) const
Build a TruthTrajectory this particle belongs to.
std::pair< HepMC::ConstGenParticlePtr, HepMC::ConstGenParticlePtr > MotherDaughter
Return type for the next method.
HepMC::ConstGenParticlePtr getDaughter(const HepMC::ConstGenParticlePtr &particle) const
Returns an umambiguous daughter of the truth particle on a TruthTrajectory, or 0.
A TruthTrajectory is a chain of charged MC particles connected through the mother-daughter relationsh...
const GenParticle * ConstGenParticlePtr
const HepMC::GenVertex * ConstGenVertexPtr
bool isElectron(const T &p)
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
Ensure that the ATLAS eigen extensions are properly loaded.