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/RBE.hh
0027 /// \brief Definition of the RadioBio::RBE class
0028 
0029 #ifndef RadiobiologyRBE_H
0030 #define RadiobiologyRBE_H 1
0031 
0032 #include "globals.hh"
0033 
0034 #include "VRadiobiologicalQuantity.hh"
0035 
0036 #include <map>
0037 #include <valarray>
0038 #include <vector>
0039 
0040 namespace RadioBio
0041 {
0042 
0043 // Forward declariation of other radiobiology classes
0044 class DetectorConstruction;
0045 class RBEAccumulable;
0046 class RBEMessenger;
0047 class VoxelizedSensitiveDetector;
0048 
0049 class RBE : public VRadiobiologicalQuantity
0050 {
0051   public:
0052     RBE();
0053     ~RBE();
0054 
0055     // Initialization of data from a CSV file
0056     void LoadLEMTable(G4String path);
0057 
0058     // Select the cell and update the pointer
0059     void SetCellLine(G4String name);
0060 
0061     // Calculate alpha and beta for single deposition, {0,0} if not applicable
0062     std::tuple<G4double, G4double> GetHitAlphaAndBeta(G4double E, G4int Z);
0063 
0064     // Virtual methods to override
0065     void AddFromAccumulable(G4VAccumulable*) override;
0066     void Initialize() override;
0067     void Compute() override;
0068     void Reset() override;
0069     void Store() override;
0070     void PrintParameters() override;
0071 
0072   private:
0073     // Calculation
0074     void ComputeAlphaAndBeta();
0075     void ComputeRBE();
0076 
0077     // Output to text files (called at the end of run)
0078     void StoreAlphaAndBeta();
0079     void StoreRBE();
0080 
0081     // Update the class with accumulated data
0082     // (To be used for accumulation)
0083     void SetAlphaNumerator(const array_type alpha);
0084     void SetBetaNumerator(const array_type beta);
0085     void SetDenominator(const array_type denom);
0086 
0087     // Accumulation variants necessary for multi-run sumation
0088     void AddAlphaNumerator(const array_type alpha);
0089     void AddBetaNumerator(const array_type beta);
0090     void AddDenominator(const array_type denom);
0091 
0092     // Method to copy dose from the proper Radiobiological Quantity
0093     void GetDose();
0094 
0095     // Parameters for calculation
0096     G4double fAlphaX = 0.;
0097     G4double fBetaX = 0.;
0098     G4double fDoseCut = 0.;
0099 
0100     // Matrices to be set when accumulated
0101     array_type fAlpha = {};
0102     array_type fBeta = {};
0103     array_type fDose = {};  // Note: this is copied from calculation in Dose
0104 
0105     array_type fAlphaNumerator = {};
0106     array_type fBetaNumerator = {};
0107     array_type fDenominator = {};
0108 
0109     // Matrices of calculated values
0110     array_type fLnS = {};
0111     array_type fSurvival = {};
0112     array_type fDoseX = {};
0113     array_type fRBE = {};
0114 
0115     // Available tables and associated values.
0116     using vector_type = std::map<G4int, std::vector<G4double>>;
0117     std::map<G4String, vector_type> fTablesEnergy = {};
0118     std::map<G4String, vector_type> fTablesAlpha = {};
0119     std::map<G4String, vector_type> fTablesBeta = {};
0120     std::map<G4String, G4double> fTablesAlphaX = {};
0121     std::map<G4String, G4double> fTablesBetaX = {};
0122     std::map<G4String, G4double> fTablesDoseCut = {};
0123 
0124     // Selected tables and associated values.
0125     // (changed when the cell line is set)
0126     G4String fActiveCellLine;
0127     vector_type* fActiveTableEnergy = nullptr;
0128     vector_type* fActiveTableAlpha = nullptr;
0129     vector_type* fActiveTableBeta = nullptr;
0130     std::map<G4int, G4double> fMaxEnergies = {};
0131     std::map<G4int, G4double> fMinEnergies = {};
0132     G4int fMinZ = -1;
0133     G4int fMaxZ = -1;
0134 };
0135 
0136 }  // namespace RadioBio
0137 
0138 #endif