Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:27

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 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 celeritas/optical/MaterialParams.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <vector>
0011 
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/CollectionMirror.hh"
0014 #include "corecel/data/ParamsDataInterface.hh"
0015 #include "celeritas/io/ImportOpticalMaterial.hh"
0016 
0017 #include "MaterialData.hh"
0018 
0019 namespace celeritas
0020 {
0021 struct ImportData;
0022 class MaterialParams;
0023 class GeoMaterialParams;
0024 
0025 namespace optical
0026 {
0027 
0028 //---------------------------------------------------------------------------//
0029 /*!
0030  * Manage properties for optical materials.
0031  *
0032  * Each "physics material" (the combination of a geometry-specified material
0033  * and a user-specified region) can map to a single optical material. Many
0034  * materials---especially those in mechanical structures and components not
0035  * optically connected to the detector---may have no optical properties at all.
0036  *
0037  * Optical volume properties are imported from Geant4 into the \c
0038  * ImportData container. The \c celeritas::MaterialParams class loads the
0039  * mapping of \c MaterialId to \c OpticalMaterialId and makes it accessible
0040  * via the main loop's material view. By combining that with the \c
0041  * GeoMaterialParams which maps volumes to \c MaterialId, this class maps the
0042  * geometry volumes to optical materials for use in the optical tracking loop.
0043  *
0044  * When surface models are implemented, surface properties will also be added
0045  * to this class.
0046  */
0047 class MaterialParams final : public ParamsDataInterface<MaterialParamsData>
0048 {
0049   public:
0050     struct Input
0051     {
0052         //! Shared optical material, indexed by \c OpticalMaterialId
0053         std::vector<ImportOpticalProperty> properties;
0054         //! Map logical volume ID to optical material ID
0055         std::vector<OpticalMaterialId> volume_to_mat;
0056     };
0057 
0058   public:
0059     // Construct with imported data, materials
0060     static std::shared_ptr<MaterialParams>
0061     from_import(ImportData const& data,
0062                 ::celeritas::GeoMaterialParams const& geo_mat,
0063                 ::celeritas::MaterialParams const& mat);
0064 
0065     // Construct with optical property data
0066     explicit MaterialParams(Input const& inp);
0067 
0068     //! Access optical material on the host
0069     HostRef const& host_ref() const final { return data_.host_ref(); }
0070 
0071     //! Access optical material on the device
0072     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0073 
0074   private:
0075     CollectionMirror<MaterialParamsData> data_;
0076 };
0077 
0078 //---------------------------------------------------------------------------//
0079 }  // namespace optical
0080 }  // namespace celeritas