ATLAS Offline Software
Loading...
Searching...
No Matches
InDetReconstructableSelector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// InDetReconstructableSelector.cxx
7// Source file for class InDetReconstructableSelector
9
12#include "CLHEP/Units/SystemOfUnits.h"
16
18 const IInterface* parent)
19 : AthAlgTool (type,name,parent),
20 m_minPt (1000.),
21 m_maxEta ( 3.0),
23 m_maxRStartPrimary ( 25.0*CLHEP::mm),
24 m_maxZStartPrimary ( 200.0*CLHEP::mm),
25 m_maxRStartAll ( 360.0*CLHEP::mm),
26 m_maxZStartAll (2000.0*CLHEP::mm)
27
28{
29 declareInterface<IGenParticleSelector>(this);
30
31 declareProperty("MinPt", m_minPt);
32 declareProperty("MaxEta", m_maxEta);
33 declareProperty("SelectPrimariesOnly",m_selectPrimariesOnly, "flag to restrict to primaries or not");
34 declareProperty("MaxRStartPrimary", m_maxRStartPrimary, "production vtx r for primaries");
35 declareProperty("MaxZStartPrimary", m_maxZStartPrimary, "production vtx z for primaries");
36 declareProperty("MaxRStartAll", m_maxRStartAll, "production vtx r for all");
37 declareProperty("MaxZStartAll", m_maxZStartAll, "production vtx z for all");
38}
39
44 ATH_MSG_INFO ("initialise in " << name());
45 return StatusCode::SUCCESS;
46}
47
49 ATH_MSG_INFO ("starting finalize() in " << name());
50 return StatusCode::SUCCESS;
51}
52
53std::vector<HepMC::ConstGenParticlePtr>*
55
56 if (! SimTracks) return nullptr;
57
58 std::vector<HepMC::ConstGenParticlePtr>* genSignal =
59 new std::vector<HepMC::ConstGenParticlePtr>;
60
61 // pile-up: vector of MCEC has more than one entry
62 DataVector<HepMC::GenEvent>::const_iterator itCollision = SimTracks->begin();
63
64 for( ; itCollision != SimTracks->end(); ++itCollision ) {
65 const HepMC::GenEvent* genEvent = *itCollision;
66
67 for ( const auto& particle: *genEvent) {
68
69
70 // 1) require stable particle from generation or simulation
71 if (!MC::isStable(particle)) continue;
72
73 if(particle->production_vertex() == nullptr) {
74 ATH_MSG_WARNING ("GenParticle without production vertex - simulation corrupt? ");
75 ATH_MSG_DEBUG ("It's this one: " << particle);
76 continue;
77 } else {
78
79 // 2) require track inside ID - relaxed definition including decays of neutrals (secondaries)
80 if ( std::abs(particle->production_vertex()->position().perp()) > m_maxRStartAll ||
81 std::abs(particle->production_vertex()->position().z()) > m_maxZStartAll ) continue;
82
83 // 3) if jobOption, require strict definition of particles from within beam pipe
85 ( std::abs(particle->production_vertex()->position().perp()) > m_maxRStartPrimary ||
86 std::abs(particle->production_vertex()->position().z()) > m_maxZStartPrimary ) ) continue;
87
88 int pdgCode = particle->pdg_id();
89 if (MC::isNucleus(pdgCode)) continue; // ignore nuclei from hadronic interactions
90 const float charge = MC::charge(pdgCode);
91 if (std::abs(charge)<0.5) continue;
92
93 if (std::abs(particle->momentum().perp()) > m_minPt && std::abs(particle->momentum().pseudoRapidity()) < m_maxEta ) {
94 genSignal->push_back(particle);
95 }
96 }
97 } // loop and select particles
98 } // loop and select pile-up vertices
99 return genSignal;
100}
101
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
ATLAS-specific HepMC functions.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
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...
InDetReconstructableSelector(const std::string &type, const std::string &name, const IInterface *parent)
float m_maxZStartPrimary
Max Z of start vertex to be considered primary.
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal(const McEventCollection *) const
main method performing the genparticle selection; it works on the entire collection.
float m_maxZStartAll
Max z of start vertex for primaries + sec.
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.
float m_maxRStartPrimary
Max R of start vertex to be considered primary.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double charge(const T &p)
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.