Back to home page

EIC code displayed by LXR

 
 

    


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

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 celeritas/io/EventData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <array>
0011 #include <map>
0012 #include <vector>
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Example of a calorimeter hit.
0019  */
0020 struct EventHitData
0021 {
0022     int volume{0};  //!< Logical volume ID
0023     int copy_num{0};  //!< Physical volume copy number
0024     double energy_dep{0};  //!< Energy deposition [MeV]
0025     double time{0};  //!< Pre-step global time [time]
0026 };
0027 
0028 //---------------------------------------------------------------------------//
0029 /*!
0030  * Event data to be used within a Geant4/Celeritas offloading application.
0031  *
0032  * The hits are designed to be assigned to each sensitive volume, so that a
0033  * vector of hits of a given volume can be retrieved by doing
0034  *
0035  * \code
0036  * auto const& sd_hits = event_data.hits[sensdet_id];
0037  * for (auto const& hit : sd_hits)
0038  * {
0039  *     // Access hit information from this given detector in this event.
0040  * }
0041  * \endcode
0042  *
0043  * Therefore, sensitive detector IDs must be contiguously assigned and mapped
0044  * to their sensitive detector name at startup.
0045  */
0046 struct EventData
0047 {
0048     int event_id{0};
0049     std::vector<std::vector<EventHitData>> hits;
0050 };
0051 
0052 //---------------------------------------------------------------------------//
0053 }  // namespace celeritas