forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScintillationParams.hh
81 lines (65 loc) · 2.74 KB
/
ScintillationParams.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//----------------------------------*-C++-*----------------------------------//
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/optical/ScintillationParams.hh
//---------------------------------------------------------------------------//
#pragma once
#include "corecel/Types.hh"
#include "corecel/data/CollectionMirror.hh"
#include "corecel/data/ParamsDataInterface.hh"
#include "celeritas/io/ImportOpticalMaterial.hh"
#include "ScintillationData.hh"
namespace celeritas
{
class ParticleParams;
struct ImportData;
//---------------------------------------------------------------------------//
/*!
* Build and manage scintillation data.
*/
class ScintillationParams final : public ParamsDataInterface<ScintillationData>
{
public:
//!@{
//! \name Type aliases
using SPConstParticles = std::shared_ptr<ParticleParams const>;
using ScintillationDataCRef = HostCRef<ScintillationData>;
//!@}
//! Scintillation data for all materials and particles
struct Input
{
using VecOptMatId = std::vector<OpticalMaterialId>;
using VecSPId = std::vector<ScintillationParticleId>;
VecSPId pid_to_scintpid; //!< ParticleId to ScintillationParticleId
std::vector<double> resolution_scale;
std::vector<ImportMaterialScintSpectrum> materials;
std::vector<ImportParticleScintSpectrum> particles;
explicit operator bool() const
{
return (pid_to_scintpid.empty() == particles.empty())
&& !resolution_scale.empty()
&& (materials.empty() != particles.empty());
}
};
public:
// Construct with imported data and particle params
static std::shared_ptr<ScintillationParams>
from_import(ImportData const& data, SPConstParticles particle_params);
// Construct with scintillation components
explicit ScintillationParams(Input const& input);
//! Access physics properties on the host
HostRef const& host_ref() const final { return mirror_.host_ref(); }
//! Access physics properties on the device
DeviceRef const& device_ref() const final { return mirror_.device_ref(); }
private:
// Host/device storage and reference
CollectionMirror<ScintillationData> mirror_;
//// HELPER FUNCTIONS ////
// Convert imported scintillation components to Celeritas' components
std::vector<ScintillationComponent>
build_components(std::vector<ImportScintComponent> const& input_comp);
};
//---------------------------------------------------------------------------//
} // namespace celeritas