23 #include <unordered_set>
32 std::vector<bool> &particleMask,
33 std::vector<bool> &vertexMask,
37 int headIndex = pHead->
index();
38 particleMask[headIndex] =
true;
46 int decayIndex = decayVtx->
index();
47 vertexMask[decayIndex] =
true;
53 for (
unsigned int i=0;
i<nParents; ++
i) {
56 isHadVtx = isHadVtx && (idabs<6 || idabs==21);
58 for (
unsigned int i=0;
i<nChildren; ++
i) {
61 isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) ||
65 if( !isHadVtx || keepHadVtx ){
67 for (
unsigned int i=0;
i<nChildren; ++
i) {
77 int prodIndex = prodVtx->
index();
78 vertexMask[prodIndex] =
true;
81 unsigned int nChildren = nSiblings;
85 for (
unsigned int i=0;
i<nParents; ++
i) {
88 isHadVtx = isHadVtx && (idabs<6 || idabs==21);
90 for (
unsigned int i=0;
i<nChildren; ++
i) {
93 isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) ||
97 if( !isHadVtx || keepHadVtx ){
99 for (
unsigned int i=0;
i<nParents; ++
i) {
102 particleMask[parentIndex] =
true;
105 for (
unsigned int i=0;
i<nSiblings; ++
i) {
108 particleMask[siblingIndex] =
true;
117 std::vector<int> &particleList,
118 std::unordered_set<int> &encounteredUniqueIDs) {
121 std::unordered_set<int>::const_iterator
found = encounteredUniqueIDs.find(
HepMC::uniqueID(pHead));
122 if (
found!=encounteredUniqueIDs.end())
return;
131 particleList.push_back(pHead->
pdgId());
135 for (
int i=0;
i<nChildren; ++
i) {
144 std::vector<bool> &particleMask,
145 std::vector<bool> &vertexMask,
146 std::unordered_set<int> &encounteredUniqueIDs,
150 if (pHead==
nullptr)
return;
153 std::unordered_set<int>::const_iterator
found = encounteredUniqueIDs.find(
HepMC::uniqueID(pHead));
154 if (
found!=encounteredUniqueIDs.end())
return;
160 int headIndex = pHead->
index();
161 particleMask[headIndex] =
true;
170 bool saveVertex =
false;
171 for (
int i=0;
i<nChildren; ++
i) {
179 int vtxIndex = decayVtx->
index();
180 vertexMask[vtxIndex] =
true;
187 std::vector<bool> &particleMask,
188 std::vector<bool> &vertexMask,
189 std::unordered_set<int> &encounteredUniqueIDs ) {
192 if (pHead==
nullptr)
return;
195 std::unordered_set<int>::const_iterator
found = encounteredUniqueIDs.find(
HepMC::uniqueID(pHead));
196 if (
found!=encounteredUniqueIDs.end())
return;
200 int headIndex = pHead->
index();
201 particleMask[headIndex] =
true;
209 int vtxIndex = prodVtx->
index();
210 vertexMask[vtxIndex] =
true;
219 std::vector<const xAOD::TruthParticle*> &selectedlist,
220 const std::vector<int> &pdgId,
bool allowFromHadron =
false,
221 bool chargedOnly =
false)
const {
229 bool skipPdgCheck = (pdgId.size()==0);
236 if (!skipPdgCheck &&
find(pdgId.begin(), pdgId.end(), abs(
particle->pdgId())) == pdgId.end())
continue;
245 if (!allowFromHadron) {
246 if (!acc_class.isAvailable(*
particle))
return false;