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.2 1999/11/16 17:40:41 gcosmo Exp $ 7 // * conditions of the Geant4 Software License << 9 // GEANT4 tag $Name: geant4-01-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 // 29 // << 31 //-------------------------------------------------------------------- 30 // A physics vector which has values of energy << 32 31 // and other physics values of a particle in m << 33 #ifndef G4PhysicsLogVector_h 32 // range of energy, momentum, etc. The scale o << 34 #define G4PhysicsLogVector_h 1 33 // bins is logarithmic. << 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 35 44 #include "G4PhysicsVector.hh" << 45 #include "globals.hh" 36 #include "globals.hh" >> 37 #include "G4DataVector.hh" >> 38 #include "G4PhysicsVector.hh" 46 39 47 class G4PhysicsLogVector : public G4PhysicsVec << 40 >> 41 class G4PhysicsLogVector : public G4PhysicsVector 48 { 42 { 49 public: << 43 public: 50 // The vector will be filled from external f << 44 51 explicit G4PhysicsLogVector(G4bool spline = << 45 // Constructors >> 46 G4PhysicsLogVector(); >> 47 G4PhysicsLogVector(size_t theNbin); >> 48 G4PhysicsLogVector(G4double theEmin, G4double theEmax, size_t theNbin); >> 49 // Because of logarithmic scale, note that 'theEmin' has to be >> 50 // greater than zero. No protection exists against this error. >> 51 >> 52 // Destructor >> 53 ~G4PhysicsLogVector(); >> 54 >> 55 protected: 52 56 53 // Energies will be computed and filled at c << 57 size_t FindBinLocation(G4double theEnergy) const; 54 // filled with zeros. Required Nbin > 1 and << 58 // Find bin# in which theEnergy belongs - pure virtual function 55 // Use PutValue(..) to fill the data vector << 56 explicit G4PhysicsLogVector(G4double Emin, G << 57 G4bool spline = << 58 59 59 ~G4PhysicsLogVector() override = default; << 60 private: 60 61 61 protected: << 62 G4double dBin; // Bin width - useful only for fixed binning >> 63 G4double baseBin; // Set this in constructor for performance 62 64 63 void Initialise() final; << 64 }; 65 }; >> 66 >> 67 >> 68 inline size_t G4PhysicsLogVector::FindBinLocation(G4double theEnergy) const >> 69 { >> 70 // For G4PhysicsLogVector, FindBinLocation is implemented using >> 71 // a simple arithmetic calculation. >> 72 // >> 73 // Because this is a virtual function, it is accessed through a >> 74 // pointer to the G4PhyiscsVector object for most usages. In this >> 75 // case, 'inline' will not be invoked. However, there is a possibility >> 76 // that the user access to the G4PhysicsLogVector object directly and >> 77 // not through pointers or references. In this case, the 'inline' will >> 78 // be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6) >> 79 >> 80 return size_t( log10(theEnergy)/dBin - baseBin ); >> 81 } 65 82 66 #endif 83 #endif 67 84