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