Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
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 ()
 

Detailed Description

Definition at line 51 of file G4VelocityTable.hh.

Member Function Documentation

G4double G4VelocityTable::GetMaxTOfVelocityTable ( )
static

Definition at line 193 of file G4VelocityTable.cc.

References GetVelocityTable().

Referenced by G4Track::GetMaxTOfVelocityTable().

195 {
196  return GetVelocityTable()->maxT;
197 }
static G4VelocityTable * GetVelocityTable()
G4double G4VelocityTable::GetMinTOfVelocityTable ( )
static

Definition at line 200 of file G4VelocityTable.cc.

References GetVelocityTable().

Referenced by G4Track::GetMinTOfVelocityTable().

202 {
203  return GetVelocityTable()->minT;
204 }
static G4VelocityTable * GetVelocityTable()
G4int G4VelocityTable::GetNbinOfVelocityTable ( )
static

Definition at line 207 of file G4VelocityTable.cc.

References GetVelocityTable().

Referenced by G4Track::GetNbinOfVelocityTable().

209 {
210  return GetVelocityTable()->NbinT;
211 }
static G4VelocityTable * GetVelocityTable()
G4VelocityTable * G4VelocityTable::GetVelocityTable ( )
static

Definition at line 160 of file G4VelocityTable.cc.

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

162 {
163  if (!theInstance) { theInstance = new G4VelocityTable(); }
164  return theInstance;
165 }
void G4VelocityTable::SetVelocityTableProperties ( G4double  t_max,
G4double  t_min,
G4int  nbin 
)
static

Definition at line 168 of file G4VelocityTable.cc.

References G4Exception(), G4State_Idle, G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), and JustWarning.

Referenced by G4Track::SetVelocityTableProperties().

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

Definition at line 123 of file G4VelocityTable.cc.

Referenced by G4Track::CalculateVelocity().

124 {
125  // Use cache for speed up - check if the value 'theEnergy' is same as the
126  // last call. If it is same, then use the last bin location. Also the
127  // value 'theEnergy' lies between the last energy and low edge of of the
128  // bin of last call, then the last bin location is used.
129 
130  if( theEnergy == lastEnergy ) {
131 
132  } else if( theEnergy < lastEnergy
133  && theEnergy >= binVector[lastBin]) {
134  lastEnergy = theEnergy;
135  lastValue = Interpolation();
136 
137  } else if( theEnergy <= edgeMin ) {
138  lastBin = 0;
139  lastEnergy = edgeMin;
140  lastValue = dataVector[0];
141 
142  } else if( theEnergy >= edgeMax ){
143  lastBin = numberOfNodes-1;
144  lastEnergy = edgeMax;
145  lastValue = dataVector[lastBin];
146 
147  } else {
148  lastBin = FindBinLocation(theEnergy);
149  lastEnergy = theEnergy;
150  lastValue = Interpolation();
151 
152  }
153  return lastValue;
154 }

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