Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:19

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file radiobiology/include/DoseAccumulable.hh
0027 /// \brief Definition of the RadioBio::DoseAccumulable class
0028 
0029 #ifndef RadiobiologyDoseACCUMULABLE_HH
0030 #define RadiobiologyDoseACCUMULABLE_HH
0031 
0032 #include "VRadiobiologicalAccumulable.hh"
0033 #include <G4VAccumulable.hh>
0034 
0035 #include <valarray>
0036 #include <vector>
0037 
0038 namespace RadioBio
0039 {
0040 
0041 // Forward declariation of other radiobiology classes
0042 class VoxelizedSensitiveDetector;
0043 
0044 /**
0045  * @brief Accumulable of Dose-related data (that must be thread-local).
0046  *
0047  * It keeps the energy deposit data divided in voxels for dose calculation
0048  *
0049  * This is implemented as a customized G4VAccumulable with non-scalar data.
0050  *
0051  * @note There are two levels of merging (accumulation):
0052  *   1) From more threads in one run (G4VAccumulable merging is applied)
0053  *   2) (Optional) inter-run merging of data (implemented in Dose).
0054  *
0055  * @note std::valarray is used (instead of C arrays or std::vectors)
0056  *    to accumulate data for its logical simplicity.
0057  */
0058 class DoseAccumulable : public VRadiobiologicalAccumulable
0059 {
0060   public:
0061     DoseAccumulable();
0062     DoseAccumulable(const DoseAccumulable& other) = default;
0063 
0064     // G4VAccumulable virtual methods to override
0065     void Merge(const G4VAccumulable& rhs) override;
0066     void Reset() override;
0067 
0068     // Store information from a single step
0069     void Accumulate(Hit* hit) override;
0070 
0071     // Type alias for numerical arrays
0072     using array_type = std::valarray<G4double>;
0073 
0074     // Access to stored data (to be called on the merged data)
0075     const array_type GetEnDeposit() const { return fEnDep; }
0076 
0077     // Verbosity, shared with Dose
0078     G4int GetVerboseLevel() const;
0079 
0080   private:
0081     // Apply configuration from the Dose class and prepare matrices
0082     void Initialize();
0083     G4bool fInitialized = false;
0084 
0085     array_type fEnDep;
0086 };
0087 
0088 }  // namespace RadioBio
0089 
0090 #endif  // DoseACCUMULABLE_HH