Skip to content

Commit

Permalink
feat: Pythia8 label secondary vertices based on proximity in Examples (
Browse files Browse the repository at this point in the history
…acts-project#3048)

Implements a spatial proximity match criteria for secondary vertices with Pythia8.

blocked by
- acts-project#2998
  • Loading branch information
andiwand authored and Ragansu committed Apr 19, 2024
1 parent be332a9 commit 9ff5c8f
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
Binary file modified CI/physmon/reference/performance_ambi_ttbar.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_gridseeder_ttbar_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_ttbar_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ckf_ttbar.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_seeding_ttbar.root
Binary file not shown.
Binary file modified CI/physmon/reference/tracksummary_ckf_ttbar_hist.root
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2017-2019 CERN for the benefit of the Acts project
// Copyright (C) 2017-2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -115,10 +115,15 @@ Pythia8Generator::operator()(RandomEngine& rng) {
// only secondaries have a defined vertex position
if (m_cfg.labelSecondaries && genParticle.hasVertex()) {
// either add to existing secondary vertex if exists or create new one
// TODO can we do this w/o the manual search and position check?
auto it = std::find_if(
vertices.begin(), vertices.end(),
[=](const SimVertex& other) { return pos4 == other.position4; });

// check if an existing vertex is close enough
auto it =
std::find_if(vertices.begin(), vertices.end(),
[&pos4, this](const SimVertex& other) {
return (pos4.head<3>() - other.position()).norm() <
m_cfg.spatialVertexThreshold;
});

if (it != vertices.end()) {
particleId.setVertexSecondary(std::distance(vertices.begin(), it));
it->outgoing.insert(particleId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2017-2019 CERN for the benefit of the Acts project
// Copyright (C) 2017-2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -45,7 +45,9 @@ class Pythia8Generator : public EventGenerator::ParticlesGenerator {
/// Turn on/off the labeling of secondary vertices
/// TODO this is essentially broken as the current code will label any kind
/// of decay as secondary
bool labelSecondaries = false;
bool labelSecondaries = true;
/// The spatial threshold to consider a particle originating from a vertex
double spatialVertexThreshold = 1.0 * Acts::UnitConstants::um;
};

Pythia8Generator(const Config& cfg, Acts::Logging::Level lvl);
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_pythia8__pythia8_particles.root: 79fa44dadc3193c9349c108c7a784d6121d343f88e8059ca11eed442ab1d49db
test_pythia8__pythia8_particles.root: 49b89c3458a51aa9407f887be50e6bbcd9a2a0c897e6f2be5a5d6a29d1bf3505
test_fatras__particles_simulation.root: 4ce0feb0ecb234143f418789a7a0d377f4a653d529c49bf999dda1878c50cee1
test_fatras__hits.root: 2e47d9ba55fa1b377f70c361107fe811e9880d14c42cb3d7a9cd4616a6f33a54
test_geant4__particles_simulation.root: 3052d64dfe627c22521c3dd95397a3c02c1c63fd5d6d07606005541014b40b1d
Expand Down

0 comments on commit 9ff5c8f

Please sign in to comment.