Skip to content

Commit

Permalink
Merge branch 'main' into gitlab-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 1, 2024
2 parents 5158c87 + da1d846 commit 3b34333
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ std::vector<double> Acts::ScoreBasedAmbiguityResolution::simpleScore(
ACTS_DEBUG("---> Number of outliers: " << trackFeatures.nOutliers);

if ((trackFeatures.nHits < detector.minHits) ||
(trackFeatures.nHits > detector.maxHits) ||
(trackFeatures.nHoles > detector.maxHoles) ||
(trackFeatures.nOutliers > detector.maxOutliers)) {
score = 0;
Expand Down Expand Up @@ -333,7 +332,6 @@ std::vector<double> Acts::ScoreBasedAmbiguityResolution::ambiguityScore(
ACTS_DEBUG("---> Number of outliers: " << trackFeatures.nOutliers);

if ((trackFeatures.nHits < detector.minHits) ||
(trackFeatures.nHits > detector.maxHits) ||
(trackFeatures.nHoles > detector.maxHoles) ||
(trackFeatures.nOutliers > detector.maxOutliers)) {
score = 0;
Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Geometry/Portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ class Portal {
/// @return The portal surface
const RegularSurface& surface() const;

/// Access the portal surface that is shared between the two links
/// @return The portal surface
RegularSurface& surface();

private:
/// Helper to check surface equivalence without checking material status. This
/// is needed because we allow fusing portals with surfaces that are
Expand Down
22 changes: 22 additions & 0 deletions Core/include/Acts/Geometry/TrackingVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class IVolumeMaterial;
class Surface;
class TrackingVolume;
struct GeometryIdentifierHook;
class Portal;

/// Interface types of the Gen1 geometry model
/// @note This interface is being replaced, and is subject to removal
Expand Down Expand Up @@ -301,6 +302,26 @@ class TrackingVolume : public Volume {
/// @return the range of volumes
MutableVolumeRange volumes();

using MutablePortalRange =
detail::TransformRange<detail::Dereference,
std::vector<std::shared_ptr<Portal>>>;

using PortalRange =
detail::TransformRange<detail::ConstDereference,
const std::vector<std::shared_ptr<Portal>>>;

/// Return all portals registered under this tracking volume
/// @return the range of portals
PortalRange portals() const;

/// Return mutable view of the registered portals under this tracking volume
/// @return the range of portals
MutablePortalRange portals();

/// Add a portal to this tracking volume
/// @param portal The portal to add
void addPortal(std::shared_ptr<Portal> portal);

/// Add a child volume to this tracking volume
/// @param volume The volume to add
/// @note The @p volume will have its mother volume assigned to @p this.
Expand Down Expand Up @@ -494,6 +515,7 @@ class TrackingVolume : public Volume {
std::string m_name;

std::vector<std::unique_ptr<TrackingVolume>> m_volumes;
std::vector<std::shared_ptr<Portal>> m_portals;
};

} // namespace Acts
5 changes: 5 additions & 0 deletions Core/src/Geometry/Portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ const RegularSurface& Portal::surface() const {
return *m_surface;
}

RegularSurface& Portal::surface() {
assert(m_surface != nullptr);
return *m_surface;
}

Portal Portal::merge(const GeometryContext& gctx, Portal& aPortal,
Portal& bPortal, BinningValue direction,
const Logger& logger) {
Expand Down
25 changes: 25 additions & 0 deletions Core/src/Geometry/TrackingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Acts/Definitions/Direction.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Geometry/GlueVolumesDescriptor.hpp"
#include "Acts/Geometry/Portal.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Material/IMaterialDecorator.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
Expand Down Expand Up @@ -424,6 +425,18 @@ void TrackingVolume::closeGeometry(
logger);
}
}

GeometryIdentifier::Value iportal = 0;
for (auto& portal : portals()) {
auto portalId = GeometryIdentifier(volumeID).setBoundary(++iportal);
assert(portal.isValid() && "Invalid portal encountered during closing");

portal.surface().assignGeometryId(portalId);
}

for (auto& volume : volumes()) {
volume.closeGeometry(materialDecorator, volumeMap, vol, hook, logger);
}
}

// Returns the boundary surfaces ordered in probability to hit them based on
Expand Down Expand Up @@ -641,4 +654,16 @@ TrackingVolume& TrackingVolume::addVolume(
return *m_volumes.back();
}

TrackingVolume::PortalRange TrackingVolume::portals() const {
return PortalRange{m_portals};
}

TrackingVolume::MutablePortalRange TrackingVolume::portals() {
return MutablePortalRange{m_portals};
}

void TrackingVolume::addPortal(std::shared_ptr<Portal> portal) {
m_portals.push_back(std::move(portal));
}

} // namespace Acts
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-2018 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 All @@ -23,9 +23,6 @@

class TFile;
class TTree;
namespace ActsFatras {
class Barcode;
} // namespace ActsFatras

namespace ActsExamples {
struct AlgorithmContext;
Expand Down Expand Up @@ -95,29 +92,68 @@ class RootTrackParameterWriter final : public TrackParameterWriter {
ReadDataHandle<HitSimHitsMap> m_inputMeasurementSimHitsMap{
this, "InputMeasurementSimHitsMap"};

std::mutex m_writeMutex; ///< Mutex used to protect multi-threaded writes
TFile* m_outputFile{nullptr}; ///< The output file
TTree* m_outputTree{nullptr}; ///< The output tree
int m_eventNr{0}; ///< the event number of

float m_loc0{NaNfloat}; ///< loc0
float m_loc1{NaNfloat}; ///< loc1
float m_phi{NaNfloat}; ///< phi
float m_theta{NaNfloat}; ///< theta
float m_qop{NaNfloat}; ///< q/p
float m_time{NaNfloat}; ///< time
float m_p{NaNfloat}; ///< p
float m_pt{NaNfloat}; ///< pt
float m_eta{NaNfloat}; ///< eta

int m_t_charge{0}; ///< Truth particle charge
float m_t_loc0{NaNfloat}; ///< Truth parameter loc0
float m_t_loc1{NaNfloat}; ///< Truth parameter loc1
float m_t_phi{NaNfloat}; ///< Truth parameter phi
float m_t_theta{NaNfloat}; ///< Truth parameter theta
float m_t_qop{NaNfloat}; ///< Truth parameter qop
float m_t_time{NaNfloat}; ///< Truth parameter time
bool m_truthMatched = false; ///< Whether the seed is matched with truth
/// Mutex used to protect multi-threaded writes
std::mutex m_writeMutex;
TFile* m_outputFile{nullptr};
TTree* m_outputTree{nullptr};

int m_eventNr{0};

int m_volumeId{0};
int m_layerId{0};
int m_surfaceId{0};

// Track parameters
float m_loc0{NaNfloat};
float m_loc1{NaNfloat};
float m_phi{NaNfloat};
float m_theta{NaNfloat};
float m_qop{NaNfloat};
float m_time{NaNfloat};

float m_err_loc0{NaNfloat};
float m_err_loc1{NaNfloat};
float m_err_phi{NaNfloat};
float m_err_theta{NaNfloat};
float m_err_qop{NaNfloat};
float m_err_time{NaNfloat};

int m_charge{0};
float m_p{NaNfloat};
float m_pt{NaNfloat};
float m_eta{NaNfloat};

// Truth parameters
/// Whether the seed is matched with truth
bool m_t_matched{false};
std::uint64_t m_t_particleId{0};
unsigned int m_nMajorityHits{0};

float m_t_loc0{NaNfloat};
float m_t_loc1{NaNfloat};
float m_t_phi{NaNfloat};
float m_t_theta{NaNfloat};
float m_t_qop{NaNfloat};
float m_t_time{NaNfloat};

int m_t_charge{0};
float m_t_p{NaNfloat};
float m_t_pt{NaNfloat};
float m_t_eta{NaNfloat};

float m_res_loc0{NaNfloat};
float m_res_loc1{NaNfloat};
float m_res_phi{NaNfloat};
float m_res_theta{NaNfloat};
float m_res_qop{NaNfloat};
float m_res_time{NaNfloat};

float m_pull_loc0{NaNfloat};
float m_pull_loc1{NaNfloat};
float m_pull_phi{NaNfloat};
float m_pull_theta{NaNfloat};
float m_pull_qop{NaNfloat};
float m_pull_time{NaNfloat};
};

} // namespace ActsExamples
Loading

0 comments on commit 3b34333

Please sign in to comment.