12#include "CLHEP/Geometry/Point3D.h"
13#include "CLHEP/Units/SystemOfUnits.h"
19 const IInterface* parent)
27 declareInterface<IGenParticleSelector>(
this);
40 return StatusCode::SUCCESS;
45 return StatusCode::SUCCESS;
48std::vector<HepMC::ConstGenParticlePtr>*
51 if (! SimTracks)
return nullptr;
53 std::vector<HepMC::ConstGenParticlePtr>* genSignal =
54 new std::vector<HepMC::ConstGenParticlePtr>;
58 for( ; itCollision != SimTracks->
end(); ++itCollision ) {
59 const HepMC::GenEvent* genEvent = *itCollision;
61 for (
const auto& particle: *genEvent) {
66 if(!particle->production_vertex()) {
67 ATH_MSG_WARNING (
"GenParticle without production vertex - simulation corrupt? ");
73 if ( std::fabs(particle->production_vertex()->position().perp()) >
m_maxRStartAll ||
74 std::fabs(particle->production_vertex()->position().z()) >
m_maxZStartAll )
continue;
76 int pdgCode = particle->pdg_id();
81 auto prodVertex = particle->production_vertex();
82 if ( std::abs(pdgCode) == 11 ) {
83 ATH_MSG_DEBUG (
"Electron/Positron detected -- checking for production process ...");
85 for (
const auto& inParticle: prodVertex->particles_in()) {
87 HepMC::GenVertex::particles_in_const_iterator ItinParticle = prodVertex->particles_in_const_begin();
88 HepMC::GenVertex::particles_out_const_iterator ItinParticleEnd = prodVertex->particles_in_const_end();
89 for ( ; ItinParticle != ItinParticleEnd; ++ItinParticle) {
90 auto inParticle=*ItinParticle;
94 if (std::fabs(particle->momentum().perp()) >
m_minPt && std::fabs(particle->momentum().pseudoRapidity()) <
m_maxEta ) {
95 genSignal->push_back(particle);
#define ATH_MSG_WARNING(x)
ATLAS-specific HepMC functions.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual StatusCode initialize()
initialize
InDetPrimaryConversionSelector(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode finalize()
float m_maxZStartAll
Max z of start vertex for primaries + sec.
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal(const McEventCollection *) const
main method performing the genparticle selection; it works on the entire collection.
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.
bool isPhoton(const T &p)
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.