Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0028 // ===========================================================================
0029 // GEANT4 class header file
0030 //
0031 // Class:                G4IonDEDXScalingICRU73
0032 //
0033 // Base class:           G4VIonDEDXScalingAlgorithm
0034 //
0035 // Author:               Anton Lechner (Anton.Lechner@cern.ch)
0036 //
0037 // First implementation: 10. 05. 2009
0038 //
0039 // Modifications: 12. 11. 2009 - Moved all decision logic concerning ICRU 73
0040 //                               scaling for heavy ions into this class.
0041 //                               Adapting ScalingFactorEnergy class according
0042 //                               to changes in base class (AL).
0043 //
0044 // Class description:
0045 //    dE/dx scaling algorithm applied on top of ICRU 73 data (for ions not
0046 //    covered by the ICRU 73 report) 
0047 //
0048 // Comments:
0049 //
0050 // =========================================================================== 
0051 
0052 #ifndef G4IONDEDXSCALINGICRU73_HH
0053 #define G4IONDEDXSCALINGICRU73_HH
0054 
0055 #include "globals.hh"
0056 #include "G4VIonDEDXScalingAlgorithm.hh"
0057 #include "G4Material.hh"
0058 #include "G4ParticleDefinition.hh"
0059 #include <vector>
0060 #include "G4Exp.hh"
0061 
0062 class G4IonDEDXScalingICRU73 : public G4VIonDEDXScalingAlgorithm {
0063 
0064  public:
0065   explicit G4IonDEDXScalingICRU73(G4int minAtomicNumberIon = 19,
0066                   G4int maxAtomicNumberIon = 102);
0067   ~G4IonDEDXScalingICRU73();
0068 
0069   // Function for scaling the kinetic energy (no scaling by default).
0070   // Returns scaling factor for a given ion.
0071   G4double ScalingFactorEnergy(
0072              const G4ParticleDefinition* particle,     // Projectile (ion) 
0073              const G4Material* material) override;              // Target material
0074                                                          
0075 
0076    // Function for scaling the dE/dx value (no scaling by default).
0077    // Returns scaling factor for a given ion-material couple and
0078    // a given kinetic energy.
0079    G4double ScalingFactorDEDX(
0080              const G4ParticleDefinition* particle,     // Projectile (ion) 
0081              const G4Material*,                        // Target material
0082              G4double kineticEnergy) override;                  // Kinetic energy
0083 
0084 
0085    // Function for defining a base particle for dE/dx calculation.
0086    // (no base particle by default). Returns atomic number of base
0087    // particle.
0088    G4int AtomicNumberBaseIon(
0089              G4int atomicNumberIon,           // Atomic number of ion 
0090              const G4Material*) override;              // Target material
0091 
0092  private:
0093    void UpdateCacheParticle(
0094              const G4ParticleDefinition* particle);    // Projectile (ion) 
0095 
0096    void UpdateCacheMaterial(
0097              const G4Material* material);              // Target material 
0098 
0099    void CreateReferenceParticles();
0100  
0101    G4double EquilibriumCharge(
0102              G4double mass,                            // Ion mass
0103              G4double charge,                          // Ion charge
0104              G4double atomicNumberPow,                 // Power of atomic nmb  
0105              G4double kineticEnergy);                  // Kinetic energy
0106 
0107    // Scaling is only applied for ions with atomic numbers in the range
0108    // defined by the following parameters:
0109    G4int minAtomicNumber;
0110    G4int maxAtomicNumber;
0111 
0112    G4bool referencePrepared;
0113 
0114    // Some properties of reference particle (Fe) are stored for faster access
0115    ///////////////////////////G4ParticleDefinition* referenceFe; 
0116    G4int atomicNumberRefFe;
0117    G4int massNumberRefFe;
0118    G4double atomicNumberRefPow23Fe;
0119    G4double chargeRefFe;
0120    G4double massRefFe;
0121 
0122    // Some properties of reference particle (Ar) are stored for faster access
0123    ///////////////////////////G4ParticleDefinition* referenceAr; 
0124    G4int atomicNumberRefAr;
0125    G4int massNumberRefAr;
0126    G4double atomicNumberRefPow23Ar;
0127    G4double chargeRefAr;
0128    G4double massRefAr;
0129 
0130    // Flag indicating the use of Fe ions as reference particles
0131    G4bool useFe;
0132 
0133    // Some properties of projectiles are stored for faster access
0134    const G4ParticleDefinition* cacheParticle;
0135    G4int cacheMassNumber;
0136    G4int cacheAtomicNumber;
0137    G4double cacheAtomicNumberPow23;
0138    G4double cacheCharge;
0139    G4double cacheMass;
0140 
0141    // Material pointer
0142    const G4Material* cacheMaterial;
0143 };
0144 
0145 // ###########################################################################
0146 
0147 inline void G4IonDEDXScalingICRU73::UpdateCacheParticle (
0148             const G4ParticleDefinition* particle) {   // Projectile (ion) 
0149 
0150   if(particle != cacheParticle) {
0151 
0152      cacheParticle = particle;
0153      cacheAtomicNumber = particle -> GetAtomicNumber();
0154      cacheMassNumber = particle -> GetAtomicMass();
0155      cacheCharge = particle -> GetPDGCharge();
0156      cacheMass = particle -> GetPDGMass();
0157      cacheAtomicNumberPow23 = std::pow(G4double(cacheAtomicNumber), 2./3.);
0158   }
0159 }
0160 
0161 // ###########################################################################
0162 
0163 inline void G4IonDEDXScalingICRU73::UpdateCacheMaterial (
0164             const G4Material* material) {            // Target material
0165 
0166   if(cacheMaterial != material) {
0167 
0168      cacheMaterial = material;
0169 
0170      useFe = true;
0171 
0172      size_t nmbElements = material -> GetNumberOfElements();
0173      if( nmbElements > 1 ) useFe = false;
0174 
0175      if( material -> GetName() == "G4_WATER" ) useFe = true;   
0176   }
0177 }
0178 
0179 // ###########################################################################
0180 
0181 inline G4double G4IonDEDXScalingICRU73::EquilibriumCharge(
0182                                     G4double mass, 
0183                                     G4double charge,
0184                                     G4double atomicNumberPow, 
0185                                     G4double kineticEnergy) {
0186 
0187   G4double totalEnergy  = kineticEnergy + mass;
0188   G4double betaSquared  = kineticEnergy * 
0189                   (totalEnergy + mass) / (totalEnergy * totalEnergy);
0190 
0191   G4double beta = std::sqrt( betaSquared );
0192 
0193   G4double velOverBohrVel = beta / CLHEP::fine_structure_const;
0194 
0195   G4double q1 = 1.0 - G4Exp(-velOverBohrVel / atomicNumberPow);
0196  
0197   return q1 * charge;
0198 }
0199 
0200 // ###########################################################################
0201 
0202 #endif