Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VelocityTable Class Reference

#include <G4VelocityTable.hh>

Public Member Functions

G4double Value (G4double theEnergy)
 

Static Public Member Functions

static G4VelocityTableGetVelocityTable ()
 
static void SetVelocityTableProperties (G4double t_max, G4double t_min, G4int nbin)
 
static G4double GetMaxTOfVelocityTable ()
 
static G4double GetMinTOfVelocityTable ()
 
static G4int GetNbinOfVelocityTable ()
 

Friends

class G4ThreadLocalSingleton< G4VelocityTable >
 

Detailed Description

Definition at line 46 of file G4VelocityTable.hh.

Member Function Documentation

◆ GetMaxTOfVelocityTable()

G4double G4VelocityTable::GetMaxTOfVelocityTable ( )
static

Definition at line 193 of file G4VelocityTable.cc.

194{
195 return GetVelocityTable()->maxT;
196}
static G4VelocityTable * GetVelocityTable()

◆ GetMinTOfVelocityTable()

G4double G4VelocityTable::GetMinTOfVelocityTable ( )
static

Definition at line 199 of file G4VelocityTable.cc.

200{
201 return GetVelocityTable()->minT;
202}

◆ GetNbinOfVelocityTable()

G4int G4VelocityTable::GetNbinOfVelocityTable ( )
static

Definition at line 205 of file G4VelocityTable.cc.

206{
207 return GetVelocityTable()->NbinT;
208}

◆ GetVelocityTable()

G4VelocityTable * G4VelocityTable::GetVelocityTable ( )
static

Definition at line 151 of file G4VelocityTable.cc.

152{
153 if(theInstance == nullptr)
154 {
156 theInstance = inst.Instance();
157 }
158 return theInstance;
159}

Referenced by GetMaxTOfVelocityTable(), GetMinTOfVelocityTable(), GetNbinOfVelocityTable(), and SetVelocityTableProperties().

◆ SetVelocityTableProperties()

void G4VelocityTable::SetVelocityTableProperties ( G4double  t_max,
G4double  t_min,
G4int  nbin 
)
static

Definition at line 162 of file G4VelocityTable.cc.

164{
165 if(theInstance == nullptr)
166 {
168 }
169
171 G4ApplicationState currentState = stateManager->GetCurrentState();
172
173 // check if state is outside event loop
174 if(!(currentState == G4State_Idle || currentState == G4State_PreInit))
175 {
176 G4Exception("G4VelocityTable::SetVelocityTableProperties()", "Track101",
178 "Can modify only in PreInit or Idle state : Method ignored.");
179 return;
180 }
181
182 if(nbin > 100)
183 theInstance->NbinT = nbin;
184 if((t_min < t_max) && (t_min > 0.))
185 {
186 theInstance->minT = t_min;
187 theInstance->maxT = t_max;
188 }
189 theInstance->PrepareVelocityTable();
190}
G4ApplicationState
@ G4State_Idle
@ G4State_PreInit
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()

◆ Value()

G4double G4VelocityTable::Value ( G4double  theEnergy)

Definition at line 110 of file G4VelocityTable.cc.

111{
112 // Use cache for speed up - check if the value 'theEnergy' is same as the
113 // last call. If it is same, then use the last bin location. Also the
114 // value 'theEnergy' lies between the last energy and low edge of of the
115 // bin of last call, then the last bin location is used
116
117 if(theEnergy == lastEnergy)
118 {
119 }
120 else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin])
121 {
122 lastEnergy = theEnergy;
123 lastValue = Interpolation();
124 }
125 else if(theEnergy <= edgeMin)
126 {
127 lastBin = 0;
128 lastEnergy = edgeMin;
129 lastValue = dataVector[0];
130 }
131 else if(theEnergy >= edgeMax)
132 {
133 lastBin = numberOfNodes - 1;
134 lastEnergy = edgeMax;
135 lastValue = dataVector[lastBin];
136 }
137 else
138 {
139 lastBin = (std::size_t)(G4Log(theEnergy) / dBin - baseBin);
140 if(lastBin == numberOfNodes)
141 {
142 --lastBin;
143 } // VI: fix possible precision lost
144 lastEnergy = theEnergy;
145 lastValue = Interpolation();
146 }
147 return lastValue;
148}
G4double G4Log(G4double x)
Definition: G4Log.hh:226

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4VelocityTable >

friend class G4ThreadLocalSingleton< G4VelocityTable >
friend

Definition at line 108 of file G4VelocityTable.hh.


The documentation for this class was generated from the following files: