Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update AthenaDumpReader, allow reading only SPs #3709

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Examples/Framework/include/ActsExamples/EventData/Cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ struct Cluster {

// TODO make this be provided by Fatras?
Acts::Vector3 globalPosition = Acts::Vector3::Zero();
Acts::Vector3 localDirection = Acts::Vector3::Zero();
Acts::Vector3 lengthDirection = Acts::Vector3::Zero();
float localEta = 0.f;
float localPhi = 0.f;
float globalEta = 0.f;
float globalPhi = 0.f;
float etaAngle = 0.f;
float phiAngle = 0.f;

double sumActivations() const {
return std::accumulate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <iostream>
#include <utility>

#include <boost/bimap.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>

Expand Down Expand Up @@ -229,4 +230,9 @@ struct GeometryIdMultisetAccessor {
const Container* container = nullptr;
};

/// A map that allows mapping back and forth between ACTS and Athena Geometry
/// Ids
using GeometryIdMapActsAthena =
boost::bimap<std::uint64_t, Acts::GeometryIdentifier>;

} // namespace ActsExamples
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "Acts/Utilities/Logger.hpp"
#include "ActsExamples/EventData/GeometryContainers.hpp"
#include "ActsExamples/EventData/Measurement.hpp"
#include "ActsExamples/EventData/SimSpacePoint.hpp"
#include "ActsExamples/Framework/DataHandle.hpp"
Expand Down Expand Up @@ -62,13 +63,33 @@ class RootAthenaDumpReader : public IReader {
// name of the track parameters (fitted by athena?)
std::string outputTrackParameters = "athena_track_parameters";

/// Only extract spacepoints
bool onlySpacepoints = false;

/// Only extract particles that passed the tracking requirements, for
/// details see:
/// https://gitlab.cern.ch/atlas/athena/-/blob/main/InnerDetector/InDetGNNTracking/src/DumpObjects.cxx?ref_type=heads#L1363
bool onlyPassedParticles = false;

/// Skip spacepoints with phi overlap
bool skipOverlapSPsPhi = false;

/// Skip spacepoints with eta overlap
bool skipOverlapSPsEta = false;

/// A map that provides a mapping between ACTS and Athena surface
/// identifiers
std::shared_ptr<ActsExamples::GeometryIdMapActsAthena> geometryIdMap =
nullptr;

/// Tracking Geometry that contains the surfaces where we project
/// the measurements on
std::shared_ptr<Acts::TrackingGeometry> trackingGeometry = nullptr;

/// When projecting measurements on ACTS surfaces, which euclidean boundary
/// tolerance should be allowed. If a value above zero is needed, this
/// indicates that the ACTS surfaces do not 100% include the athena surfaces
double absBoundaryTolerance = 0.0;
};

RootAthenaDumpReader(const RootAthenaDumpReader &) = delete;
Expand All @@ -94,12 +115,42 @@ class RootAthenaDumpReader : public IReader {
const Config &config() const { return m_cfg; }

private:
/// Particles with barcodes larger then this value are considered to be
/// secondary particles
/// https://gitlab.cern.ch/atlas/athena/-/blob/main/InnerDetector/InDetGNNTracking/src/DumpObjects.h?ref_type=heads#L101
constexpr static int s_maxBarcodeForPrimary = 200000;

/// Private access to the logging instance
const Acts::Logger &logger() const { return *m_logger; }

/// The config class
Config m_cfg;

/// Helper method to read particles
SimParticleContainer readParticles() const;

/// Helper method to read measurements
std::tuple<ClusterContainer, MeasurementContainer,
IndexMultimap<ActsFatras::Barcode>,
std::unordered_map<int, std::size_t>>
readMeasurements(SimParticleContainer &particles,
const Acts::GeometryContext &gctx) const;

/// Helper method to read spacepoints
/// @param imIdxMap optional remapping of indices. Since the measurement
/// index must be continuous, we need to remap the measurements indices
/// if we skip measurements in the first place
std::tuple<SimSpacePointContainer, SimSpacePointContainer,
SimSpacePointContainer>
readSpacepoints(const std::optional<std::unordered_map<int, std::size_t>>
&imIdxMap) const;

/// Helper method to reprocess particle ids
std::pair<SimParticleContainer, IndexMultimap<ActsFatras::Barcode>>
reprocessParticles(
const SimParticleContainer &particles,
const IndexMultimap<ActsFatras::Barcode> &measPartMap) const;

/// Write handlers
WriteDataHandle<SimSpacePointContainer> m_outputPixelSpacePoints{
this, "outputPixelSpacepoints"};
Expand Down
Loading
Loading