Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:58:22

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 
0065 class G4EmDataHandler
0066 {
0067 public:
0068 
0069   explicit G4EmDataHandler(std::size_t nTable, const G4String& nam="");
0070 
0071   ~G4EmDataHandler();
0072 
0073   // add table
0074   std::size_t SetTable(G4PhysicsTable*);
0075 
0076   // update existing table
0077   void UpdateTable(G4PhysicsTable*, std::size_t idx);
0078 
0079   // save table pointer 
0080   void SaveTable(G4PhysicsTable*, std::size_t idx);
0081 
0082   // assuming that the table is already defined
0083   G4PhysicsTable* MakeTable(std::size_t idx);
0084 
0085   // existing table may be substituted
0086   G4PhysicsTable* MakeTable(G4PhysicsTable*, std::size_t idx);
0087 
0088   // clean existing table 
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   // hide assignment operator 
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0184 
0185 #endif
0186