|
|
|||
Warning, file /include/Geant4/G4ExtendedPhysicsVector.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 // G4ExtendedPhysicsVector 0027 // 0028 // Class description: 0029 // 0030 // A data scructure which includes G4PhysicsVector and also data on 0031 // partial x-sections 0032 // 0033 // Author: V.Ivanchenko 09.09.2025 0034 // 0035 // -------------------------------------------------------------------- 0036 #ifndef G4ExtendedPhysicsVector_hh 0037 #define G4ExtendedPhysicsVector_hh 1 0038 0039 #include <vector> 0040 0041 #include "globals.hh" 0042 #include "G4PhysicsVector.hh" 0043 0044 class G4ExtendedPhysicsVector 0045 { 0046 public: 0047 0048 explicit G4ExtendedPhysicsVector(G4PhysicsVector*, G4int nxsec = 0); 0049 virtual ~G4ExtendedPhysicsVector(); 0050 0051 // Copy constructor and assignment operator 0052 G4ExtendedPhysicsVector(const G4ExtendedPhysicsVector&) = default; 0053 G4ExtendedPhysicsVector& operator=(const G4ExtendedPhysicsVector&) = default; 0054 0055 // not used operators 0056 G4ExtendedPhysicsVector(const G4ExtendedPhysicsVector&&) = delete; 0057 G4ExtendedPhysicsVector& operator=(const G4ExtendedPhysicsVector&&) = delete; 0058 G4bool operator==(const G4ExtendedPhysicsVector& right) const = delete; 0059 0060 // get G4PhysicsVector with total cross section 0061 inline const G4PhysicsVector* GetPhysicsVector() const; 0062 0063 // Get the value from the total x-section using interpolation defined 0064 // in the G4PhysicsVector object. Consumer code gets changed 0065 // index and may reuse it for the next call to save CPU for bin location. 0066 inline G4double Value(const G4double energy, std::size_t& lastidx) const; 0067 0068 // Get the cross-section/energy-loss value corresponding to the 0069 // given energy using log-log interpolation. Consumer code gets changed 0070 // index and may reuse it for the next call to save CPU for bin location. 0071 // Spline is not used in this method. 0072 G4double LogLogValue(const G4double energy, std::size_t& lastidx) const; 0073 0074 // This method may be applied only once. 0075 // Force length of data using std::vector::resize() with the 0076 // the default value 0; partial cross section vector is resized 0077 // only if the number of partial x-sections is above zero. 0078 void SetDataLength(G4int dlength); 0079 0080 // Filled partial cross sections by energy index (0 <= idx < numberOfNodes) 0081 // It is assumed that the array y does not have negative values. 0082 void PutPartialXSData(const std::size_t idx, const G4double* y); 0083 0084 // Sample partial reaction channel for given energy, rand - uniform 0085 // random number, lastidx is the cache allowing to reduce CPU for energy 0086 // bin location. Data are stored as float but computations are in double. 0087 G4int SampleReactionChannel(const G4double energy, const G4double rand, 0088 std::size_t& lastidx) const; 0089 0090 // randomly select partial cross section using Log-Log interpolation 0091 G4int SampleReactionChannelLogLog(const G4double energy, const G4double rand, 0092 std::size_t& lastidx) const; 0093 0094 // Print data 0095 void DumpValues(G4double unitE = 1.0, G4double unitV = 1.0) const; 0096 0097 private: 0098 0099 G4int verboseLevel = 0; 0100 G4int nPartialXS = 0; 0101 std::size_t idxmax = 0; 0102 std::size_t numberOfNodes = 0; 0103 0104 // The partial cumulative x-sections normalized to the sum 0105 std::vector<std::vector<G4float>* >* dataPartialXS = nullptr; 0106 G4PhysicsVector* totalData = nullptr; 0107 }; 0108 0109 inline const G4PhysicsVector* G4ExtendedPhysicsVector::GetPhysicsVector() const 0110 { 0111 return totalData; 0112 } 0113 0114 inline G4double G4ExtendedPhysicsVector::Value(const G4double e, std::size_t& idx) const 0115 { 0116 return totalData->Value(e, idx); 0117 } 0118 0119 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|