25 const std::string& name,
26 const 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()) {
89 if(vtx && (vtx->particles_in_size() == 1) && (vtx->particles_out_size() <= 2) ) {
92 mother = vtx->particles_in().front();
94 mother = *vtx->particles_in_const_begin();
99 int num_passed_cuts = 0;
102 if(candidate->pdg_id() == mother->pdg_id()) {
105 if(candidate->momentum().e() > passed_cuts->momentum().e()) {
106 passed_cuts = candidate;
110 passed_cuts = candidate;
115 else if(std::abs(candidate->pdg_id()) == 13){
116 passed_cuts = candidate;
121 if(num_passed_cuts==1) {
122 daughter = std::move(passed_cuts);
127 return std::make_pair(mother, daughter);
134 if(
res.first == mother)
return res.second;
143 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
void buildTruthTrajectory(TruthTrajectory *result, const HepMC::ConstGenParticlePtr &input) const
Build a TruthTrajectory this particle belongs to.
HepMC::ConstGenParticlePtr getDaughter(const HepMC::ConstGenParticlePtr &particle) const
Returns an umambiguous daughter of the truth particle on a TruthTrajectory, or 0.
virtual StatusCode initialize()
HepMC::ConstGenParticlePtr getMother(const HepMC::ConstGenParticlePtr &particle) const
Returns an umambiguous mother of the truth particle on a TruthTrajectory, or 0.
static MotherDaughter truthTrajectoryCuts(const HepMC::ConstGenVertexPtr &vtx)
Decides if the vertex connects two particles on the same TruthTrajectory.
std::pair< HepMC::ConstGenParticlePtr, HepMC::ConstGenParticlePtr > MotherDaughter
Return type for the next method.
DecayInFlyTruthTrajectoryBuilder(const std::string &type, const std::string &name, const IInterface *parent)
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.