Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhysicsLnVector.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// --------------------------------------------------------------
31// GEANT 4 class implementation file
32//
33// G4PhysicsLnVector.cc
34//
35// 27 Apr 1999 - M.G.Pia: Created from G4PhysicsLogVector
36// 19 Jun 2009 - V.Ivanchenko : removed hidden bin
37//
38// --------------------------------------------------------------
39
40#include "G4PhysicsLnVector.hh"
41
44{
46}
47
50{
52
53 numberOfNodes = theNbin + 1;
55 binVector.reserve(numberOfNodes);
56
57 for (size_t i=0; i<numberOfNodes; i++)
58 {
59 binVector.push_back(0.0);
60 dataVector.push_back(0.0);
61 }
62}
63
65 G4double theEmax, size_t theNbin)
67{
69
70 dBin = std::log(theEmax/theEmin)/theNbin;
71 baseBin = std::log(theEmin)/dBin;
72 numberOfNodes = theNbin + 1;
74 binVector.reserve(numberOfNodes);
75
76 binVector.push_back(theEmin);
77 dataVector.push_back(0.0);
78
79 for (size_t i=1; i<numberOfNodes-1; i++)
80 {
81 binVector.push_back(std::exp((baseBin+i)*dBin));
82 dataVector.push_back(0.0);
83 }
84 binVector.push_back(theEmax);
85 dataVector.push_back(0.0);
86
87 edgeMin = binVector[0];
89}
90
92
93G4bool G4PhysicsLnVector::Retrieve(std::ifstream& fIn, G4bool ascii)
94{
95 G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
96 if (success)
97 {
98 G4double theEmin = binVector[0];
99 dBin = std::log(binVector[1]/theEmin);
100 baseBin = std::log(theEmin)/dBin;
101 }
102 return success;
103}
104
106{
107 G4PhysicsVector::ScaleVector(factorE, factorV);
108 G4double theEmin = binVector[0];
109 dBin = std::log(binVector[1]/theEmin);
110 baseBin = std::log(theEmin)/dBin;
111}
112
114{
115
116 // For G4PhysicsLnVector, FindBinLocation is implemented using
117 // a simple arithmetic calculation.
118 //
119 // Because this is a virtual function, it is accessed through a
120 // pointer to the G4PhyiscsVector object for most usages. In this
121 // case, 'inline' will not be invoked. However, there is a possibility
122 // that the user access to the G4PhysicsLnVector object directly and
123 // not through pointers or references. In this case, the 'inline' will
124 // be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
125
126 return size_t( std::log(theEnergy)/dBin - baseBin );
127}
@ T_G4PhysicsLnVector
double G4double
Definition: G4Types.hh:64
bool G4bool
Definition: G4Types.hh:67
virtual size_t FindBinLocation(G4double theEnergy) const
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii)
virtual void ScaleVector(G4double factorE, G4double factorV)
G4PVDataVector binVector
G4PhysicsVectorType type
virtual void ScaleVector(G4double factorE, G4double factorV)
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
G4PVDataVector dataVector