Back to home page

EIC code displayed by LXR

 
 

    


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

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 // GEANT4 class header file
0028 //
0029 // Class:                G4ExtDEDXTable
0030 //
0031 // Base class:           G4VIonDEDXTable
0032 //
0033 // Author:               Anton Lechner (Anton.Lechner@cern.ch)
0034 //
0035 // First implementation: 29. 02. 2009
0036 //
0037 // Modifications:
0038 // 03.11.2009 A. Lechner:  Added new methods BuildPhysicsVector according
0039 //            to interface changes in base class G4VIonDEDXTable.
0040 //
0041 //
0042 // Class description:
0043 //    Utility class for users to add their own electronic stopping powers
0044 //    for ions. This class is dedicated for use with G4IonParametrisedLossModel
0045 //    of the low-energy electromagnetic package.
0046 //
0047 // Comments:
0048 //
0049 // ===========================================================================
0050 
0051 #ifndef G4EXTDEDXTABLE_HH
0052 #define G4EXTDEDXTABLE_HH
0053 
0054 #include "G4VIonDEDXTable.hh"
0055 #include "globals.hh"
0056 
0057 #include <map>
0058 #include <utility>
0059 #include <vector>
0060 
0061 class G4ExtDEDXTable : public G4VIonDEDXTable
0062 {
0063  public:
0064   explicit G4ExtDEDXTable() = default;
0065   ~G4ExtDEDXTable() override;
0066   G4ExtDEDXTable(G4ExtDEDXTable&) = delete;
0067   const G4ExtDEDXTable& operator=(const G4ExtDEDXTable&) = delete;
0068 
0069   G4bool BuildPhysicsVector(G4int ionZ, const G4String& matName) override;
0070 
0071   G4bool BuildPhysicsVector(G4int ionZ, G4int matZ) override;
0072 
0073   // Function for checking the availability of stopping power tables
0074   // for a given ion-material couple, where the material consists of
0075   // a single element only.
0076   G4bool IsApplicable(G4int atomicNumberIon,  // Atomic number of ion
0077     G4int atomicNumberElem  // Atomic number of elemental material
0078     ) override;
0079 
0080   // Function for checking the availability of stopping power tables
0081   // for given ion-material couples.
0082   G4bool IsApplicable(G4int atomicNumberIon,  // Atomic number of ion
0083     const G4String& matIdentifier  // Name or chemical formula of material
0084     ) override;
0085 
0086   // Function returning the stopping power vector for given ion-material
0087   // couples, where the material consists of a single element only.
0088   G4PhysicsVector* GetPhysicsVector(G4int atomicNumberIon,  // Atomic number of ion
0089     G4int atomicNumberElem  // Atomic number of elemental material
0090     ) override;
0091 
0092   // Function returning the stopping power vector for given ion-material
0093   // couples.
0094   G4PhysicsVector* GetPhysicsVector(G4int atomicNumberIon,  // Atomic number of ion
0095     const G4String& matIdenfier  // Name or chemical formula of material
0096     ) override;
0097 
0098   // Function returning the stopping power value for given ion-material
0099   // couples, where the material consists of a single element only, and
0100   // given energy.
0101   G4double GetDEDX(G4double kinEnergyPerNucleon,  // Kinetic energy per nucleon
0102     G4int atomicNumberIon,  // Atomic number of ion
0103     G4int atomicNumberElem  // Atomic number of elemental material
0104   );
0105 
0106   // Function returning the stopping power value for given ion-material
0107   // couples and given energy.
0108   G4double GetDEDX(G4double kinEnergyPerNucleon,  // Kinetic energy per nucleon
0109     G4int atomicNumberIon,  // Atomic number of ion
0110     const G4String& matIdenfier  // Name or chemical formula of material
0111   );
0112 
0113   // Function for adding dE/dx vector for an elemental materials. The last
0114   // argument only applies to elemental materials.
0115   G4bool AddPhysicsVector(G4PhysicsVector* physicsVector,  // Physics vector
0116     G4int atomicNumberIon,  // Atomic number of ion
0117     const G4String& matIdenfier,  // Name or chemical formula of material
0118     G4int atomicNumberElem = 0  // Atomic number of elemental material
0119   );
0120 
0121   // Function for removing dE/dx vector for a compound materials
0122   G4bool RemovePhysicsVector(G4int atomicNumberIon,  // Atomic number of ion
0123     const G4String& matIdentifier  // Name or chemical formula of material
0124   );
0125 
0126   // Function writing all stopping power vectors to file
0127   G4bool StorePhysicsTable(const G4String& fileName  // File name
0128   );
0129 
0130   // Function retrieving all stopping power vectors from file
0131   G4bool RetrievePhysicsTable(const G4String& fileName  // File name
0132   );
0133 
0134   // Function deleting all physics vectors and clearing the maps
0135   void ClearTable();
0136 
0137   // Function printing the ion-material pairs of available vectors to stdout
0138   void DumpMap();
0139 
0140  private:
0141   G4PhysicsVector* CreatePhysicsVector(G4int vectorType);
0142 
0143   G4int FindAtomicNumberElement(G4PhysicsVector* physicsVector);
0144 
0145   using G4IonDEDXKeyElem = std::pair<G4int, G4int>;
0146   using G4IonDEDXKeyMat = std::pair<G4int, G4String>;
0147 
0148   using G4IonDEDXMapElem = std::map<G4IonDEDXKeyElem, G4PhysicsVector*>;
0149   using G4IonDEDXMapMat = std::map<G4IonDEDXKeyMat, G4PhysicsVector*>;
0150 
0151   G4IonDEDXMapElem dedxMapElements;
0152   G4IonDEDXMapMat dedxMapMaterials;
0153 };
0154 
0155 #endif  // G4EXTDEDXTABLE_HH