Back to home page

EIC code displayed by LXR

 
 

    


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

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 G4PSTARStopping_h
0028 #define G4PSTARStopping_h 1
0029 
0030 //---------------------------------------------------------------------------
0031 //
0032 // ClassName:   G4PSTARStopping
0033 //
0034 // Description: Data on stopping power
0035 //
0036 // Author:      Anton Ivantchenko 18.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 from the NIST Data Base  
0049 // http://physics.nist.gov/PhysRefData/STAR/Text/PSTAR.html
0050 // 
0051 // Current PSTAR database is available via url:
0052 // http://physics.nist.gov/PhysRefData/Star/Text/PSTAR.html
0053 //
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 #include "globals.hh"
0058 #include "G4Material.hh"
0059 #include "G4PhysicsFreeVector.hh"
0060 #include <vector>
0061 
0062 class G4PSTARStopping 
0063 { 
0064 public: 
0065 
0066   explicit G4PSTARStopping();
0067 
0068   ~G4PSTARStopping();
0069 
0070   void Initialise();
0071 
0072   inline G4int GetIndex(const G4Material*) const;
0073 
0074   inline G4int GetIndex(const G4String&) const;
0075 
0076   inline G4double GetElectronicDEDX(G4int idx, G4double energy) const;
0077 
0078   inline G4double GetElectronicDEDX(const G4Material*, G4double energy) const;
0079 
0080   G4PSTARStopping & operator=(const  G4PSTARStopping &right) = delete;
0081   G4PSTARStopping(const  G4PSTARStopping&) = 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 G4PSTARStopping::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 G4PSTARStopping::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 G4PSTARStopping::GetElectronicDEDX(G4int idx, G4double energy) const
0129 {
0130   G4double res = 0.0;
0131   if (idx<0 || idx>= nvectors) { PrintWarning(idx); }
0132   else 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 G4PSTARStopping::GetElectronicDEDX(const G4Material* mat, G4double energy) const
0141 {
0142   return GetElectronicDEDX(GetIndex(mat), energy);
0143 }
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0146 
0147 #endif