Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-29 09:13:53

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 geocel/DetectorView.hh
0006 //! \sa DetectorParams.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "geocel/Types.hh"
0011 
0012 #include "DetectorData.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Access sensitive detector properties.
0019  */
0020 class DetectorView
0021 {
0022   public:
0023     //!@{
0024     //! \name Type aliases
0025     using ParamsRef = NativeCRef<DetectorParamsData>;
0026     //!@}
0027 
0028   public:
0029     // Construct with shared data
0030     explicit inline CELER_FUNCTION DetectorView(ParamsRef const& params);
0031 
0032     // Get the detector ID of a volume
0033     inline DetectorId CELER_FUNCTION detector_id(VolumeId vol_id) const;
0034 
0035   private:
0036     ParamsRef const& params_;
0037 };
0038 
0039 //---------------------------------------------------------------------------//
0040 /*!
0041  * Construct with shared data.
0042  */
0043 CELER_FUNCTION DetectorView::DetectorView(ParamsRef const& params)
0044     : params_(params)
0045 {
0046     CELER_EXPECT(params_);
0047 }
0048 
0049 //---------------------------------------------------------------------------//
0050 /*!
0051  * Get the detector ID of a volume.
0052  */
0053 CELER_FUNCTION DetectorId DetectorView::detector_id(VolumeId vol_id) const
0054 {
0055     return params_.detector_ids[vol_id];
0056 }
0057 
0058 //---------------------------------------------------------------------------//
0059 }  // namespace celeritas