5#ifndef ISF_ACTSTOOLS_ACTSFATRASSIMTOOL_H
6#define ISF_ACTSTOOLS_ACTSFATRASSIMTOOL_H
9#include "GaudiKernel/ServiceHandle.h"
10#include "GaudiKernel/ToolHandle.h"
28#include "Acts/Utilities/UnitVectors.hpp"
31#include "Acts/Geometry/GeometryContext.hpp"
32#include "Acts/MagneticField/MagneticFieldContext.hpp"
33#include "Acts/EventData/BoundTrackParameters.hpp"
34#include "Acts/Propagator/Navigator.hpp"
35#include "Acts/Propagator/EigenStepper.hpp"
36#include "Acts/Propagator/EigenStepperDefaultExtension.hpp"
37#include "Acts/Propagator/StraightLineStepper.hpp"
38#include "Acts/Propagator/detail/SteppingLogger.hpp"
39#include "Acts/Propagator/ActorList.hpp"
40#include "Acts/Propagator/Propagator.hpp"
41#include "Acts/Definitions/ParticleData.hpp"
42#include "ActsFatras/EventData/GenerationProcess.hpp"
43#include "ActsFatras/Kernel/InteractionList.hpp"
44#include "ActsFatras/Kernel/MultiParticleSimulation.hpp"
45#include "ActsFatras/Kernel/SingleParticleSimulationResult.hpp"
46#include "ActsFatras/Kernel/detail/SimulationActor.hpp"
47#include "ActsFatras/Physics/Decay/NoDecay.hpp"
48#include "ActsFatras/Physics/StandardInteractions.hpp"
49#include "ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp"
50#include "ActsFatras/Selectors/SurfaceSelectors.hpp"
83 return surface.isSensitive();
93 template <
typename propagator_t,
typename interactions_t,
94 typename hit_surface_selector_t,
typename decay_t>
123 std::shared_ptr<const Acts::Logger> localLogger_)
138 template <
typename generator_t>
139 Acts::Result<ActsFatras::SingleParticleSimulationResult>
simulate(
140 const Acts::GeometryContext &geoCtx,
141 const Acts::MagneticFieldContext &magCtx, generator_t &generator,
142 const ActsFatras::Particle &particle)
const {
144 ACTS_VERBOSE(
"Using ActsFatrasSimTool simulate()");
146 using SteppingLogger = Acts::detail::SteppingLogger;
147 using SimulationActor = ActsFatras::detail::SimulationActor<generator_t, decay_t, interactions_t, hit_surface_selector_t>;
148 using Result =
typename SimulationActor::result_type;
149 using Actions = Acts::ActorList<SteppingLogger, SimulationActor, Acts::EndOfWorldReached>;
150 using PropagatorOptions =
typename propagator_t::template Options<Actions>;
153 PropagatorOptions options(geoCtx, magCtx);
156 actor.generator = &generator;
160 actor.initialParticle = particle;
162 Acts::BoundTrackParameters startPoint = Acts::BoundTrackParameters::createCurvilinear(
163 particle.fourPosition(), particle.direction(),
164 particle.qOverP(), std::nullopt, particle.hypothesis());
165 options.pathLimit =
pathLimit * Acts::UnitConstants::cm;
168 options.stepping.maxStepSize =
maxStepSize * Acts::UnitConstants::m;
169 options.direction = Acts::Direction::Forward();
171 auto result =
propagator.propagate(startPoint, options);
172 if (not result.ok()) {
173 return result.error();
195 ActsFatras::StandardChargedElectroMagneticInteractions;
198 ActsFatras::NoDecay>;
204 ActsFatras::NoDecay>;
228 const IInterface* parent);
236 const EventContext& ctx,
240 virtual StatusCode
setupEvent(
const EventContext&)
override {
244 return StatusCode::SUCCESS; };
246 std::vector<SiHitCollection> hitcolls;
251 return StatusCode::SUCCESS; };
264 if (!thandle.empty() && thandle.retrieve().isFailure()) {
266 return StatusCode::FAILURE;
268 return StatusCode::SUCCESS;
272 const Acts::GeometryContext& anygctx,
274 const Acts::BoundTrackParameters& startParameters,
275 Acts::Direction navDir = Acts::Direction::Forward(),
276 double pathLimit = std::numeric_limits<double>::max())
const;
282 "RandomEngineName",
"Name of random number stream"};
288 PublicToolHandle<ActsTrk::IExtrapolationTool>
m_extrapolationTool{
this,
"ExtrapolationTool",
"ActsExtrapolationTool"};
295 std::shared_ptr<const Acts::Logger>
m_logger{
nullptr};
299 this,
"ParticleFilter",
"",
"Particle filter kinematic cuts, etc."};
305 this,
"ActsFatrasWriteHandler",
"ActsFatrasWriteHandler"};
308 "Min pT of the interactions (MeV)"};
311 Gaudi::Property<bool>
m_meanEnergyLoss{
this,
"MeanEnergyLoss",
true,
"Toggle between mean and mode evaluation of energy loss"};
312 Gaudi::Property<bool>
m_includeGgradient{
this,
"IncludeGgradient",
true,
"Boolean flag for inclusion of d(dEds)d(q/p) into energy loss"};
313 Gaudi::Property<double>
m_momentumCutOff{
this,
"MomentumCutOff", 0.,
"Cut-off value for the momentum in SI units"};
315 Gaudi::Property<double>
m_maxStep{
this,
"MaxSteps", 2000,
316 "Max number of steps"};
318 "Maximum number of Runge-Kutta steps for the stepper step call"};
320 "Max step size (converted to Acts::UnitConstants::m)"};
322 "Track path limit (converted to Acts::UnitConstants::cm)"};
324 "Loop protection, it adapts the pathLimit"};
326 "Allowed loop fraction, 1 is a full loop"};
328 "Tolerance for the error of the integration"};
330 "Cut-off value for the step size"};
334 {{0,0}, {1,201}, {2,14}, {3,3}, {4,121}},
"proessType map <ActsFatras,G4>"};
#define ATH_CHECK
Evaluate an expression and check for errors.
AtlasHitsVector< SiHit > SiHitCollection
Define macros for attributes used to control the static checker.
A wrapper class for event-slot-local random engines.
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
The generic ISF particle definition,.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
The sim hit creator recieves a std::vector of Trk::TrackParameters and uses them to create simulated ...
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
constexpr double energyToAthena(const double actsE)
Converts an energy scalar from Acts to Athena units.
constexpr double lengthToAthena(const double actsL)
Converts a length scalar from Acts to Athena units.
Eigen::Matrix< double, 3, 1 > Vector3D
int SimulationFlavor
Identifier type for simulation flavor.
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
Single particle simulation with fixed propagator, interactions, and decay.
HitSurfaceSelector selectHitSurface
ChargedInteractions interactions
double maxRungeKuttaStepTrials
const Acts::Logger & logger() const
Provide access to the local logger instance, e.g. for logging macros.
Acts::Result< ActsFatras::SingleParticleSimulationResult > simulate(const Acts::GeometryContext &geoCtx, const Acts::MagneticFieldContext &magCtx, generator_t &generator, const ActsFatras::Particle &particle) const
Simulate a single particle without secondaries.
ChargedPropagator propagator
SingleParticleSimulation(propagator_t &&propagator_, std::shared_ptr< const Acts::Logger > localLogger_)
Alternatively construct the simulator with an external logger.
std::shared_ptr< const Acts::Logger > localLogger
ActsFatras::NoDecay decay