Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4PhysicsLogVector << 27 // 23 // 28 // Class description: << 24 // $Id: G4PhysicsLogVector.hh,v 1.10 2005/03/15 19:11:35 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-08-00 $ 29 // 26 // 30 // A physics vector which has values of energy << 27 // 31 // and other physics values of a particle in m << 28 //-------------------------------------------------------------------- 32 // range of energy, momentum, etc. The scale o << 29 // GEANT 4 class header file 33 // bins is logarithmic. << 30 // 34 << 31 // G4PhysicsLogVector.hh 35 // Authors: << 32 // 36 // - 02 Dec. 1995, G.Cosmo: Structure created << 33 // Class description: 37 // - 03 Mar. 1996, K.Amako: Implemented the 1s << 34 // 38 // Revisions: << 35 // A physics vector which has values of energy-loss, cross-section, 39 // - 11 Nov. 2000, H.Kurashige : Use STL vecto << 36 // and other physics values of a particle in matter in a given 40 // ------------------------------------------- << 37 // range of the energy, momentum, etc. The scale of energy/momentum 41 #ifndef G4PhysicsLogVector_hh << 38 // bins is in logarithmic. 42 #define G4PhysicsLogVector_hh 1 << 39 >> 40 // History: >> 41 // 02 Dec. 1995, G.Cosmo : Structure created based on object model >> 42 // 03 Mar. 1996, K.Amako : Implemented the 1st version >> 43 // 27 Apr. 1996, K.Amako : Cache mechanism added >> 44 // 01 Jul. 1996, K.Amako : Hidden bin from the user introduced >> 45 // 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added >> 46 // 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector >> 47 // >> 48 //-------------------------------------------------------------------- >> 49 >> 50 #ifndef G4PhysicsLogVector_h >> 51 #define G4PhysicsLogVector_h 1 43 52 44 #include "G4PhysicsVector.hh" << 45 #include "globals.hh" 53 #include "globals.hh" >> 54 #include "G4PhysicsVector.hh" 46 55 47 class G4PhysicsLogVector : public G4PhysicsVec << 56 class G4PhysicsLogVector : public G4PhysicsVector 48 { 57 { 49 public: << 58 public: 50 // The vector will be filled from external f << 59 51 explicit G4PhysicsLogVector(G4bool spline = << 60 G4PhysicsLogVector(); >> 61 explicit G4PhysicsLogVector(size_t theNbin); >> 62 // Constructors >> 63 52 64 53 // Energies will be computed and filled at c << 65 public: // with description 54 // filled with zeros. Required Nbin > 1 and << 55 // Use PutValue(..) to fill the data vector << 56 explicit G4PhysicsLogVector(G4double Emin, G << 57 G4bool spline = << 58 66 59 ~G4PhysicsLogVector() override = default; << 67 G4PhysicsLogVector(G4double theEmin, G4double theEmax, size_t theNbin); >> 68 // Because of logarithmic scale, note that 'theEmin' has to be >> 69 // greater than zero. No protection exists against this error. 60 70 61 protected: << 71 ~G4PhysicsLogVector(); >> 72 // Destructor >> 73 >> 74 G4bool Retrieve(std::ifstream& fIn, G4bool ascii); >> 75 // To retrieve persistent data from file stream. >> 76 >> 77 protected: >> 78 >> 79 size_t FindBinLocation(G4double theEnergy) const; >> 80 // Find bin# in which theEnergy belongs - pure virtual function >> 81 >> 82 private: >> 83 >> 84 G4double dBin; // Bin width - useful only for fixed binning >> 85 G4double baseBin; // Set this in constructor for performance 62 86 63 void Initialise() final; << 64 }; 87 }; >> 88 >> 89 >> 90 inline >> 91 size_t G4PhysicsLogVector::FindBinLocation(G4double theEnergy) const >> 92 { >> 93 // For G4PhysicsLogVector, FindBinLocation is implemented using >> 94 // a simple arithmetic calculation. >> 95 // >> 96 // Because this is a virtual function, it is accessed through a >> 97 // pointer to the G4PhyiscsVector object for most usages. In this >> 98 // case, 'inline' will not be invoked. However, there is a possibility >> 99 // that the user access to the G4PhysicsLogVector object directly and >> 100 // not through pointers or references. In this case, the 'inline' will >> 101 // be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6) >> 102 >> 103 return size_t( std::log10(theEnergy)/dBin - baseBin ); >> 104 } 65 105 66 #endif 106 #endif 67 107