ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimInputUtils.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
9
11 {
12 ParentBitmask result;
13 result.reset();
14 typedef std::pair<HepMC::ConstGenParticlePtr, unsigned int> Parent;
15 std::vector<Parent> parents;
16 parents.push_back(Parent(particle, 0));
17 while (!parents.empty()) {
18 HepMC::ConstGenParticlePtr p = parents.back().first;
19 const unsigned int level = parents.back().second;
20 if (std::abs(p->pdg_id()) == 15) { result.set(TAU_PARENT_BIT, 1); }
21 if (std::abs(p->pdg_id()) == 5) { result.set(B_PARENT_BIT, 1); }
22 if (std::abs(p->pdg_id()) == 211) { result.set(PION_PARENT_BIT, 1); }
23 if (std::abs(p->pdg_id()) == 211 && level <= 1) { result.set(PION_IMMEDIATE_PARENT_BIT, 1); }
24 if (result.count() == NBITS) { break; }
25 parents.pop_back();
26 if (!(p->production_vertex())) { continue; }
27 for (HepMC::ConstGenParticlePtr i: p->production_vertex()->particles_in() ) {
28 parents.push_back(Parent(i, level + 1));
29 }
30 }
31 return result;
32 }
33
34
35}
const ParentBitmask construct_truth_bitmap(HepMC::ConstGenParticlePtr p)
std::bitset< NBITS > ParentBitmask
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20