Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -0,0 +1,150 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4BetheBlochModel
//
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// Implementation of Bethe-Bloch model of energy loss and
// delta-electron production by heavy charged particles
// -------------------------------------------------------------------
//
#ifndef G4BetheBlochModel_h
#define G4BetheBlochModel_h 1
#include "G4VEmModel.hh"
class G4BetheBlochModel : public G4VEmModel
{
public:
G4BetheBlochModel(const G4ParticleDefinition* p = 0);
~G4BetheBlochModel();
G4double HighEnergyLimit(const G4ParticleDefinition* p,
const G4Material*);
G4double LowEnergyLimit(const G4ParticleDefinition* p,
const G4Material*);
void SetHighEnergyLimit(const G4Material*, G4double e) {highKinEnergy = e;};
void SetLowEnergyLimit(const G4Material*, G4double e) {lowKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4Material*);
G4bool IsInCharge(const G4ParticleDefinition*,
const G4Material*);
G4double ComputeDEDX(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
G4double CrossSection(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
G4std::vector<G4DynamicParticle*>* SampleSecondary(
const G4Material*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
G4double MaxSecondaryEnergy(const G4DynamicParticle*);
protected:
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kinEnergy);
private:
void SetParticle(const G4ParticleDefinition* p);
// hide assignment operator
G4BetheBlochModel & operator=(const G4BetheBlochModel &right);
G4BetheBlochModel(const G4BetheBlochModel&);
const G4ParticleDefinition* particle;
G4double mass;
G4double spin;
G4double chargeSquare;
G4double ratio;
G4double highKinEnergy;
G4double lowKinEnergy;
G4double twoln10;
G4double bg2lim;
G4double taulim;
G4double qc;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4BetheBlochModel::MaxSecondaryEnergy(
const G4ParticleDefinition* p,
G4double kinEnergy)
{
G4double gamma= kinEnergy/mass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
return tmax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4DynamicParticle* dp)
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double gamma= kineticEnergy/mass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
return tmax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,168 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4BraggModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
//
// Class Description:
//
// Implementation of energy loss and delta-electron production
// by heavy slow charged particles using eveluated data
// -------------------------------------------------------------------
//
#ifndef G4BraggModel_h
#define G4BraggModel_h 1
#include "G4VEmModel.hh"
class G4BraggModel : public G4VEmModel
{
public:
G4BraggModel(const G4ParticleDefinition* p = 0);
~G4BraggModel();
G4double HighEnergyLimit(const G4ParticleDefinition* p,
const G4Material*);
G4double LowEnergyLimit(const G4ParticleDefinition* p,
const G4Material*);
void SetHighEnergyLimit(const G4Material*, G4double e) {highKinEnergy = e;};
void SetLowEnergyLimit(const G4Material*, G4double e) {lowKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4Material*);
G4bool IsInCharge(const G4ParticleDefinition*,
const G4Material*);
G4double ComputeDEDX(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
G4double CrossSection(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
G4std::vector<G4DynamicParticle*>* SampleSecondary(
const G4Material*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
G4double MaxSecondaryEnergy(const G4DynamicParticle*);
protected:
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kinEnergy);
private:
void SetParticle(const G4ParticleDefinition* p);
// hide assignment operator
G4BraggModel & operator=(const G4BraggModel &right);
G4BraggModel(const G4BraggModel&);
G4bool HasMaterial(const G4Material* material);
G4double StoppingPower(const G4Material* material,
G4double kineticEnergy);
G4double ElectronicStoppingPower(G4double z,
G4double kineticEnergy) const;
void SetMoleculaNumber(G4int number) {iMolecula = number;};
G4double DEDX(const G4Material* material, G4double kineticEnergy);
G4bool MolecIsInZiegler1988(const G4Material* material);
G4double ChemicalFactor(G4double kineticEnergy, G4double eloss125) const;
void SetExpStopPower125(G4double value) {expStopPower125 = value;};
const G4ParticleDefinition* particle;
G4double mass;
G4double spin;
G4double chargeSquare;
G4double massRate;
G4double ratio;
G4double highKinEnergy;
G4double lowKinEnergy;
G4int iMolecula; // index in the molecula's table
G4double protonMassAMU;
G4double theZieglerFactor;
G4double expStopPower125; // Experimental Stopping power at 125keV
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4BraggModel::MaxSecondaryEnergy(
const G4ParticleDefinition* p,
G4double kinEnergy)
{
G4double gamma= kinEnergy/mass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
return tmax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4BraggModel::MaxSecondaryEnergy(const G4DynamicParticle* dp)
{
G4double gamma= dp->GetKineticEnergy()/mass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
return tmax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EmModelManager
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.05.2002
//
// Modifications: 03.12.2002 V.Ivanchenko fix a bug in model selection
//
// Class Description:
//
// It is the unified energy loss process it calculates the continuous
// energy loss for charged particles using a set of Energy Loss
// models valid for different energy regions. There are a possibility
// to create and access to dE/dx and range tables, or to calculate
// that information on fly.
// -------------------------------------------------------------------
//
#ifndef G4EmModelManager_h
#define G4EmModelManager_h 1
#include "globals.hh"
#include "G4Material.hh"
#include "G4Track.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
class G4Step;
class G4ParticleDefinition;
class G4VEmModel;
class G4DataVector;
class G4VParticleChange;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4EmModelManager
{
public:
G4EmModelManager();
~G4EmModelManager();
void Clear();
const G4DataVector* Initialise(const G4ParticleDefinition*,
const G4ParticleDefinition*,
G4double,
G4int);
const G4DataVector* Cuts() const;
const G4DataVector* SubCutoff() const;
void FillDEDXVector(G4PhysicsVector*, const G4Material*);
void FillLambdaVector(G4PhysicsVector*, const G4Material*);
void FillSubLambdaVector(G4PhysicsVector*, const G4Material*);
G4VEmModel* SelectModel(G4double energy);
void AddEmModel(G4VEmModel*, G4int);
private:
// hide assignment operator
G4EmModelManager(G4EmModelManager &);
G4EmModelManager & operator=(const G4EmModelManager &right);
// =====================================================================
private:
G4DataVector theCuts;
G4DataVector theSubCuts;
G4VEmModel* emModels[5];
G4int nEmModels;
G4int nmax;
G4int order[5];
G4double upperEkin[5];
G4bool orderIsChanged;
G4double minSubRange;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* secondaryParticle;
G4int verboseLevel;
// cash
G4VEmModel* currentModel;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4EmModelManager::SelectModel(G4double energy)
{
if(nEmModels == 4 && energy > upperEkin[2]) {
currentModel = emModels[3];
} else if(nEmModels >= 3 && energy > upperEkin[1]) {
currentModel = emModels[2];
} else if(nEmModels >= 2 && energy > upperEkin[0]) {
currentModel = emModels[1];
} else {
currentModel = emModels[0];
}
return currentModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4DataVector* G4EmModelManager::Cuts() const
{
return &theCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4DataVector* G4EmModelManager::SubCutoff() const
{
return &theSubCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.4 2001/07/11 10:03:40 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Class Description:
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EnergyLossMessengerSTD
//
// Author:
//
// Creation date:
//
// Modifications: 03.01.2002 V.Ivanchenko update to new design
//
//
// Class Description:
// This is a messenger class to interface to exchange information
// between G4VEnergyLoss and UI.
//
// /process/eLoss/ directory
//
// Commands :
//
// rndmStep * Randomize the proposed step by eLoss (false/true)
// fluct * Switch true/false the energy loss fluctuations
// subsec * Switch true/false the subcutoff generation
// minsubsec * Set the min. cut for subcutoff delta in range
// StepFunction * Set the energy loss step limitation parameters
//
// -------------------------------------------------------------------
//
#ifndef G4EnergyLossMessengerSTD_h
#define G4EnergyLossMessengerSTD_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4EnergyLossMessengerSTD: public G4UImessenger
{
public: // with description
G4EnergyLossMessengerSTD();
~G4EnergyLossMessengerSTD();
void SetNewValue(G4UIcommand*, G4String);
private:
G4EnergyLossMessengerSTD & operator=(const G4EnergyLossMessengerSTD &right);
G4EnergyLossMessengerSTD(const G4EnergyLossMessengerSTD&);
G4UIdirectory* eLossDirectory;
G4UIcmdWithABool* RndmStepCmd;
G4UIcmdWithABool* EnlossFlucCmd;
G4UIcmdWithABool* SubSecCmd;
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithADoubleAndUnit* MinSubSecCmd;
G4UIcmdWithADoubleAndUnit* MinEnCmd;
G4UIcmdWithADoubleAndUnit* MaxEnCmd;
G4UIcommand* StepFuncCmd;
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossTables.hh,v 1.12 2001/10/29 09:40:51 maire Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// $Id:
//
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4LossTableBuilder
//
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
//
// Creation date: 03.01.2002
//
// Modifications:
//
//
// Class Description:
//
// Provide building of dE/dx, range, and inverse range tables.
// -------------------------------------------------------------------
//
#ifndef G4LossTableBuilder_h
#define G4LossTableBuilder_h 1
#include "g4std/vector"
#include "globals.hh"
#include "G4PhysicsTable.hh"
class G4LossTableBuilder
{
public:
G4LossTableBuilder() {};
~G4LossTableBuilder() {};
G4PhysicsTable* BuildDEDXTable(const G4std::vector<G4PhysicsTable*>&);
G4PhysicsTable* BuildRangeTable(const G4PhysicsTable* dedxTable);
G4PhysicsTable* BuildInverseRangeTable(const G4PhysicsTable* dedxTable,
const G4PhysicsTable* rangeTable);
private:
G4LossTableBuilder & operator=(const G4LossTableBuilder &right);
G4LossTableBuilder(const G4LossTableBuilder&);
};
//....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,230 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4LossTableManager
//
// Author: Vladimir Ivanchenko on base of G4LossTables class
// and Maria Grazia Pia ideas
//
// Creation date: 03.01.2002
//
// Modifications:
//
//
// Class Description:
//
// A utility static class, responsable for the energy loss tables
// for each particle
//
// Energy loss processes have to register their tables with this
// class. The responsibility of creating and deleting the tables
// remains with the energy loss classes.
// -------------------------------------------------------------------
//
#ifndef G4LossTableManager_h
#define G4LossTableManager_h 1
#include "g4std/map"
#include "g4std/vector"
#include "globals.hh"
#include "G4LossTableBuilder.hh"
#include "G4VEnergyLossSTD.hh"
class G4PhysicsTable;
class G4Material;
class G4EnergyLossMessengerSTD;
class G4ParticleDefinition;
class G4LossTableManager
{
public:
static G4LossTableManager* Instance();
~G4LossTableManager();
void Clear();
// get the DEDX or the range for a given particle/energy/material
G4double GetDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Material *aMaterial);
G4double GetRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Material *aMaterial);
G4double GetEnergy(
const G4ParticleDefinition *aParticle,
G4double range,
const G4Material *aMaterial);
// to be called only by energy loss processes
void Register(G4VEnergyLossSTD* p);
void BuildDEDXTable(const G4ParticleDefinition* aParticle);
void RetrieveDEDXTable(const G4ParticleDefinition* aParticle,
G4VEnergyLossSTD*);
void SetLossFluctuations(G4bool val);
void SetSubCutoff(G4bool val);
void SetIntegral(G4bool val);
void SetRandomStep(G4bool val);
void SetMinSubRange(G4double val);
void SetMinEnergy(G4double val);
void SetMaxEnergy(G4double val);
void SetStepLimits(G4double v1, G4double v2);
G4bool StorePhysicsTable(G4VEnergyLossSTD* el,
const G4String& dedx_file,
const G4String& range_file,
const G4String& inv_range_file,
G4bool ascii);
private:
G4LossTableManager();
void Initialise();
G4VEnergyLossSTD* BuildTables(const G4ParticleDefinition* aParticle);
// G4LossTableManager(const G4LossTableManager&);
// const G4LossTableManager& operator=(const G4LossTableManager& right);
private:
static G4LossTableManager* theInstance;
typedef const G4ParticleDefinition* PD;
G4std::map<PD,G4VEnergyLossSTD*,G4std::less<PD> > loss_map;
G4std::vector<G4VEnergyLossSTD*> loss_vector;
G4std::vector<PD> part_vector;
G4std::vector<PD> base_part_vector;
G4std::vector<G4bool> tables_are_built;
G4std::vector<G4PhysicsTable*> dedx_vector;
G4std::vector<G4PhysicsTable*> range_vector;
G4std::vector<G4PhysicsTable*> inv_range_vector;
// cash
G4VEnergyLossSTD* currentLoss;
PD currentParticle;
PD theElectron;
G4int n_loss;
G4bool all_tables_are_built;
G4bool all_particles_are_mapped;
G4bool electron_table_are_built;
G4bool lossFluctuationFlag;
G4bool subCutoffFlag;
G4bool rndmStepFlag;
G4bool integral;
G4double minSubRange;
G4double maxRangeVariation;
G4double maxFinalStep;
G4double minKinEnergy;
G4double maxKinEnergy;
G4VEnergyLossSTD* eIonisation;
G4LossTableBuilder* tableBuilder;
G4EnergyLossMessengerSTD* theMessenger;
G4int verbose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != currentParticle) {
G4std::map<PD, G4VEnergyLossSTD*,G4std::less<PD> >::const_iterator pos;
if((pos = loss_map.find(aParticle)) == loss_map.end()) return 0.0;
currentParticle = aParticle;
currentLoss = (*pos).second;
}
return currentLoss->GetDEDX(kineticEnergy, aMaterial);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != currentParticle) {
G4std::map<PD, G4VEnergyLossSTD*, G4std::less<PD> >::const_iterator pos;
if((pos = loss_map.find(aParticle)) == loss_map.end()) return 0.0;
currentParticle = aParticle;
currentLoss = (*pos).second;
}
return currentLoss->GetRange(kineticEnergy, aMaterial);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4LossTableManager::GetEnergy(
const G4ParticleDefinition *aParticle,
G4double range,
const G4Material *aMaterial)
{
if(aParticle != currentParticle) {
G4std::map<PD,G4VEnergyLossSTD*,G4std::less<PD> >::const_iterator pos;
if((pos = loss_map.find(aParticle)) == loss_map.end()) return 0.0;
currentParticle = aParticle;
currentLoss = (*pos).second;
}
return currentLoss->GetKineticEnergy(range, aMaterial);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MultipleScattering.hh,v 1.9 2002/05/24 06:11:24 urban Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MultipleScattering.hh,v 1.11 2002/10/30 11:30:47 urban Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//------------- G4MultipleScattering physics process --------------------------
// by Laszlo Urban, March 2001
@@ -39,7 +39,7 @@
// (L.Urban)
// 24-04-02 some minor changes in boundary algorithm, L.Urban
// 24-05-02 changes in data members, L.Urban
//
// 30-10-02 changes in data members, L.Urban
//------------------------------------------------------------------------------
// class description
@@ -150,26 +150,21 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
// to reduce the energy/step dependence
void SetBoundary(G4bool value) {boundary = value;};
void Setfacxsi(G4double value) {facxsi = value;
G4cout << " facxsi=" << facxsi << G4endl;};
void SetFacrange(G4double val) {facrange=val;
nsmallstep = G4int(1./facrange) ;
G4cout << " f=" << facrange
<< " n=" << nsmallstep << G4endl ;};
nsmallstep = G4int(log((cf+facrange-1.)/
facrange)/log(cf))+1 ;
G4cout << " fr=" << facrange
<< " nsmall=" << nsmallstep << G4endl ;};
// Steplimit after boundary crossing = facrange*range
// estimated nb of steps at boundary nsmallstep = 1/facrange
// parameters needed near to boundary
void SetTuning(G4double value) {tuning = value;};
void SetCparm (G4double value) {cparm = value;};
void SetTlim (G4double value) {Tlim = value;};
// tuning of the transport mean free path
void SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
// lateral displacement to be/not to be computed
void SetNuclCorrPar(G4double val) {NuclCorrPar = val;};
void SetFactPar(G4double val) {FactPar = val;};
// corrs to transport cross section for high energy
protected: // with description
@@ -206,8 +201,9 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
// model parameters
G4bool boundary; // spec. handling near boundaries
G4double facrange,tlimit;
G4double facrange,tlimit,tlimitmin,cf;
G4int stepno,stepnolastmsc,nsmallstep ;
G4double laststep ;
G4GPILSelection valueGPILSelectionMSC;
G4double pcz,zmean; // z(geom.step length)
@@ -216,10 +212,6 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
G4double range,T1,lambda1,cth1,z1,t1,dtrl; // used to reduce the energy
// (or step length) dependence
G4double tuning; // param. for lambda tuning
G4double cparm; // "
G4double Tlim ; // "
// with/without lateral displacement
G4bool fLatDisplFlag;
@@ -228,6 +220,11 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
G4double FactPar;
G4ParticleChangeForMSC fParticleChange;
G4double alfa1,alfa2,alfa3,xsi,c0,facxsi ; // angle distr. parameters
// facxsi : some tuning
// possibility in the tail
};
#include "G4MultipleScattering.icc"
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4MultipleScattering.icc,v 1.7 2002/05/24 06:11:24 urban Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//------------ G4MultipleScattering physics process ---------------------------
// by Laszlo Urban, March 2001
@@ -0,0 +1,236 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
//
//------------- G4MultipleScattering physics process --------------------------
// by Laszlo Urban, March 2001
//
// 07-08-01 new methods Store/Retrieve PhysicsTable
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 11-09-01 G4MultipleScatteringx put as default: G4MultipleScattering
// Store,Retrieve methods reactived (mma)
// 13-09-01 Unused TrueToGeomTransformation method deleted,
// class description (L.Urban)
// 19-09-01 come back to previous process name msc
// 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban
// 22-04-02 boundary algorithm modified -> important improvement in timing !!!!
// (L.Urban)
// 24-05-02 changes in data members, L.Urban
// 30-10-02 changes in data members, L.Urban
//
//------------------------------------------------------------------------------
// class description
//
// The class simulates the multiple scattering for any kind
// of charged particle.
//
// class description - end
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4MultipleScatteringSTD_h
#define G4MultipleScatteringSTD_h 1
#include "G4VContinuousDiscreteProcess.hh"
#include "G4GPILSelection.hh"
#include "G4PhysicsLogVector.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MultipleScatteringSTD : public G4VContinuousDiscreteProcess
{
public: // with description
G4MultipleScatteringSTD(const G4String& processName="msc");
~G4MultipleScatteringSTD();
G4bool IsApplicable ( const G4ParticleDefinition& );
// returns true for charged particles, false otherwise
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
// This function overloads the corresponding virtual function
// of the base class G4VContinuousDiscreteProcess.
// It is invoked by the G4ParticleWithCuts()::SetCut() method.
// It prepares the table of the transport mean free paths
// for every material.
void PrintInfoDefinition();
// Print few lines of informations about the process: validity range,
// origine ..etc..
// Invoked by BuildPhysicsTable().
G4bool StorePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// store TransportMeanFreePath tables into an external file
// specified by 'directory' (must exist before invokation)
G4bool RetrievePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// retrieve TransportMeanFreePath tables from an external file
// specified by 'directory'
G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetContinuousStepLimit at every step.
G4double GetContinuousStepLimit(const G4Track& aTrack,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
// It performs the true step length --> geometrical step length
// transformation. It is invoked by the
// AlongStepGetPhysicalInteractionLength method.
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
// It sets the force condition to true only
// in order to have the PostStepDoIt called at every step.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
G4double GetTransportMeanFreePath(
G4double KineticEnergy,G4Material* material);
// Just a utility method to get the values of the transport
// mean free path . (It is not used inside the class.)
G4VParticleChange* AlongStepDoIt(const G4Track& aTrack,const G4Step& aStep);
// The geometrical step length --> true path length transformation
// is performed here (the inverse of the transformation done
// by GetContinuousStepLimit).
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,const G4Step& aStep);
// It computes the final state of the particle: samples the
// ScatteringSTD angle and computes the lateral displacement.
// The final state is returned as a ParticleChange object.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
void Setpcz(G4double value) {pcz = value;};
// geom. step length distribution
void Setdtrl(G4double value) {dtrl = value;};
// to reduce the energy/step dependence
void SetBoundary(G4bool value) {boundary = value;};
void Setfacxsi(G4double value) {facxsi = value;
G4cout << " facxsi=" << facxsi << G4endl;};
void SetFacrange(G4double val) {facrange=val;
nsmallstep = G4int(log((cf+facrange-1.)/
facrange)/log(cf))+1 ;
G4cout << " fr=" << facrange
<< " nsmall=" << nsmallstep << G4endl ;};
// Steplimit after boundary crossing = facrange*range
// estimated nb of steps at boundary nsmallstep = 1/facrange
void SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
// lateral displacement to be/not to be computed
void SetNuclCorrPar(G4double val) {NuclCorrPar = val;};
void SetFactPar(G4double val) {FactPar = val;};
// corrs to transport cross section for high energy
protected: // with description
virtual G4double ComputeTransportCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight);
// It computes the transport cross section.
// The transport mean free path is 1/(transport cross section).
private:
// hide assignment operator as private
G4MultipleScatteringSTD & operator = (const G4MultipleScatteringSTD &right);
G4MultipleScatteringSTD ( const G4MultipleScatteringSTD &);
private: // data members
G4PhysicsTable* theTransportMeanFreePathTable;
G4double fTransportMeanFreePath,kappa;
G4double taubig,tausmall,taulim;
G4double LowestKineticEnergy;
G4double HighestKineticEnergy;
G4int TotBin;
G4int materialIndex;
G4double tLast;
G4double zLast;
// model parameters
G4bool boundary; // spec. handling near boundaries
G4double facrange,tlimit,tlimitmin,cf;
G4int stepno, stepnolastmsc, nsmallstep;
G4double laststep ;
G4GPILSelection valueGPILSelectionMSC;
G4double pcz,zmean; // z(geom.step length)
// distribution
G4double range,T1,lambda1,cth1,z1,t1,dtrl; // used to reduce the energy
// (or step length) dependence
// with/without lateral displacement
G4bool fLatDisplFlag;
// nuclear size effect correction
G4double NuclCorrPar;
G4double FactPar;
G4ParticleChangeForMSC fParticleChange;
G4double alfa1,alfa2,alfa3,xsi,c0,facxsi ; // angle distr. parameters
// facxsi : some tuning
// possibility in the tail
};
#include "G4MultipleScatteringSTD.icc"
#endif
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4MultipleScatteringSTD.icc,v 1.1 2002/10/11 16:41:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//------------ G4MultipleScattering physics process ---------------------------
// by Laszlo Urban, March 2001
//
// Modified:
//
// 18-05-01 V.Ivanchenko Clean up against Linux ANSI compilation
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 27-08-01 bugfix in AlongStepDoIt, L.Urban
// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved to .cc file (mma)
// 11-09-01 G4MultipleScatteringx put as default: G4MultipleScattering (mma)
//
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4bool G4MultipleScatteringSTD::IsApplicable(const G4ParticleDefinition& particle)
{
return(particle.GetPDGCharge() != 0.);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MultipleScatteringSTD::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection)
{
// get Step limit proposed by the process
G4double steplength = GetContinuousStepLimit(track,previousStepSize,
currentMinimumStep,currentSafety);
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MultipleScatteringSTD::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition* condition)
// it does not limit the Step size , but it sets condition to
// Forced , because the PostStepDoIt always has to be called
{
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4MultipleScatteringSTD::GetTransportMeanFreePath(G4double KineticEnergy,
G4Material* material)
{
G4bool isOut;
return (*theTransportMeanFreePathTable)
(material->GetIndex())->GetValue(KineticEnergy,isOut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4SCProcessorStand
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// Class for simualtion of subCutoff
// -------------------------------------------------------------------
//
#ifndef G4SCProcessorStand_h
#define G4SCProcessorStand_h 1
#include "G4VSubCutoffProcessor.hh"
#include "G4PhysicsTable.hh"
#include "G4DataVector.hh"
class G4Navigator;
class G4Material;
class G4SCProcessorStand : public G4VSubCutoffProcessor
{
public:
G4SCProcessorStand();
~G4SCProcessorStand();
virtual G4std::vector<G4Track*>* SampleSecondary(const G4Step& step,
const G4DynamicParticle*,
G4double meanLoss);
virtual void Initialise(const G4ParticleDefinition*,
const G4ParticleDefinition*,
G4EmModelManager* );
virtual void SetLambdaSubTable(G4PhysicsTable*);
virtual G4PhysicsTable* LambdaSubTable();
protected:
private:
// hide assignment operator
G4SCProcessorStand & operator=(const G4SCProcessorStand &right);
G4SCProcessorStand(const G4SCProcessorStand&);
G4PhysicsTable* theLambdaSubTable;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* thePositron;
G4EmModelManager* modelManager;
G4Navigator* navigator;
const G4DataVector* theCuts;
const G4DataVector* theSubCuts;
G4DataVector rangeCuts;
// cash
const G4Material* material;
G4int materialIndex;
G4double cut;
G4double subcut;
G4double rcut;
G4double initialMass;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4SCProcessorStand::SetLambdaSubTable(G4PhysicsTable* table)
{
if(theLambdaSubTable) theLambdaSubTable->clearAndDestroy();
theLambdaSubTable = table;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4SCProcessorStand::LambdaSubTable()
{
return theLambdaSubTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4UniversalFluctuation
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications: 09.12.2002 VI remove warnings
//
// Class Description:
//
// Implementation of energy loss fluctuations
// -------------------------------------------------------------------
//
#ifndef G4UniversalFluctuation_h
#define G4UniversalFluctuation_h 1
#include "G4VEmFluctuationModel.hh"
class G4UniversalFluctuation : public G4VEmFluctuationModel
{
public:
G4UniversalFluctuation();
~G4UniversalFluctuation();
virtual void SampleFluctuations(const G4Material*, const G4DynamicParticle*,
G4double&, G4double&, G4double);
virtual void Initialise(const G4ParticleDefinition*);
protected:
private:
// hide assignment operator
G4UniversalFluctuation & operator=(const G4UniversalFluctuation &right);
G4UniversalFluctuation(const G4UniversalFluctuation&);
const G4ParticleDefinition* particle;
G4double particleMass;
G4double chargeSquare;
const G4Material* lastMaterial;
G4int materialIndex;
// data members to speed up the fluctuation calculation
G4double ipotFluct;
G4double electronDensity;
G4double zeff;
G4double f1Fluct;
G4double f2Fluct;
G4double e1Fluct;
G4double e2Fluct;
G4double rateFluct;
G4double e1LogFluct;
G4double e2LogFluct;
G4double ipotLogFluct;
G4double minNumberInteractionsBohr;
G4double theBohrBeta2;
G4double minLoss;
G4double problim;
G4double sumalim;
G4double alim;
G4int nmaxCont1;
G4int nmaxCont2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4VEmFluctuationModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// Abstract class for interface to simualtion of energy loss fluctuations
// -------------------------------------------------------------------
//
#ifndef G4VEmFluctuationModel_h
#define G4VEmFluctuationModel_h 1
#include "globals.hh"
class G4ParticleDefinition;
class G4DynamicParticle;
class G4Material;
class G4VEmFluctuationModel
{
public:
G4VEmFluctuationModel() {};
virtual ~G4VEmFluctuationModel() {};
virtual void SampleFluctuations(const G4Material*, const G4DynamicParticle*,
G4double& tmax, G4double& length, G4double meanLoss) = 0;
virtual void Initialise(const G4ParticleDefinition*) = 0;
protected:
private:
// hide assignment operator
G4VEmFluctuationModel & operator=(const G4VEmFluctuationModel &right);
G4VEmFluctuationModel(const G4VEmFluctuationModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4VEmModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// Abstract interface to energy loss models
// -------------------------------------------------------------------
//
#ifndef G4VEmModel_h
#define G4VEmModel_h 1
#include "globals.hh"
#include "g4std/vector"
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
#include "G4ThreeVector.hh"
class G4VEmModel
{
public:
G4VEmModel() {};
virtual ~G4VEmModel() {};
virtual G4double HighEnergyLimit(const G4ParticleDefinition*,
const G4Material*) = 0;
virtual G4double LowEnergyLimit(const G4ParticleDefinition*,
const G4Material*) = 0;
virtual void SetHighEnergyLimit(const G4Material*, G4double) = 0;
virtual void SetLowEnergyLimit(const G4Material*, G4double) = 0;
virtual G4double MinEnergyCut(const G4ParticleDefinition*,
const G4Material*) = 0;
virtual G4bool IsInCharge(const G4ParticleDefinition*,
const G4Material*) = 0;
virtual G4double ComputeDEDX(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) = 0;
virtual G4double CrossSection(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy) = 0;
virtual G4std::vector<G4DynamicParticle*>* SampleSecondary(
const G4Material*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax) = 0;
virtual G4double MaxSecondaryEnergy(
const G4DynamicParticle* dynParticle) = 0;
protected:
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy) = 0;
private:
// hide assignment operator
// G4VEmModel & operator=(const G4VEmModel &right);
// G4VEmModel(const G4VEmModel&);
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.hh,v 1.13 2001/11/08 08:09:57 urban Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VEnergyLoss.hh,v 1.14 2002/09/02 15:46:55 maire Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// ------------------------------------------------------------
@@ -203,7 +203,7 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
static void SetSubSec(G4bool value);
// switch on/off the generation of the subcutoff secondaries
// ( default = subcutoff secondary generation )
// ( default = no subcutoff secondary generation )
static void SetMinDeltaCutInRange(G4double value);
// sets minimal cut value for the subcutoff secondaries
@@ -0,0 +1,539 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4BetheBlochModel
//
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// It is the unified energy loss process it calculates the continuous
// energy loss for charged particles using a set of Energy Loss
// models valid for different energy regions. There are a possibility
// to create and access to dE/dx and range tables, or to calculate
// that information on fly.
// -------------------------------------------------------------------
//
#ifndef G4VEnergyLossSTD_h
#define G4VEnergyLossSTD_h 1
#include "G4VContinuousDiscreteProcess.hh"
#include "globals.hh"
#include "G4Material.hh"
#include "G4Track.hh"
#include "G4EmModelManager.hh"
class G4Step;
class G4ParticleDefinition;
class G4VEmModel;
class G4VEffectiveChargeModel;
class G4VEmFluctuationModel;
class G4DataVector;
class G4VParticleChange;
class G4PhysicsTable;
class G4PhysicsVector;
class G4VSubCutoffProcessor;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4VEnergyLossSTD : public G4VContinuousDiscreteProcess
{
public:
G4VEnergyLossSTD(const G4String& name = "EnergyLoss",
G4ProcessType type = fElectromagnetic);
~G4VEnergyLossSTD();
void Initialise();
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4bool IsApplicable(const G4ParticleDefinition& p);
// True for all charged particles
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void PrintInfoDefinition() const;
// Print out of the class parameters
G4PhysicsTable* BuildDEDXTable();
void SetParticles(const G4ParticleDefinition*,
const G4ParticleDefinition*,
const G4ParticleDefinition*);
void SetParticle(const G4ParticleDefinition* p);
void SetBaseParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* BaseParticle() const;
const G4ParticleDefinition* SecondaryParticle() const;
// Print out of the class parameters
void SetDEDXBinning(G4int nbins);
G4int DEDXBinning() const;
// Print out of the class parameters
void SetLambdaBinning(G4int nbins);
G4int LambdaBinning() const;
// Print out of the class parameters
void SetMinKinEnergy(G4double e);
G4double MinKinEnergy() const;
// Print out of the class parameters
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Print out of the class parameters
G4bool StorePhysicsTable(G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool RetrievePhysicsTable(G4ParticleDefinition*,
const G4String& directory,
G4bool ascii);
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
void AddEmModel(G4VEmModel*, G4int);
void AddEmFluctuationModel(G4VEmFluctuationModel*);
void SetSubCutoffProcessor(G4VSubCutoffProcessor*);
void SetDEDXTable(G4PhysicsTable* p);
G4PhysicsTable* DEDXTable() const {return theDEDXTable;};
void SetRangeTable(G4PhysicsTable* p);
G4PhysicsTable* RangeTable() const {return theRangeTable;};
void SetInverseRangeTable(G4PhysicsTable* p);
G4PhysicsTable* InverseRangeTable() const {return theInverseRangeTable;};
void SetSecondaryRangeTable(G4PhysicsTable* p);
const G4PhysicsTable* LambdaTable() {return theLambdaTable;};
G4double GetDEDX(G4double kineticEnergy, const G4Material* material);
G4double GetRange(G4double kineticEnergy, const G4Material* material);
G4double GetKineticEnergy(G4double range, const G4Material* material);
G4double GetLambda(G4double kineticEnergy, const G4Material* material);
// It returns the MeanFreePath of the process for a (energy, material)
G4double MicroscopicCrossSection(G4double kineticEnergy, const G4Material* material);
// It returns the MeanFreePath of the process for a (energy, material)
void SetLinearLossLimit(G4double val) {linLossLimit = val;};
void SetLossFluctuations(G4bool val) {lossFluctuationFlag = val;};
void SetSubCutoff(G4bool val) {if(subCutoffIsDesired) subCutoffFlag = val;};
void SetIntegral(G4bool val) {integral = val;};
void SetRandomStep(G4bool val) {rndmStepFlag = val;};
void SetMinSubRange(G4double val) {minSubRange = val;};
void SetStepLimits(G4double v1, G4double v2);
G4bool TablesAreBuilt() {return tablesAreBuilt;};
G4double MeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
protected:
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
virtual const G4ParticleDefinition* DefineBaseParticle(
const G4ParticleDefinition*) {return 0;};
virtual G4PhysicsVector* DEDXPhysicsVector(const G4Material*);
virtual G4PhysicsVector* LambdaPhysicsVector(const G4Material*);
virtual G4PhysicsVector* SubLambdaPhysicsVector(const G4Material*);
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut) = 0;
virtual G4double MaxSecondaryEnergy(const G4DynamicParticle* dp) = 0;
void SetMassRatio(G4double val) {massRatio = val;};
void SetReduceFactor(G4double val) {reduceFactor = val;};
void SetChargeSquare(G4double val) {chargeSquare = val;};
void SetChargeSquareRatio(G4double val) {chargeSqRatio = val;};
void SetSubCutoffIsDesired(G4bool val);
private:
void Clear();
void DefineMaterial(const G4Material* material);
G4PhysicsTable* BuildLambdaTable();
G4PhysicsTable* BuildLambdaSubTable();
// hide assignment operator
G4VEnergyLossSTD(G4VEnergyLossSTD &);
G4VEnergyLossSTD & operator=(const G4VEnergyLossSTD &right);
// =====================================================================
private:
G4EmModelManager* modelManager;
G4VSubCutoffProcessor* subCutoffProcessor;
G4VEmFluctuationModel* emFluctModel;
// tables and vectors
G4PhysicsTable* theDEDXTable;
G4PhysicsTable* theRangeTable;
G4PhysicsTable* theSecondaryRangeTable;
G4PhysicsTable* theInverseRangeTable;
G4PhysicsTable* theLambdaTable;
const G4DataVector* theCuts;
G4double minKinEnergy;
G4double maxKinEnergy;
G4int nDEDXBins;
G4int nLambdaBins;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* baseParticle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theElectron;
G4double massRatio;
G4double reduceFactor;
G4double chargeSquare;
G4double chargeSqRatio;
G4bool lossFluctuationFlag;
G4bool subCutoffFlag;
G4bool subCutoffIsDesired;
G4bool rndmStepFlag;
G4bool hasRestProcess;
G4bool tablesAreBuilt;
G4bool integral;
G4double preStepLambda;
G4double fRange;
G4double preStepKinEnergy;
G4double preStepScaledEnergy;
G4double linLossLimit;
G4double minSubRange;
G4double dRoverRange;
//G4double maxFinalStep;
G4double finalRange;
G4double c1lim;
G4double c2lim;
G4double c3lim;
// cash
const G4Material* currentMaterial;
G4int currentMaterialIndex;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEnergyLossSTD::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::DefineMaterial(const G4Material* material)
{
if(material != currentMaterial) {
currentMaterial = material;
currentMaterialIndex = material->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetDEDX(G4double kineticEnergy,
const G4Material* material)
{
DefineMaterial(material);
G4bool b;
return ((*theDEDXTable)[currentMaterialIndex]->
GetValue(kineticEnergy*massRatio, b))*chargeSqRatio;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetRange(G4double kineticEnergy,
const G4Material* material)
{
DefineMaterial(material);
G4bool b;
return ((*theRangeTable)[currentMaterialIndex]->
GetValue(kineticEnergy*massRatio, b))*reduceFactor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetKineticEnergy(G4double range,
const G4Material* material)
{
DefineMaterial(material);
G4bool b;
return ((*theInverseRangeTable)[currentMaterialIndex]->
GetValue(range/reduceFactor, b))/massRatio;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetSubCutoffIsDesired(G4bool val)
{
subCutoffIsDesired = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* cond)
{
G4bool b;
*cond = NotForced;
DefineMaterial(track.GetMaterial());
preStepKinEnergy = track.GetKineticEnergy();
preStepLambda = (((*theLambdaTable)[currentMaterialIndex])->
GetValue(preStepKinEnergy, b)) * chargeSqRatio;
G4double x = DBL_MAX;
if(0.0 < preStepLambda) x = 1.0/preStepLambda;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetContinuousStepLimit(const G4Track&,
G4double, G4double, G4double&)
{
G4double x = DBL_MAX;
preStepScaledEnergy = preStepKinEnergy*massRatio;
if(theRangeTable) {
G4bool b;
fRange = ((*theRangeTable)[currentMaterialIndex])->
GetValue(preStepScaledEnergy, b)*reduceFactor;
if(integral || fRange <= finalRange) {
x = fRange;
} else {
x = c1lim*fRange+c2lim+c3lim/fRange;
if(rndmStepFlag) x = finalRange + (x-finalRange)*G4UniformRand();
if(x > fRange) x = fRange;
}
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetParticle(const G4ParticleDefinition* p)
{
particle = p;
if(!baseParticle) baseParticle = DefineBaseParticle(particle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetBaseParticle(const G4ParticleDefinition* p)
{
baseParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetSecondaryParticle(const G4ParticleDefinition* p)
{
secondaryParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEnergyLossSTD::Particle() const
{
return particle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEnergyLossSTD::BaseParticle() const
{
return baseParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEnergyLossSTD::SecondaryParticle() const
{
return secondaryParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetDEDXBinning(G4int nbins)
{
nDEDXBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEnergyLossSTD::DEDXBinning() const
{
return nDEDXBins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetLambdaBinning(G4int nbins)
{
nLambdaBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEnergyLossSTD::LambdaBinning() const
{
return nLambdaBins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetMinKinEnergy(G4double e)
{
minKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::MinKinEnergy() const
{
return minKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetMaxKinEnergy(G4double e)
{
maxKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::MaxKinEnergy() const
{
return maxKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossSTD::GetLambda(G4double kineticEnergy,
const G4Material* material)
{
DefineMaterial(material);
G4double x = DBL_MAX;
G4bool b;
if(theLambdaTable) {
G4double y = (((*theLambdaTable)[currentMaterialIndex])->
GetValue(kineticEnergy, b));
if(y > 0.0) x = 1.0/y;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossSTD::SetStepLimits(G4double v1, G4double v2)
{
dRoverRange = v1;
finalRange = v2;
c1lim=dRoverRange;
c2lim=2.*(1-dRoverRange)*finalRange;
c3lim=-(1.-dRoverRange)*finalRange*finalRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4VSubCutoffProcessor
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
// Class Description:
//
// Abstract class for interface to simualtion of subCutoff
// -------------------------------------------------------------------
//
#ifndef G4VSubCutoffProcessor_h
#define G4VSubCutoffProcessor_h 1
#include "globals.hh"
#include "g4std/vector"
class G4Step;
class G4Track;
class G4ParticleDefinition;
class G4DynamicParticle;
class G4EmModelManager;
class G4PhysicsTable;
class G4VSubCutoffProcessor
{
public:
G4VSubCutoffProcessor() {};
virtual ~G4VSubCutoffProcessor() {};
virtual G4std::vector<G4Track*>* SampleSecondary(const G4Step& step,
const G4DynamicParticle*,
G4double meanLoss) {return 0;};
virtual void Initialise(const G4ParticleDefinition*,
const G4ParticleDefinition*,
G4EmModelManager* ) {};
virtual void SetLambdaSubTable(G4PhysicsTable*) {};
virtual G4PhysicsTable* LambdaSubTable() {return 0;};
protected:
private:
// hide assignment operator
G4VSubCutoffProcessor & operator=(const G4VSubCutoffProcessor &right);
G4VSubCutoffProcessor(const G4VSubCutoffProcessor&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif