File indexing completed on 2025-10-30 08:41:34
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 
0036 
0037 
0038 
0039 
0040 
0041 
0042 
0043 
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 
0060 
0061 class G4ParticleDefinition;
0062 class G4VEmProcess;
0063 class G4VEnergyLossProcess;
0064 
0065 class G4EmDataHandler
0066 {
0067 public:
0068 
0069   explicit G4EmDataHandler(std::size_t nTable, const G4String& nam="");
0070 
0071   ~G4EmDataHandler();
0072 
0073   
0074   std::size_t SetTable(G4PhysicsTable*);
0075 
0076   
0077   void UpdateTable(G4PhysicsTable*, std::size_t idx);
0078 
0079   
0080   void SaveTable(G4PhysicsTable*, std::size_t idx);
0081 
0082   
0083   G4PhysicsTable* MakeTable(std::size_t idx);
0084 
0085   
0086   G4PhysicsTable* MakeTable(G4PhysicsTable*, std::size_t idx);
0087 
0088   
0089   void CleanTable(std::size_t idx);
0090 
0091   G4bool StorePhysicsTable(std::size_t idx,
0092                            const G4ParticleDefinition* part,
0093                const G4String& fname, 
0094                G4bool ascii);
0095 
0096   G4bool RetrievePhysicsTable(std::size_t idx,
0097                   const G4ParticleDefinition* part,
0098                   const G4String& fname,
0099                   G4bool ascii, G4bool spline);
0100   
0101   void SetMasterProcess(const G4VEmProcess*);
0102 
0103   const G4VEmProcess* GetMasterProcess(size_t idx) const;
0104 
0105   const G4PhysicsTable* GetTable(std::size_t idx) const { 
0106     return (idx < tLength) ? data[idx] : nullptr; 
0107   }
0108 
0109   G4PhysicsTable* Table(std::size_t idx) const {
0110     return (idx < tLength) ? data[idx] : nullptr; 
0111   }
0112 
0113   const G4PhysicsVector* GetVector(std::size_t itable, std::size_t ivec) const {
0114     return (*(data[itable]))[ivec];
0115   }
0116 
0117   const std::vector<G4PhysicsTable*>& GetTables() const {
0118     return data;
0119   }
0120 
0121   std::vector<G4double>* EnergyOfCrossSectionMax() const {
0122     return fMaxXS;
0123   }
0124 
0125   void SetEnergyOfCrossSectionMax(std::vector<G4double>* p) {
0126     if (p != fMaxXS) {
0127       delete fMaxXS;
0128       fMaxXS = p;
0129     }
0130   }
0131 
0132   std::vector<G4TwoPeaksXS*>* TwoPeaksXS() const {
0133     return fXSpeaks;
0134   }
0135 
0136   void SetTwoPeaksXS(std::vector<G4TwoPeaksXS*>* p) {
0137     if (p != fXSpeaks) {
0138       delete fXSpeaks;
0139       fXSpeaks = p;
0140     }
0141   }
0142 
0143   std::vector<G4EmElementSelector*>* GetElementSelectors(std::size_t i) {
0144     return (i < eLength) ? fElemSelectors[i] : nullptr;
0145   }
0146   
0147   void SetElementSelectors(std::vector<G4EmElementSelector*>*, std::size_t);
0148 
0149   G4CrossSectionType CrossSectionType() const {
0150     return fXSType;
0151   }
0152 
0153   void SetCrossSectionType(G4CrossSectionType val) {
0154     fXSType = val; 
0155   }
0156 
0157   const G4String& GetName() const {
0158     return fName;
0159   }
0160 
0161   void SetUseBaseParticleTable(G4bool val) {
0162     fUseBaseParticleTable = val;
0163   }
0164   
0165   
0166   G4EmDataHandler & operator=(const G4EmDataHandler &right) = delete;
0167   G4EmDataHandler(const G4EmDataHandler&) = delete;
0168 
0169 private:
0170 
0171   std::vector<G4PhysicsTable*> data;
0172   std::vector<G4double>* fMaxXS;
0173   std::vector<G4TwoPeaksXS*>* fXSpeaks;
0174   std::vector<std::vector<G4EmElementSelector*>* > fElemSelectors;
0175   std::vector<const G4VEmProcess*> masterProcess;
0176   std::size_t tLength{0};
0177   std::size_t eLength{0};
0178   G4CrossSectionType fXSType{fEmNoIntegral};
0179   G4String fName;
0180   G4bool fUseBaseParticleTable{false};
0181 };
0182 
0183 
0184 
0185 #endif
0186