Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EnergyLossTables.cc,v 1.27 2003/04/18 17:49:26 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4EnergyLossTables.cc,v 1.31 2003/11/24 12:12:53 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// first version created by P.Urban , 06/04/1998
|
||||
@@ -57,7 +57,7 @@ G4double G4EnergyLossTables::rmin = 0. ;
|
||||
G4double G4EnergyLossTables::rmax = 0. ;
|
||||
G4double G4EnergyLossTables::Thigh = 0. ;
|
||||
G4int G4EnergyLossTables::let_counter = 0;
|
||||
G4int G4EnergyLossTables::let_max_num_warnings = 2;
|
||||
G4int G4EnergyLossTables::let_max_num_warnings = 100;
|
||||
G4bool G4EnergyLossTables::first_loss = true;
|
||||
|
||||
G4EnergyLossTables::helper_map G4EnergyLossTables::dict;
|
||||
@@ -201,7 +201,7 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle,"dEdx");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -244,7 +244,7 @@ G4double G4EnergyLossTables::GetLabTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle,"LabTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
@@ -290,7 +290,7 @@ G4double G4EnergyLossTables::GetDeltaLabTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle,"LabTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
|
||||
@@ -368,7 +368,7 @@ G4double G4EnergyLossTables::GetProperTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle,"ProperTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
@@ -389,7 +389,7 @@ G4double G4EnergyLossTables::GetProperTime(
|
||||
t.theHighestKineticEnergy,isOut);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
time = (*propertimeTable)(materialIndex)->GetValue(
|
||||
scaledKineticEnergy,isOut);
|
||||
|
||||
@@ -414,7 +414,7 @@ G4double G4EnergyLossTables::GetDeltaProperTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle,"ProperTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
|
||||
@@ -496,7 +496,7 @@ G4double G4EnergyLossTables::GetRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable || !rangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!rangeTable) ParticleHaveNoLoss(aParticle,"Range");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -547,7 +547,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
|
||||
if (!dEdxTable || !inverseRangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!inverseRangeTable) ParticleHaveNoLoss(aParticle,"InverseRange");
|
||||
|
||||
G4double scaledrange,scaledKineticEnergy ;
|
||||
G4bool isOut ;
|
||||
@@ -609,7 +609,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle,"dEdx");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -656,7 +656,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable || !rangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!rangeTable) ParticleHaveNoLoss(aParticle,"Range");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
|
||||
@@ -697,7 +697,8 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
G4double G4EnergyLossTables::GetDEDX(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double KineticEnergy,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
{
|
||||
if(aParticle != lastParticle)
|
||||
{
|
||||
@@ -709,8 +710,11 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if ( !dEdxTable )
|
||||
return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple);
|
||||
|
||||
if (!dEdxTable ) {
|
||||
if (check) return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple);
|
||||
else ParticleHaveNoLoss(aParticle, "dEdx");
|
||||
}
|
||||
|
||||
G4int materialIndex = couple->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -743,7 +747,8 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
G4double G4EnergyLossTables::GetRange(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double KineticEnergy,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
{
|
||||
if(aParticle != lastParticle)
|
||||
{
|
||||
@@ -756,9 +761,11 @@ G4double G4EnergyLossTables::GetRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if ( !rangeTable || !dEdxTable)
|
||||
return G4LossTableManager::Instance()->GetRange(aParticle,KineticEnergy,couple);
|
||||
|
||||
if (!rangeTable) {
|
||||
if(check) return G4LossTableManager::Instance()->GetRange(aParticle,KineticEnergy,couple);
|
||||
else return DBL_MAX;
|
||||
//ParticleHaveNoLoss(aParticle,"Range");
|
||||
}
|
||||
|
||||
G4int materialIndex = couple->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -794,7 +801,8 @@ G4double G4EnergyLossTables::GetRange(
|
||||
G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double range,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
// it returns the value of the kinetic energy for a given range
|
||||
{
|
||||
if( aParticle != lastParticle)
|
||||
@@ -808,8 +816,12 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
|
||||
if ( !dEdxTable || !inverseRangeTable)
|
||||
return G4LossTableManager::Instance()->GetEnergy(aParticle,range,couple);
|
||||
|
||||
if (!inverseRangeTable) {
|
||||
if(check) return G4LossTableManager::Instance()->GetEnergy(aParticle,range,couple);
|
||||
else return DBL_MAX;
|
||||
// else ParticleHaveNoLoss(aParticle,"InverseRange");
|
||||
}
|
||||
|
||||
G4double scaledrange,scaledKineticEnergy ;
|
||||
G4bool isOut ;
|
||||
@@ -959,31 +971,32 @@ G4double G4EnergyLossTables::GetPreciseRangeFromEnergy(
|
||||
|
||||
void G4EnergyLossTables::CPRWarning()
|
||||
{
|
||||
// if (let_counter < let_max_num_warnings) {
|
||||
if (let_counter < let_max_num_warnings) {
|
||||
|
||||
// G4cout << G4endl;
|
||||
// G4cout << "##### G4EnergyLossTable WARNING: The obsolete interface is used" << G4endl;
|
||||
// G4cout << "##### Please, substitute G4Material by G4MaterialCutsCouple" << G4endl;
|
||||
// G4cout << "##### Obsolete interface will be removed soon" << G4endl;
|
||||
// G4cout << G4endl;
|
||||
// let_counter++;
|
||||
if ((G4RegionStore::GetInstance())->size() > 1) {
|
||||
G4Exception("G4EnergyLossTables:: More than 1 region - table can't be accessed with obsolete interface");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// } else if (let_counter == let_max_num_warnings) {
|
||||
|
||||
// G4cout << "##### G4EnergyLossTable WARNING closed" << G4endl;
|
||||
// let_counter++;
|
||||
G4cout << G4endl;
|
||||
G4cout << "##### G4EnergyLossTable WARNING: The obsolete interface is used!" << G4endl;
|
||||
G4cout << "##### RESULTS ARE NOT GARANTEED!" << G4endl;
|
||||
G4cout << "##### Please, substitute G4Material by G4MaterialCutsCouple" << G4endl;
|
||||
G4cout << "##### Obsolete interface will be removed soon" << G4endl;
|
||||
G4cout << G4endl;
|
||||
let_counter++;
|
||||
// if ((G4RegionStore::GetInstance())->size() > 1) {
|
||||
// G4Exception("G4EnergyLossTables:: More than 1 region - table can't be accessed with obsolete interface");
|
||||
// exit(1);
|
||||
// }
|
||||
|
||||
} else if (let_counter == let_max_num_warnings) {
|
||||
|
||||
G4cout << "##### G4EnergyLossTable WARNING closed" << G4endl;
|
||||
let_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle)
|
||||
void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle, const G4String& q)
|
||||
{
|
||||
G4String s = "G4EnergyLossTables:: dE/dx table not found for "
|
||||
G4String s = "G4EnergyLossTables:: " + q + " table not found for "
|
||||
+ aParticle->GetParticleName() + "!";
|
||||
G4Exception(s);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user