21#ifndef XAOD_STANDALONE
45 return StatusCode::SUCCESS;
51 std::vector<const xAOD::TruthParticle*>& promptLeptons,
52 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const {
55 const EventContext& ctx = Gaudi::Hive::currentContext();
60 int pdgid = tp->pdgId();
76 if (!
m_includePromptLeptons && std::find(promptLeptons.begin(),promptLeptons.end(),tp)!=promptLeptons.end()){
77 ATH_MSG_VERBOSE(
"Veto prompt lepton (" << pdgid <<
") with pt " << tp->pt());
92 if (abs(tp->pdgId()) <= 4900101)
return false;
93 if (tp->hasDecayVtx()) {
94 size_t good_hadrons = 0;
95 for (
size_t p = 0; p < tp->end_vertex()->nOutgoingParticles(); ++p) {
100 if (good_hadrons == 0)
return false;
116 bool foundDressDec{
false};
119 if (
MC::isPhoton(pdgid) && dressAcc(*tp)) foundDressDec =
true;
121 if (foundDressDec)
return false;
129 std::vector<int> used_vertices;
131 used_vertices.clear();
132 if (
comesFrom(tp,anID,used_vertices))
return false;
142 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const
144 if(tc_results.find(tp) == tc_results.end()) {
148 return tc_results[tp];
168 std::vector<const xAOD::TruthParticle*> promptLeptons;
169 promptLeptons.reserve(10);
173 if ( !truthParticles.isValid() ) {
180 std::map<const xAOD::TruthParticle*,unsigned int> tc_results;
182 size_t numCopied = 0;
193 promptLeptons.push_back(tp);
204 ptruth->push_back(tp);
215 if (!truthParticles_out.put(std::move(ptruth))) {
216 ATH_MSG_ERROR(
"Unable to write new TruthParticleContainer to event store: "
219 ATH_MSG_DEBUG(
"Created new TruthParticleContainer in event store: "
229 if (!tp)
return false;
231 if (!tp->prodVtx() || tp->nParents()==0)
return false;
234 if (std::find(used_vertices.begin(),used_vertices.end(),
m_uid(*tp->prodVtx()))!=used_vertices.end())
return false;
237 used_vertices.push_back(
m_uid(*tp->prodVtx()) );
239 for (
size_t par=0;par<tp->nParents();++par){
241 if (!tp->parent(par))
continue;
243 if (tp->parent(par)->absPdgId()==pdgID)
return true;
245 if (
comesFrom(tp->parent(par), pdgID, used_vertices))
return true;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
DataVector adapter that acts like it holds const pointers.
ATLAS-specific HepMC functions.
Define macros for attributes used to control the static checker.
DataVector adapter that acts like it holds const pointers.
SG::ConstAccessor< int > m_uid
Gaudi::Property< bool > m_includeDark
bool comesFrom(const xAOD::TruthParticle *tp, const int pdgID, std::vector< int > &used_vertices) const
virtual StatusCode initialize() override final
Function initialising the tool.
Gaudi::Property< bool > m_includeSM
Gaudi::Property< std::vector< int > > m_vetoPDG_IDs
Gaudi::Property< bool > m_includeBSMNonInt
bool classifyJetInput(const xAOD::TruthParticle *tp, std::vector< const xAOD::TruthParticle * > &promptLeptons, std::map< const xAOD::TruthParticle *, unsigned int > &tc_results) const
Redefine our own Classifier function(s)
Gaudi::Property< bool > m_includeNu
SG::WriteHandleKey< ConstDataVector< xAOD::TruthParticleContainer > > m_outTruthPartKey
Key for output truth particles.
unsigned int getTCresult(const xAOD::TruthParticle *tp, std::map< const xAOD::TruthParticle *, unsigned int > &tc_results) const
Gaudi::Property< bool > m_includePromptLeptons
Gaudi::Property< float > m_maxAbsEta
Maximum allowed eta for particles in jets.
Gaudi::Property< bool > m_includePromptPhotons
Gaudi::Property< bool > m_use_barcode
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleKey
Key for input truth event.
Gaudi::Property< float > m_ptmin
Minimum pT for particle selection (in MeV)
CopyTruthJetParticles(const std::string &name)
Constructor.
virtual int execute() const override final
redefine execute so we can call our own classify()
Gaudi::Property< bool > m_includeMu
SG::ReadDecorHandleKeyArray< xAOD::TruthParticleContainer > m_dressingNames
Name of the decoration to be used for identifying FSR (dressing) photons.
Helper class to provide constant type-safe access to aux data.
Handle class for reading a decoration on an object.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
int isPrompt(const unsigned int classify, bool allow_prompt_tau_decays=true)
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
bool isZeroEnergyPhoton(const T &p)
Identify a photon with zero energy. Probably a workaround for a generator bug.
bool isPhoton(const T &p)
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isInteracting(const T &p)
Identify if the particle with given PDG ID would not interact with the detector, i....
bool isHiddenValley(const T &p)
PDG rule 11k Hidden Valley particles have n = 4 and n_r = 9, and trailing numbers in agreement with t...
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
TruthParticle_v1 TruthParticle
Typedef to implementation.