![]() |
|
|||
File indexing completed on 2025-02-21 09:29:26
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file accel/GeantSimpleCalo.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <memory> 0011 #include <string> 0012 #include <vector> 0013 0014 #include "corecel/io/OutputInterface.hh" 0015 #include "celeritas/Quantities.hh" 0016 0017 class G4LogicalVolume; 0018 class G4VSensitiveDetector; 0019 0020 namespace celeritas 0021 { 0022 //---------------------------------------------------------------------------// 0023 class SharedParams; 0024 namespace detail 0025 { 0026 struct GeantSimpleCaloStorage; 0027 } 0028 0029 //---------------------------------------------------------------------------// 0030 /*! 0031 * Manage a simple calorimeter sensitive detector across threads. 0032 * 0033 * The factory should be created in DetectorConstruction or 0034 * DetectorConstruction::Construct and added to the output parameters. Calling 0035 * \c MakeSensitiveDetector will emit a sensitive detector for the local thread 0036 * *and attach it* to the logical volumes on the local thread. 0037 */ 0038 class GeantSimpleCalo final : public OutputInterface 0039 { 0040 public: 0041 //!@{ 0042 //! \name Type aliases 0043 using SPConstParams = std::shared_ptr<SharedParams const>; 0044 using UPSensitiveDetector = std::unique_ptr<G4VSensitiveDetector>; 0045 using VecLV = std::vector<G4LogicalVolume*>; 0046 using VecReal = std::vector<double>; 0047 using EnergyUnits = units::Mev; 0048 //!@} 0049 0050 public: 0051 // Construct with SD name and the volumes to attach the SD to 0052 GeantSimpleCalo(std::string name, SPConstParams params, VecLV volumes); 0053 0054 // Emit a new detector for the local thread and attach to the stored LVs 0055 UPSensitiveDetector MakeSensitiveDetector(); 0056 0057 //! Get the list of volumes with this SD attached 0058 VecLV const& Volumes() const { return volumes_; } 0059 0060 // Get accumulated energy deposition over all threads 0061 VecReal CalcTotalEnergyDeposition() const; 0062 0063 //!@{ 0064 //! \name Output interface 0065 //! Category of data to write 0066 Category category() const final { return Category::result; } 0067 // Key for the entry inside the category 0068 std::string_view label() const final; 0069 // Write output to the given JSON object 0070 void output(JsonPimpl*) const final; 0071 //!@} 0072 0073 private: 0074 using SPStorage = std::shared_ptr<detail::GeantSimpleCaloStorage>; 0075 SPConstParams params_; 0076 VecLV volumes_; 0077 SPStorage storage_; 0078 }; 0079 0080 //---------------------------------------------------------------------------// 0081 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |