Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 << 26 ////////////////////////////////////////////// << 27 // 7 // 28 // class G4MaterialPropertyVector << 8 // $Id: G4MaterialPropertyVector.hh,v 1.4 1999/11/11 15:36:09 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-02-00 $ 29 // 10 // 30 // Class description: << 11 // >> 12 //////////////////////////////////////////////////////////////////////// >> 13 // G4MaterialPropertyVector Class Definition >> 14 //////////////////////////////////////////////////////////////////////// 31 // 15 // 32 // A one-to-one mapping from Photon Energy to << 33 << 34 // File: G4MaterialPropertyVector.hh 16 // File: G4MaterialPropertyVector.hh 35 // 17 // 36 // Version: 2.0 << 18 // Description: A one-to-one mapping from Photon Momentum to some >> 19 // optical property >> 20 // Version: 1.0 37 // Created: 1996-02-08 21 // Created: 1996-02-08 38 // Author: Juliet Armstrong 22 // Author: Juliet Armstrong 39 // Updated: 2011-10-13 by Peter Gumplinger << 23 // Updated: 1999-10-29 add method and class descriptors 40 // remove the class: simply typed << 24 // 1997-03-25 by Peter Gumplinger >> 25 // > value.h -> templates.hh >> 26 // mail: gum@triumf.ca 41 // 27 // 42 ////////////////////////////////////////////// 28 //////////////////////////////////////////////////////////////////////// 43 29 44 #ifndef G4MaterialPropertyVector_h << 30 #ifndef G4MaterialPropertyVector_h 45 #define G4MaterialPropertyVector_h 1 31 #define G4MaterialPropertyVector_h 1 46 32 47 #include "G4PhysicsFreeVector.hh" << 33 ///////////// 48 using G4MaterialPropertyVector = G4PhysicsFree << 34 // Includes >> 35 ///////////// >> 36 >> 37 #include "g4rw/tpsrtvec.h" >> 38 #include "g4rw/cstring.h" >> 39 #include "G4MPVEntry.hh" >> 40 >> 41 // Class Description: >> 42 // A one-to-one mapping from Photon Momentum to some optical property. >> 43 // Class Description - End: >> 44 >> 45 ///////////////////// >> 46 // Class Definition >> 47 ///////////////////// >> 48 >> 49 class G4MaterialPropertyVector { >> 50 >> 51 public: // Without description >> 52 >> 53 ////////////// >> 54 // Operators >> 55 ////////////// >> 56 >> 57 G4bool operator ++(); >> 58 G4MaterialPropertyVector& >> 59 operator =(const G4MaterialPropertyVector &right); >> 60 >> 61 ///////////////// >> 62 // Constructors >> 63 ///////////////// >> 64 >> 65 G4MaterialPropertyVector() : MPV(0) >> 66 { >> 67 CurrentEntry = -1; >> 68 NumEntries = 0; >> 69 }; >> 70 >> 71 public: // With description >> 72 >> 73 G4MaterialPropertyVector(G4double *PhotonMomenta, >> 74 G4double *PropertyValues, >> 75 G4int NumElements); >> 76 // Constructor of G4MaterialPropertyVector object. >> 77 >> 78 public: // Without description >> 79 >> 80 G4MaterialPropertyVector(const G4MaterialPropertyVector &right); >> 81 >> 82 /////////////// >> 83 // Destructor >> 84 /////////////// >> 85 >> 86 ~G4MaterialPropertyVector(); >> 87 >> 88 //////////// >> 89 // Methods >> 90 //////////// >> 91 >> 92 public: // With description >> 93 >> 94 void ResetIterator(); >> 95 >> 96 void AddElement(G4double aPhotonMomentum, >> 97 G4double aPropertyValue); >> 98 // Add a new element (pair of numbers) to the G4MaterialPropertyVector. >> 99 void RemoveElement(G4double aPhotonMomentum); >> 100 // Remove the element with given x-value. >> 101 >> 102 G4double GetProperty(G4double aPhotonMomentum) const; >> 103 // Returns the y-value for given x-value (with interpolation). >> 104 G4double GetPhotonMomentum(G4double aProperty) const; >> 105 // Returns the x-value for given y-value (with interpolation). >> 106 // NOTE: Assumes that the y-value is an increasing function of >> 107 // the x-value. Returns the x-value corresponding to the >> 108 // y-value passed in. If several x-values correspond to >> 109 // the y-value passed in, the method returns the first >> 110 // x-value in the vector that corresponds to that value. >> 111 // For use with G4MaterialPropertyVector iterator: return >> 112 // property (or Photon momentum) at current point of iterator. >> 113 >> 114 G4double GetProperty() const; >> 115 G4double GetPhotonMomentum() const; >> 116 >> 117 G4double GetMaxProperty() const; >> 118 G4double GetMinProperty() const; >> 119 G4double GetMaxPhotonMomentum() const; >> 120 G4double GetMinPhotonMomentum() const; >> 121 >> 122 ////////// >> 123 // Tests >> 124 ////////// >> 125 >> 126 void DumpVector(); >> 127 >> 128 private: >> 129 >> 130 ///////////////////// >> 131 // Helper Functions >> 132 ///////////////////// >> 133 >> 134 G4MPVEntry GetEntry(G4int i) const; >> 135 >> 136 void GetAdjacentBins(G4double aPhotonMomentum, >> 137 G4int *left,G4int *right) const; >> 138 >> 139 ///////////////////////// >> 140 // Private Data Members >> 141 ///////////////////////// >> 142 >> 143 G4RWTPtrSortedVector<G4MPVEntry> MPV; >> 144 G4int NumEntries; >> 145 G4int CurrentEntry; >> 146 }; >> 147 >> 148 /////////////////// >> 149 // Inline methods >> 150 /////////////////// >> 151 >> 152 inline >> 153 G4double G4MaterialPropertyVector::GetMaxProperty() const >> 154 { >> 155 return MPV.last()->GetProperty(); >> 156 } >> 157 >> 158 inline >> 159 G4double G4MaterialPropertyVector::GetMinProperty() const >> 160 { >> 161 return MPV.first()->GetProperty(); >> 162 } >> 163 >> 164 inline >> 165 G4double G4MaterialPropertyVector::GetMaxPhotonMomentum() const >> 166 { >> 167 return MPV.last()->GetPhotonMomentum(); >> 168 } >> 169 >> 170 inline >> 171 G4double G4MaterialPropertyVector::GetMinPhotonMomentum() const >> 172 { >> 173 return MPV.first()->GetPhotonMomentum(); >> 174 } 49 175 50 #endif /* G4MaterialPropertyVector_h */ 176 #endif /* G4MaterialPropertyVector_h */ 51 177