Skip to content

Commit

Permalink
rebase from May
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger committed Dec 4, 2024
1 parent 5b5d3a5 commit 44e59d3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 22 deletions.
12 changes: 10 additions & 2 deletions Examples/Io/Obj/include/ActsExamples/Io/Obj/ObjSimHitWriter.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// 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/.

// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
Expand Down Expand Up @@ -48,9 +56,9 @@ class ObjSimHitWriter : public WriterT<SimHitContainer> {
/// Draw line connections between hits
bool drawConnections = true;
/// Momentum threshold for hits
Acts::ActsScalar momentumThreshold = 0.05_GeV;
double momentumThreshold = 0.05_GeV;
/// Momentum threshold for trajectories
Acts::ActsScalar momentumThresholdTraj = 0.05_GeV;
double momentumThresholdTraj = 0.05_GeV;
/// Number of points to interpolate between hits
unsigned int nInterpolatedPoints = 10;
};
Expand Down
2 changes: 1 addition & 1 deletion Examples/Io/Obj/src/ObjPropagationStepsWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// 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/.

#include "ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp"
#include "ActsExamples/Io/Obj/ObjPropagationStepsWriter.hpp"

namespace ActsExamples {

Expand Down
21 changes: 14 additions & 7 deletions Examples/Io/Obj/src/ObjSimHitWriter.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// 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/.

// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
Expand Down Expand Up @@ -33,14 +41,13 @@ std::vector<Acts::Vector3> interpolatedPoints(
for (unsigned int i = 0; i < inputs.size(); ++i) {
points.col(i) = inputs[i].template head<3>().transpose();
}
Eigen::Spline<Acts::ActsScalar, 3> spline3D =
Eigen::SplineFitting<Eigen::Spline<Acts::ActsScalar, 3>>::Interpolate(
points, 2);
Eigen::Spline<double, 3> spline3D =
Eigen::SplineFitting<Eigen::Spline<double, 3>>::Interpolate(points, 2);

std::vector<Acts::Vector3> output;
Acts::ActsScalar step = 1. / (nPoints - 1);
double step = 1. / (nPoints - 1);
for (unsigned int i = 0; i < nPoints; ++i) {
Acts::ActsScalar t = i * step;
double t = i * step;
Eigen::Vector3d point = spline3D(t);
output.push_back(Acts::Vector3(point[0], point[1], point[2]));
}
Expand Down Expand Up @@ -93,10 +100,10 @@ ActsExamples::ProcessCode ActsExamples::ObjSimHitWriter::writeT(
} // end simHit loop
} else {
// We need to associate first
std::unordered_map<uint64_t, std::vector<Acts::Vector4>> particleHits;
std::unordered_map<std::size_t, std::vector<Acts::Vector4>> particleHits;
// Pre-loop over hits ... write those below threshold
for (const auto& simHit : simHits) {
Acts::ActsScalar momentum = simHit.momentum4Before().head<3>().norm();
double momentum = simHit.momentum4Before().head<3>().norm();
if (momentum < m_cfg.momentumThreshold) {
ACTS_VERBOSE("Skipping : Hit below threshold: " << momentum);
continue;
Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "ActsExamples/Io/Csv/CsvTrackParameterWriter.hpp"
#include "ActsExamples/Io/Csv/CsvTrackWriter.hpp"
#include "ActsExamples/Io/Csv/CsvTrackingGeometryWriter.hpp"
#include "ActsExamples/Io/Obj/ObjPropagationStepsWriter.hpp"
#include "ActsExamples/Io/Obj/ObjSimHitWriter.hpp"
#include "ActsExamples/Io/Obj/ObjTrackingGeometryWriter.hpp"
#include "ActsExamples/Io/Root/RootBFieldWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialTrackWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialWriter.hpp"
Expand All @@ -45,9 +48,6 @@
#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFitterPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/VertexNTupleWriter.hpp"
#include "ActsExamples/Io/Obj/ObjPropagationStepsWriter.hpp"
#include "ActsExamples/Io/Obj/ObjSimHitWriter.hpp"
#include "ActsExamples/Io/Obj/ObjTrackingGeometryWriter.hpp"
#include "ActsExamples/MaterialMapping/IMaterialWriter.hpp"
#include "ActsExamples/TrackFinding/ITrackParamsLookupReader.hpp"
#include "ActsExamples/TrackFinding/ITrackParamsLookupWriter.hpp"
Expand Down
20 changes: 11 additions & 9 deletions Examples/Scripts/Python/sim_digi_odd.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,17 @@
s,
trackingGeometry,
field,
preSelectParticles=ParticleSelectorConfig(
rho=(0.0, 24 * u.mm),
absZ=(0.0, 1.0 * u.m),
eta=(-3.0, 3.0),
pt=(150 * u.MeV, None),
removeNeutral=True,
)
if args.ttbar
else ParticleSelectorConfig(),
preSelectParticles=(
ParticleSelectorConfig(
rho=(0.0, 24 * u.mm),
absZ=(0.0, 1.0 * u.m),
eta=(-3.0, 3.0),
pt=(150 * u.MeV, None),
removeNeutral=True,
)
if args.ttbar
else ParticleSelectorConfig()
),
enableInteractions=True,
outputDirRoot=outputDir if args.output_root else None,
outputDirCsv=outputDir if args.output_csv else None,
Expand Down

0 comments on commit 44e59d3

Please sign in to comment.