Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:25

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 
0027 #ifndef G4ICRU90StoppingData_h
0028 #define G4ICRU90StoppingData_h 1
0029 
0030 //----------------------------------------------------------------------
0031 //
0032 // File name:    G4ICRU90StoppingData
0033 //
0034 // Description:  Data on electroninc stopping power from ICRU 90
0035 //
0036 // Author:       Lucas Norberto Burigo
0037 //
0038 // Creation date: 03.09.2018
0039 //
0040 // Modifications: 25.09.2018 V.Ivanchenko adopted for material sub-library
0041 //
0042 //----------------------------------------------------------------------------
0043 //
0044 // Class Description:
0045 //
0046 // Data on electonic stopping powers from ICRU 90 report
0047 //
0048 //
0049 
0050 #include "G4Material.hh"
0051 #include "G4PhysicsFreeVector.hh"
0052 #include "globals.hh"
0053 
0054 class G4ICRU90StoppingData
0055 {
0056  public:
0057 
0058   G4ICRU90StoppingData();
0059 
0060   ~G4ICRU90StoppingData();
0061 
0062   // hide assignment operator
0063   G4ICRU90StoppingData& operator=(const G4ICRU90StoppingData& right) = delete;
0064   G4ICRU90StoppingData(const G4ICRU90StoppingData&) = delete;
0065 
0066   void Initialise();
0067 
0068   G4double GetElectronicDEDXforProton(const G4Material*, G4double kinEnergy) const;
0069 
0070   G4double GetElectronicDEDXforAlpha(const G4Material*, G4double scaledKinEnergy) const;
0071 
0072   inline G4int GetIndex(const G4Material*) const;
0073 
0074   inline G4int GetIndex(const G4String&) const;
0075 
0076   inline G4double GetElectronicDEDXforProton(G4int idx, G4double kinEnergy) const;
0077 
0078   inline G4double GetElectronicDEDXforAlpha(G4int idx, G4double scaledKinEnergy) const;
0079 
0080   inline G4bool IsApplicable(const G4Material*) const;
0081 
0082  private:
0083 
0084   inline G4double GetDEDX(const G4PhysicsFreeVector*, G4double e) const;
0085 
0086   void FillData();
0087 
0088   G4PhysicsFreeVector* AddData(G4int n, const G4float* e, const G4float* dedx);
0089 
0090   static constexpr G4int nvectors = 3;
0091   const G4Material* materials[nvectors];
0092   G4PhysicsFreeVector* sdata_proton[nvectors];
0093   G4PhysicsFreeVector* sdata_alpha[nvectors];
0094   G4bool isInitialized{false};
0095 };
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 inline G4bool G4ICRU90StoppingData::IsApplicable(const G4Material* mat) const
0100 {
0101   return (mat == materials[1] || mat == materials[0] || mat == materials[2]);
0102 }
0103 
0104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0105 
0106 inline G4int G4ICRU90StoppingData::GetIndex(const G4Material* mat) const
0107 {
0108   G4int idx = -1;
0109   if (mat == materials[1]) {
0110     idx = 1;
0111   }
0112   else if (mat == materials[0]) {
0113     idx = 0;
0114   }
0115   else if (mat == materials[2]) {
0116     idx = 2;
0117   }
0118   return idx;
0119 }
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 inline G4int G4ICRU90StoppingData::GetIndex(const G4String& nam) const
0124 {
0125   G4int idx = -1;
0126   if (nam == materials[1]->GetName()) {
0127     idx = 1;
0128   }
0129   else if (nam == materials[0]->GetName()) {
0130     idx = 0;
0131   }
0132   else if (nam == materials[2]->GetName()) {
0133     idx = 2;
0134   }
0135   return idx;
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0139 
0140 inline G4double G4ICRU90StoppingData::GetDEDX(const G4PhysicsFreeVector* data,
0141                                               G4double e) const
0142 {
0143   const G4double emin = data->Energy(0);
0144   return (e >= emin) ? data->Value(e) : (*data)[0] * std::sqrt(e / emin);
0145 }
0146 
0147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0148 
0149 inline G4double G4ICRU90StoppingData::GetElectronicDEDXforProton(
0150   G4int idx, G4double kinEnergy) const
0151 {
0152   return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_proton[idx], kinEnergy) : 0.0;
0153 }
0154 
0155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0156 
0157 inline G4double G4ICRU90StoppingData::GetElectronicDEDXforAlpha(
0158   G4int idx, G4double scaledKinEnergy) const
0159 {
0160   return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_alpha[idx], scaledKinEnergy) : 0.0;
0161 }
0162 
0163 #endif