Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:28

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/user/StepCollector.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <vector>
0011 
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/geo/GeoFwd.hh"
0014 
0015 #include "StepInterface.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 class ActionRegistry;
0021 class AuxParamsRegistry;
0022 class CoreParams;
0023 
0024 namespace detail
0025 {
0026 template<StepPoint P>
0027 class StepGatherAction;
0028 class StepParams;
0029 }  // namespace detail
0030 
0031 //---------------------------------------------------------------------------//
0032 /*!
0033  * Gather and transfer track states at each step.
0034  *
0035  * This defines the interface to set up and manage a generic class for
0036  * interfacing with the GPU track states at the beginning and/or end of every
0037  * step.
0038  *
0039  * \todo The step collector serves two purposes: supporting "sensitive
0040  * detectors" (mapping volume IDs to detector IDs and ignoring unmapped
0041  * volumes) and supporting unfiltered output for "MC truth" . Right now only
0042  * one or the other can be used, not both.
0043  *
0044  * \todo Like the optical collector, this class is not used after it's created:
0045  * it just serves to create helper classes. Perhaps move to the \c setup
0046  * namespace?
0047  */
0048 class StepCollector
0049 {
0050   public:
0051     //!@{
0052     //! \name Type aliases
0053     using SPStepInterface = std::shared_ptr<StepInterface>;
0054     using SPConstGeo = std::shared_ptr<GeoParams const>;
0055     using VecInterface = std::vector<SPStepInterface>;
0056     //!@}
0057 
0058   public:
0059     // Construct and add to core params
0060     static std::shared_ptr<StepCollector>
0061     make_and_insert(CoreParams const& core, VecInterface callbacks);
0062 
0063     // Construct with options and register pre/post-step actions
0064     StepCollector(SPConstGeo geo,
0065                   VecInterface&& callbacks,
0066                   AuxParamsRegistry* aux_registry,
0067                   ActionRegistry* action_registry);
0068 
0069     // See which data are being gathered
0070     StepSelection const& selection() const;
0071 
0072   private:
0073     template<StepPoint P>
0074     using SPStepGatherAction = std::shared_ptr<detail::StepGatherAction<P>>;
0075 
0076     std::shared_ptr<detail::StepParams> params_;
0077     SPStepGatherAction<StepPoint::pre> pre_action_;
0078     SPStepGatherAction<StepPoint::post> post_action_;
0079 };
0080 
0081 //---------------------------------------------------------------------------//
0082 }  // namespace celeritas