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/LETAccumulable.hh
0027 /// \brief Definition of the RadioBio::LETAccumulable class
0028 
0029 #ifndef RadiobiologyLETACCUMULABLE_HH
0030 #define RadiobiologyLETACCUMULABLE_HH
0031 
0032 #include "IonLet.hh"
0033 #include "VRadiobiologicalAccumulable.hh"
0034 #include <G4VAccumulable.hh>
0035 
0036 #include <valarray>
0037 #include <vector>
0038 
0039 namespace RadioBio
0040 {
0041 
0042 // Forward declariation of other radiobiology classes
0043 class Hit;
0044 class VoxelizedSensitiveDetector;
0045 
0046 /**
0047  * @brief Accumulable of LET-related data (that must be thread-local).
0048  *
0049  * It keeps the sum of alpha and beta numerators/denominator, as well as energy deposits.
0050  * The class is closely tied with the singLETon LET that is used both
0051  * to calculate alphas and betas, and also to store results.
0052  *
0053  * This is implemented as a customized G4VAccumulable with non-scalar data.
0054  *
0055  * @note There are two levels of merging (accumulation):
0056  *   1) From more threads in one run (G4VAccumulable merging is applied)
0057  *   2) (Optional) inter-run merging of data (implemented in LET).
0058  *
0059  * @note std::valarray is used (instead of C arrays or std::vectors)
0060  *    to accumulate data for its logical simplicity.
0061  */
0062 class LETAccumulable : public VRadiobiologicalAccumulable
0063 {
0064   public:
0065     LETAccumulable();
0066     LETAccumulable(const LETAccumulable& other) = default;
0067 
0068     // G4VAccumulable virtual methods to override
0069     void Merge(const G4VAccumulable& rhs) override;
0070     void Reset() override;
0071 
0072     // Store information from a single step
0073     void Accumulate(Hit* hit) override;
0074 
0075     // Type alias for numerical arrays
0076     using array_type = std::valarray<G4double>;
0077 
0078     // Access to stored data (to be called on the merged data)
0079     const array_type GetTotalLETT() const { return fTotalLETT; }
0080     const array_type GetTotalLETD() const { return fTotalLETD; }
0081     const array_type GetDTotalLETT() const { return fDTotalLETT; }
0082     const array_type GetDTotalLETD() const { return fDTotalLETD; }
0083 
0084     const std::vector<IonLet> GetIonLetStore() const { return fIonLetStore; }
0085 
0086     // Verbosity, shared with LET
0087     G4int GetVerboseLevel() const;
0088 
0089   private:
0090     // Apply configuration from the LET class and prepare matrices
0091     void Initialize();
0092     G4bool fInitialized{false};
0093 
0094     array_type fTotalLETT = {};
0095     array_type fTotalLETD = {};
0096     array_type fDTotalLETT = {};
0097     array_type fDTotalLETD = {};
0098 
0099     std::vector<IonLet> fIonLetStore = {};
0100 };
0101 
0102 }  // namespace RadioBio
0103 
0104 #endif  // LETACCUMULABLE_HH