Skip to content

Commit

Permalink
Merge branch 'main' of github.com:acts-project/acts into ex-split-par…
Browse files Browse the repository at this point in the history
…ticle-selection
  • Loading branch information
andiwand committed Dec 11, 2024
2 parents 981abe6 + 93e3b27 commit a09328e
Show file tree
Hide file tree
Showing 44 changed files with 3,823 additions and 28 deletions.
1 change: 0 additions & 1 deletion CI/codespell_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ parm
writet
localy
lastr
digitial
exprot
pring
aline
Expand Down
13 changes: 9 additions & 4 deletions Core/include/Acts/EventData/detail/GenerateParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,24 @@ template <typename generator_t>
inline std::pair<double, double> generateBoundDirection(
generator_t& rng, const GenerateBoundDirectionOptions& options) {
using UniformReal = std::uniform_real_distribution<double>;
assert(options.thetaMin >= 0.f);
assert(options.thetaMax <= std::numbers::pi);
assert(options.thetaMin <= options.thetaMax);

// since we want to draw the direction uniform on the unit sphere, we must
// draw from cos(theta) instead of theta. see e.g.
// https://mathworld.wolfram.com/SpherePointPicking.html
double cosThetaMin = std::cos(options.thetaMin);
// Get cosThetaMin from thetaMax and vice versa, because cos is
// monothonical decreasing between [0, pi]
double cosThetaMin = std::cos(options.thetaMax);
// ensure upper bound is included. see e.g.
// https://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution
double cosThetaMax = std::nextafter(std::cos(options.thetaMax),
double cosThetaMax = std::nextafter(std::cos(options.thetaMin),
std::numeric_limits<double>::max());

// in case we force uniform eta generation
double etaMin = Acts::AngleHelpers::etaFromTheta(options.thetaMin);
double etaMax = Acts::AngleHelpers::etaFromTheta(options.thetaMax);
double etaMin = Acts::AngleHelpers::etaFromTheta(options.thetaMax);
double etaMax = Acts::AngleHelpers::etaFromTheta(options.thetaMin);

UniformReal phiDist(options.phiMin, options.phiMax);
UniformReal cosThetaDist(cosThetaMin, cosThetaMax);
Expand Down
105 changes: 105 additions & 0 deletions Core/include/Acts/Geometry/Blueprint.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// This file is part of the ACTS project.
//
// Copyright (C) 2016 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
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Geometry/BlueprintNode.hpp"
#include "Acts/Geometry/PortalShell.hpp"
#include "Acts/Geometry/TrackingGeometry.hpp"
#include "Acts/Geometry/TrackingVolume.hpp"

namespace Acts {

class GeometryContext;

/// This class is the top-level entry point to build a tracking geometry using
/// the blueprint building mechanism. It forms the root of a tree of nodes where
/// each node performs a portion of the construction. This top-level class has
/// the main construction methods that execute the construction of the geometry.
///
/// ```
/// +---------------+ +-----------+
/// | | | |
/// | Root | | v
/// | | | +---------------+
/// +---------------+ | | |
/// | | | Child 1 |
/// +----------+ | | |
/// v +----------+ +---------------+
/// +---------------+ |
/// | | +--------------+
/// | Child 2 | v +----------+
/// | | .---------. | |
/// +---------------+ / \ | v
/// ( Proc node ) | +---------------+
/// `. ,' | | |
/// `-------' | | Child 3 |
/// | | | |
/// | | +---------------+
/// +---------+
/// ```
///
/// The construction phases are documented in @c BlueprintNode, which is the
/// base class for all nodes in the tree.
/// @note This class inherits from @c BlueprintNode, but hides the main
/// blueprint construction phase overloads. The @c Blueprint class is
/// only ever intended to be the top-level node, and not anywhere else
/// in the tree.
class Blueprint : public BlueprintNode {
public:
struct Config {
/// Determine how much envelope space to produce from the highest volume
/// in the geometry hierarchy and the world volume.
ExtentEnvelope envelope = ExtentEnvelope::Zero();

/// The geometry identifier hook, passed through the `TrackingGeometry`
/// constructor. This will be superseded by a more integrated approach to
/// the identification scheme
GeometryIdentifierHook geometryIdentifierHook = {};
};

/// Constructor from a config object
/// @param config The configuration object
explicit Blueprint(const Config& config);

/// Construct the tracking geometry from the blueprint tree
/// @param options The construction options, see @c BlueprintOptions
/// @param gctx The geometry context for construction. In almost all cases,
/// this should be the *nominal* geometry context
/// @param logger The logger to use for output during construction
std::unique_ptr<TrackingGeometry> construct(
const BlueprintOptions& options, const GeometryContext& gctx,
const Logger& logger = Acts::getDummyLogger());

protected:
/// The name of the blueprint node, always "Root"
/// @return The name
const std::string& name() const override;

/// @copydoc BlueprintNode::build
Volume& build(const BlueprintOptions& options, const GeometryContext& gctx,
const Logger& logger = Acts::getDummyLogger()) override;

/// @copydoc BlueprintNode::connect
PortalShellBase& connect(
const BlueprintOptions& options, const GeometryContext& gctx,
const Logger& logger = Acts::getDummyLogger()) override;

/// @copydoc BlueprintNode::finalize
void finalize(const BlueprintOptions& options, const GeometryContext& gctx,
TrackingVolume& parent,
const Logger& logger = Acts::getDummyLogger()) override;

/// @copydoc BlueprintNode::addToGraphviz
void addToGraphviz(std::ostream& os) const override;

private:
Config m_cfg;
};

} // namespace Acts
Loading

0 comments on commit a09328e

Please sign in to comment.