#include <G4VelocityTable.hh>
Public Member Functions | |
G4VelocityTable () | |
~G4VelocityTable () | |
G4double | Value (G4double theEnergy) |
Static Public Member Functions | |
static G4VelocityTable * | GetVelocityTable () |
static void | SetVelocityTableProperties (G4double t_max, G4double t_min, G4int nbin) |
static G4double | GetMaxTOfVelocityTable () |
static G4double | GetMinTOfVelocityTable () |
static G4int | GetNbinOfVelocityTable () |
Definition at line 51 of file G4VelocityTable.hh.
G4VelocityTable::G4VelocityTable | ( | ) |
Definition at line 52 of file G4VelocityTable.cc.
00054 : edgeMin(0.), edgeMax(0.), numberOfNodes(0), 00055 dBin(0.), baseBin(0.), 00056 lastEnergy(-DBL_MAX), lastValue(0.), lastBin(0), 00057 maxT( 1000.0 ), minT( 0.0001 ), NbinT( 500 ) 00058 { 00059 PrepareVelocityTable(); 00060 }
G4VelocityTable::~G4VelocityTable | ( | ) |
G4double G4VelocityTable::GetMaxTOfVelocityTable | ( | ) | [static] |
Definition at line 190 of file G4VelocityTable.cc.
References maxT.
Referenced by G4Track::GetMaxTOfVelocityTable().
00192 { return theInstance->maxT; }
G4double G4VelocityTable::GetMinTOfVelocityTable | ( | ) | [static] |
Definition at line 195 of file G4VelocityTable.cc.
References minT.
Referenced by G4Track::GetMinTOfVelocityTable().
00197 { return theInstance->minT; }
G4int G4VelocityTable::GetNbinOfVelocityTable | ( | ) | [static] |
Definition at line 200 of file G4VelocityTable.cc.
References NbinT.
Referenced by G4Track::GetNbinOfVelocityTable().
00202 { return theInstance->NbinT; }
G4VelocityTable * G4VelocityTable::GetVelocityTable | ( | ) | [static] |
Definition at line 160 of file G4VelocityTable.cc.
Referenced by G4Track::G4Track(), and G4Track::SetVelocityTableProperties().
void G4VelocityTable::SetVelocityTableProperties | ( | G4double | t_max, | |
G4double | t_min, | |||
G4int | nbin | |||
) | [static] |
Definition at line 167 of file G4VelocityTable.cc.
References G4Exception(), G4State_Idle, G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), JustWarning, maxT, minT, NbinT, and PrepareVelocityTable().
Referenced by G4Track::SetVelocityTableProperties().
00169 { 00170 G4StateManager* stateManager = G4StateManager::GetStateManager(); 00171 G4ApplicationState currentState = stateManager->GetCurrentState(); 00172 00173 // check if state is outside event loop 00174 if(!(currentState==G4State_Idle||currentState==G4State_PreInit)){ 00175 G4Exception("G4VelocityTable::SetVelocityTableProperties", 00176 "Track101", JustWarning, 00177 "Can modify only in PreInit or Idle state : Method ignored."); 00178 return; 00179 } 00180 00181 if (nbin > 100 ) theInstance->NbinT = nbin; 00182 if ((t_min < t_max)&&(t_min>0.)) { 00183 theInstance->minT = t_min; 00184 theInstance->maxT = t_max; 00185 } 00186 theInstance->PrepareVelocityTable(); 00187 }
Definition at line 123 of file G4VelocityTable.cc.
Referenced by G4Track::CalculateVelocity().
00124 { 00125 // Use cache for speed up - check if the value 'theEnergy' is same as the 00126 // last call. If it is same, then use the last bin location. Also the 00127 // value 'theEnergy' lies between the last energy and low edge of of the 00128 // bin of last call, then the last bin location is used. 00129 00130 if( theEnergy == lastEnergy ) { 00131 00132 } else if( theEnergy < lastEnergy 00133 && theEnergy >= binVector[lastBin]) { 00134 lastEnergy = theEnergy; 00135 lastValue = Interpolation(); 00136 00137 } else if( theEnergy <= edgeMin ) { 00138 lastBin = 0; 00139 lastEnergy = edgeMin; 00140 lastValue = dataVector[0]; 00141 00142 } else if( theEnergy >= edgeMax ){ 00143 lastBin = numberOfNodes-1; 00144 lastEnergy = edgeMax; 00145 lastValue = dataVector[lastBin]; 00146 00147 } else { 00148 lastBin = FindBinLocation(theEnergy); 00149 lastEnergy = theEnergy; 00150 lastValue = Interpolation(); 00151 00152 } 00153 return lastValue; 00154 }