ATLAS Offline Software
Loading...
Searching...
No Matches
TruthSvc.cxx File Reference
#include "TruthSvc.h"
#include "ISF_Event/ITruthIncident.h"
#include "GaudiKernel/ISvcLocator.h"
#include "StoreGate/StoreGateSvc.h"
#include "GaudiKernel/SystemOfUnits.h"
#include "AtlasHepMC/SimpleVector.h"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenEvent.h"
#include "AtlasHepMC/GenVertex.h"
#include "AtlasHepMC/Relatives.h"
#include "TruthUtils/MagicNumbers.h"
#include "TruthUtils/HepMCHelpers.h"
#include "CLHEP/Geometry/Point3D.h"
#include "AtlasDetDescr/AtlasRegionHelper.h"
#include <sstream>

Go to the source code of this file.

Functions

std::vector< HepMC::GenParticlePtrfindChildren (const HepMC::GenParticlePtr &p)

Function Documentation

◆ findChildren()

std::vector< HepMC::GenParticlePtr > findChildren ( const HepMC::GenParticlePtr & p)

Definition at line 32 of file TruthSvc.cxx.

32 {
33 if (!p) return std::vector<HepMC::GenParticlePtr>();
34 const auto& v = p->end_vertex();
35 if (!v) return std::vector<HepMC::GenParticlePtr>();
36#ifdef HEPMC3
37 std::vector<HepMC::GenParticlePtr> ret = v->particles_out();
38#else
39 std::vector<HepMC::GenParticlePtr> ret;
40 for (auto pp=v->particles_out_const_begin();pp!=v->particles_out_const_end();++pp) ret.push_back(*pp);
41#endif
42 if (ret.size()==1) if (ret.at(0)->pdg_id()==p->pdg_id()) ret = findChildren(ret.at(0));
43 return ret;
44}
std::vector< HepMC::GenParticlePtr > findChildren(const HepMC::GenParticlePtr &p)
Definition TruthSvc.cxx:32