Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-11 09:22:04

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 // File name:     G4EmDataHandler
0032 //
0033 // Author:        V. Ivanchenko 
0034 // 
0035 // Creation date: 16 August 2016
0036 //
0037 // Modifications: 
0038 //
0039 // Class Description: 
0040 //
0041 // A storage of G4PhysicsTable
0042 //
0043 // Class Description: End 
0044 
0045 // -------------------------------------------------------------------
0046 //
0047 
0048 #ifndef G4EmDataHandler_h
0049 #define G4EmDataHandler_h 1
0050 
0051 #include <vector>
0052 
0053 #include "globals.hh"
0054 #include "G4PhysicsTable.hh"
0055 #include "G4PhysicsVector.hh"
0056 #include "G4EmTableType.hh"
0057 #include "G4EmElementSelector.hh"
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0060 
0061 class G4ParticleDefinition;
0062 class G4VEmProcess;
0063 class G4VEnergyLossProcess;
0064 class G4EmDataRegistry;
0065 
0066 class G4EmDataHandler
0067 {
0068 public:
0069 
0070   explicit G4EmDataHandler(std::size_t nTable, const G4String& nam="");
0071 
0072   ~G4EmDataHandler();
0073 
0074   // update existing table
0075   void UpdateTable(G4PhysicsTable*, std::size_t idx);
0076 
0077   // assuming that the table is already defined
0078   G4PhysicsTable* MakeTable(std::size_t idx);
0079 
0080   // existing table may be substituted
0081   G4PhysicsTable* MakeTable(G4PhysicsTable*, std::size_t idx);
0082 
0083   // clean existing table 
0084   void CleanTable(std::size_t idx);
0085 
0086   G4bool StorePhysicsTable(std::size_t idx,
0087                            const G4ParticleDefinition* part,
0088                const G4String& fname, 
0089                G4bool ascii);
0090 
0091   G4bool RetrievePhysicsTable(std::size_t idx,
0092                   const G4ParticleDefinition* part,
0093                   const G4String& fname,
0094                   G4bool ascii, G4bool spline);
0095   
0096   void SetMasterProcess(const G4VEmProcess*);
0097 
0098   const G4VEmProcess* GetMasterProcess(size_t idx) const;
0099 
0100   const G4PhysicsTable* GetTable(std::size_t idx) const { 
0101     return (idx < tLength) ? data[idx] : nullptr; 
0102   }
0103 
0104   G4PhysicsTable* Table(std::size_t idx) const {
0105     return (idx < tLength) ? data[idx] : nullptr; 
0106   }
0107 
0108   const G4PhysicsVector* GetVector(std::size_t itable, std::size_t ivec) const {
0109     return (*(data[itable]))[ivec];
0110   }
0111 
0112   const std::vector<G4PhysicsTable*>& GetTables() const {
0113     return data;
0114   }
0115 
0116   std::vector<G4double>* EnergyOfCrossSectionMax() const {
0117     return fMaxXS;
0118   }
0119 
0120   void SetEnergyOfCrossSectionMax(std::vector<G4double>* p) {
0121     if (p != fMaxXS) {
0122       delete fMaxXS;
0123       fMaxXS = p;
0124     }
0125   }
0126 
0127   std::vector<G4TwoPeaksXS*>* TwoPeaksXS() const {
0128     return fXSpeaks;
0129   }
0130 
0131   void SetTwoPeaksXS(std::vector<G4TwoPeaksXS*>* p) {
0132     if (p != fXSpeaks) {
0133       delete fXSpeaks;
0134       fXSpeaks = p;
0135     }
0136   }
0137 
0138   std::vector<G4EmElementSelector*>* GetElementSelectors(std::size_t i) {
0139     return (i < eLength) ? fElemSelectors[i] : nullptr;
0140   }
0141   
0142   void SetElementSelectors(std::vector<G4EmElementSelector*>*, std::size_t);
0143 
0144   G4CrossSectionType CrossSectionType() const {
0145     return fXSType;
0146   }
0147 
0148   void SetCrossSectionType(G4CrossSectionType val) {
0149     fXSType = val; 
0150   }
0151 
0152   const G4String& GetName() const {
0153     return fName;
0154   }
0155 
0156   void SetUseBaseParticleTable(G4bool val) {
0157     fUseBaseParticleTable = val;
0158   }
0159   
0160   // hide assignment operator 
0161   G4EmDataHandler & operator=(const G4EmDataHandler &right) = delete;
0162   G4EmDataHandler(const G4EmDataHandler&) = delete;
0163 
0164 private:
0165 
0166   G4EmDataRegistry* fRegistry;
0167   std::vector<G4PhysicsTable*> data;
0168   std::vector<G4double>* fMaxXS;
0169   std::vector<G4TwoPeaksXS*>* fXSpeaks;
0170   std::vector<std::vector<G4EmElementSelector*>* > fElemSelectors;
0171   std::vector<const G4VEmProcess*> masterProcess;
0172   std::size_t tLength{0};
0173   std::size_t eLength{0};
0174   G4CrossSectionType fXSType{fEmNoIntegral};
0175   G4bool fUseBaseParticleTable{false};
0176   G4String fName;
0177 };
0178 
0179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0180 
0181 #endif
0182