Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:56

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 G4ASTARStopping_h
0028 #define G4ASTARStopping_h 1
0029 
0030 //---------------------------------------------------------------------------
0031 //
0032 // ClassName:   G4ASTARStopping
0033 //
0034 // Description: Data on stopping power
0035 //
0036 // Author:      Anton Ivantchenko 21.04.2006
0037 //
0038 // Organisation:        QinetiQ Ltd, UK
0039 // Customer:            ESA/ESTEC, NOORDWIJK
0040 // Contract:            CSMAN-5288
0041 //
0042 // Modifications:
0043 // 
0044 //----------------------------------------------------------------------------
0045 //
0046 // Class Description:
0047 //
0048 // Data on Stopping Powers of the He atoms from the NIST Data Base  
0049 // http://physics.nist.gov/PhysRefData/STAR/Text/ASTAR.html
0050 //
0051 // Current ASTAR database is available via url:
0052 // http://physics.nist.gov/PhysRefData/Star/Text/ASTAR.html
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 #include "globals.hh"
0057 #include "G4Material.hh"
0058 #include "G4PhysicsFreeVector.hh"
0059 #include <vector>
0060 
0061 class G4ASTARStopping 
0062 { 
0063 public: 
0064 
0065   explicit G4ASTARStopping();
0066 
0067   ~G4ASTARStopping();
0068 
0069   void Initialise();
0070 
0071   inline G4int GetIndex(const G4Material*) const;
0072 
0073   inline G4int GetIndex(const G4String&) const;
0074 
0075   inline G4double GetElectronicDEDX(G4int idx, G4double energy) const;
0076 
0077   inline G4double GetElectronicDEDX(const G4Material*, G4double energy) const;
0078 
0079   // hide assignment operator
0080   G4ASTARStopping & operator=(const G4ASTARStopping &right) = delete;
0081   G4ASTARStopping(const  G4ASTARStopping&) = delete;
0082 
0083 private:
0084 
0085   void AddData(const G4float* ss, const G4Material*);
0086 
0087   void FindData(G4int idx, const G4Material*);
0088 
0089   void PrintWarning(G4int idx) const;
0090 
0091   G4int nvectors;
0092   G4double emin;
0093   std::vector<const G4Material*> materials;
0094   std::vector<G4PhysicsFreeVector*> sdata;
0095 };
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 inline G4int G4ASTARStopping::GetIndex(const G4Material* mat) const
0100 {  
0101   G4int idx = -1;
0102   for (G4int i=0; i<nvectors; ++i) {
0103     if (mat == materials[i]) {
0104       idx = i;
0105       break;
0106     }
0107   }
0108   return idx;
0109 }
0110 
0111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0112 
0113 inline G4int G4ASTARStopping::GetIndex(const G4String& nam) const
0114 {
0115   G4int idx = -1;
0116   for (G4int i=0; i<nvectors; ++i) {
0117     if (nam == materials[i]->GetName()) {
0118       idx = i;
0119       break;
0120     }
0121   }
0122   return idx;
0123 }
0124 
0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0126 
0127 inline G4double 
0128 G4ASTARStopping::GetElectronicDEDX(G4int idx, G4double energy) const
0129 {
0130   G4double res = 0.0;
0131   if (idx<0 || idx >= nvectors) { PrintWarning(idx); }
0132   if(energy < emin) { res = (*(sdata[idx]))[0]*std::sqrt(energy/emin); } 
0133   else              { res = sdata[idx]->Value(energy); }
0134   return res;
0135 }
0136 
0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0138 
0139 inline G4double 
0140 G4ASTARStopping::GetElectronicDEDX(const G4Material* mat, G4double energy) const
0141 {
0142   return GetElectronicDEDX(GetIndex(mat), energy);
0143 }
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0146 
0147 #endif