Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -1,4 +1,4 @@
$Id: History 93569 2015-10-26 14:53:21Z gcosmo $
$Id: History 100666 2016-10-31 10:27:00Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,25 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
---------------------------------------------------------
27 Octb 2016: L. Desorgher (emadjoint-V10-02-03)
-Correction in G4AdjointForcedInteractionForGamma to avoid high weight of forced gamma
when only the brem is used.
-Modification in G4AdjointBremsstrahlungModel to use the direcet angular model to compute the direction of the
adjoint secondary
-Add G4UrbanAdjointMscModel.cc and G4eAdjointMultipleScattering.cc
18 Octb 2016: L. Desorgher (emadjoint-V10-02-02)
-Correct use of logical or in G4AdjointForcedInteractionForGamma for compilation
error under windows.
17 Octb 2016: L. Desorgher (emadjoint-V10-02-01)
-Correct G4AdjointForcedInteractionForGamma for compilation error under windows.
26 Sept 2016: L. Desorgher (emadjoint-V10-02-00)
-Add new adjoint process G4AdjointForcedInteractionForGamma to force the
reverse interaction of adjoint gamma.
-Slight modifications of G4VEmAdjointModel for new forced interaction
-Some corrections in G4AdjointBremsstrahlungModel
24 Oct 2015: V.Ivanchenko (emadjoint-V10-01-03)
- G4AdjointCSManager - use G4ThreadLocalSingleton pattern,
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointBremsstrahlungModel.hh 74727 2013-10-21 08:43:49Z gcosmo $
// $Id: G4AdjointBremsstrahlungModel.hh 100666 2016-10-31 10:27:00Z gcosmo $
//
/////////////////////////////////////////////////////////////////////////////////
// Class: G4AdjointBremsstrahlungModel
@@ -55,6 +55,7 @@
#define G4AdjointBremsstrahlungModel_h 1
#include "globals.hh"
#include "G4VEmAdjointModel.hh"
#include "G4VEmAngularDistribution.hh"
#include "G4PhysicsTable.hh"
#include "G4EmModelManager.hh"
class G4Timer;
@@ -108,6 +109,7 @@ private:
std::vector<G4DataVector*> partialSumSigma;
std::vector<float> SigmaPerAtom;
};
@@ -0,0 +1,132 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointForcedInteractionForGamma.hh 80314 2014-04-10 12:23:52Z gcosmo $
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointForcedInteractionForGamma
// Author: L. Desorgher
// Organisation: SpaceIT GmbH
// Contract: ESA contract 21435/08/NL/AT
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 12 September 2016 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Class for the forced interaction of reverse gamma
//
#ifndef G4AdjointForcedInteractionForGamma_h
#define G4AdjointForcedInteractionForGamma_h 1
#include "globals.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "Randomize.hh"
#include "G4ParticleDefinition.hh"
#include "G4VContinuousDiscreteProcess.hh"
#include"G4PhysicsOrderedFreeVector.hh"
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4ParticleChange;
class G4Track;
class G4VEmAdjointModel;
class G4AdjointCSMatrix;
class G4AdjointCSManager;
class G4Material;
class G4MaterialCutsCouple;
class G4Navigator;
class G4AdjointForcedInteractionForGamma : public G4VContinuousDiscreteProcess
{
public:
G4AdjointForcedInteractionForGamma(G4String process_name);
virtual ~G4AdjointForcedInteractionForGamma();
public:
void PreparePhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AlongStepDoIt(const G4Track& track,const G4Step& step);
inline void RegisterAdjointComptonModel(G4VEmAdjointModel* aAdjointComptonModel){theAdjointComptonModel = aAdjointComptonModel;}
inline void RegisterAdjointBremModel(G4VEmAdjointModel* aAdjointBremModel){theAdjointBremModel = aAdjointBremModel;}
protected :// with description
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety
);
private:
G4VEmAdjointModel* theAdjointComptonModel;
G4VEmAdjointModel* theAdjointBremModel;
G4ParticleChange* fParticleChange;
G4AdjointCSManager* theAdjointCSManager;
private:
G4double lastAdjCS,lastFwdCS;
G4int trackid;
G4int nstep;
G4bool is_free_flight_gamma;
G4bool copy_gamma_for_forced_interaction;
G4int last_free_flight_trackid;
G4double acc_track_length;
G4double total_acc_nb_adj_interaction_length;
G4double total_acc_nb_fwd_interaction_length;
G4double acc_nb_adj_interaction_length;
G4double acc_nb_fwd_interaction_length;
G4bool continue_gamma_as_new_free_flight;
};
#endif
@@ -0,0 +1,283 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: $
// GEANT4 tag $Name: $
//
// -------------------------------------------------------------------
//
//
// GEANT4 Class header file
//
//
// File name: G4UrbanAdjointMscModel
//
// Author: Laszlo Urban
//
// Creation date: 19.02.2013
//
// Created from G4UrbanAdjointMscModel96
//
// New parametrization for theta0
// Correction for very small step length
//
// Class Description:
//
// Implementation of the model of multiple scattering based on
// H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
// -------------------------------------------------------------------
//
#ifndef G4UrbanAdjointMscModel_h
#define G4UrbanAdjointMscModel_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4VMscModel.hh"
#include "G4MscStepLimitType.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4Electron.hh"
class G4ParticleChangeForMSC;
class G4SafetyHelper;
class G4LossTableManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4UrbanAdjointMscModel : public G4VMscModel
{
public:
explicit G4UrbanAdjointMscModel(const G4String& nam = "UrbanMsc");
virtual ~G4UrbanAdjointMscModel();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector&) override;
virtual void StartTracking(G4Track*) override;
virtual G4double
ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight=0.,
G4double cut =0.,
G4double emax=DBL_MAX) override;
virtual G4ThreeVector& SampleScattering(const G4ThreeVector&,
G4double safety) override;
virtual G4double
ComputeTruePathLengthLimit(const G4Track& track,
G4double& currentMinimalStep) override;
virtual G4double ComputeGeomPathLength(G4double truePathLength) override;
virtual G4double ComputeTrueStepLength(G4double geomStepLength) override;
G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy);
inline void SetNewDisplacementFlag(G4bool);
private:
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
void SampleDisplacement(G4double sinTheta, G4double phi);
void SampleDisplacementNew(G4double sinTheta, G4double phi);
inline void SetParticle(const G4ParticleDefinition*);
inline void UpdateCache();
inline G4double Randomizetlimit();
inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
// hide assignment operator
G4UrbanAdjointMscModel & operator=(const G4UrbanAdjointMscModel &right) = delete;
G4UrbanAdjointMscModel(const G4UrbanAdjointMscModel&) = delete;
CLHEP::HepRandomEngine* rndmEngineMod;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* positron;
G4ParticleChangeForMSC* fParticleChange;
const G4MaterialCutsCouple* couple;
G4LossTableManager* theManager;
G4double mass;
G4double charge,ChargeSquare;
G4double masslimite,lambdalimit,fr;
G4double taubig;
G4double tausmall;
G4double taulim;
G4double currentTau;
G4double tlimit;
G4double tlimitmin;
G4double tlimitminfix,tlimitminfix2;
G4double tgeom;
G4double geombig;
G4double geommin;
G4double geomlimit;
G4double skindepth;
G4double smallstep;
G4double presafety;
G4double lambda0;
G4double lambdaeff;
G4double tPathLength;
G4double zPathLength;
G4double par1,par2,par3;
G4double stepmin;
G4double currentKinEnergy;
G4double currentRange;
G4double rangeinit;
G4double currentRadLength;
G4int currentMaterialIndex;
G4double Zold;
G4double Zeff,Z2,Z23,lnZ;
G4double coeffth1,coeffth2;
G4double coeffc1,coeffc2,coeffc3,coeffc4;
G4bool firstStep;
G4bool insideskin;
G4bool latDisplasmentbackup ;
G4bool displacementFlag;
G4double rangecut;
G4double drr,finalr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4UrbanAdjointMscModel::SetNewDisplacementFlag(G4bool val)
{
displacementFlag = val;
}
inline
void G4UrbanAdjointMscModel::SetParticle(const G4ParticleDefinition* p)
{ const G4ParticleDefinition* p1 =p;
if (p->GetParticleName() =="adj_e-") p1= G4Electron::Electron();
if (p1 != particle) {
particle = p1;
mass = p1->GetPDGMass();
charge = p1->GetPDGCharge()/CLHEP::eplus;
ChargeSquare = charge*charge;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4UrbanAdjointMscModel::Randomizetlimit()
{
G4double temptlimit = tlimit;
if(tlimit > tlimitmin)
{
G4double delta = tlimit-tlimitmin;
do {
temptlimit = G4RandGauss::shoot(rndmEngineMod,tlimit,0.1*delta);
// Loop checking, 10-Apr-2016, Laszlo Urban
} while ((temptlimit < tlimit-delta) ||
(temptlimit > tlimit+delta));
}
else { temptlimit = tlimitmin; }
return temptlimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4UrbanAdjointMscModel::UpdateCache()
{
lnZ = G4Log(Zeff);
// correction in theta0 formula
G4double w = G4Exp(lnZ/6.);
G4double facz = 0.990395+w*(-0.168386+w*0.093286) ;
coeffth1 = facz*(1. - 8.7780e-2/Zeff);
coeffth2 = facz*(4.0780e-2 + 1.7315e-4*Zeff);
// tail parameters
G4double Z13 = w*w;
coeffc1 = 2.3785 - Z13*(4.1981e-1 - Z13*6.3100e-2);
coeffc2 = 4.7526e-1 + Z13*(1.7694 - Z13*3.3885e-1);
coeffc3 = 2.3683e-1 - Z13*(1.8111 - Z13*3.2774e-1);
coeffc4 = 1.7888e-2 + Z13*(1.9659e-2 - Z13*2.6664e-3);
Z2 = Zeff*Zeff;
Z23 = Z13*Z13;
Zold = Zeff;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4UrbanAdjointMscModel::SimpleScattering(G4double xmeanth, G4double x2meanth)
{
// 'large angle scattering'
// 2 model functions with correct xmean and x2mean
G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.);
G4double prob = (a+2.)*xmeanth/a;
// sampling
G4double cth = 1.;
if(rndmEngineMod->flat() < prob) {
cth = -1.+2.*G4Exp(G4Log(rndmEngineMod->flat())/(a+1.));
} else {
cth = -1.+2.*rndmEngineMod->flat();
}
return cth;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmAdjointModel.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: G4VEmAdjointModel.hh 100341 2016-10-18 08:02:25Z gcosmo $
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4VEMAdjointModel
@@ -215,7 +215,10 @@ public: // public methods
inline G4String GetName(){ return name;}
inline virtual void SetCSBiasingFactor(G4double aVal) {CS_biasing_factor = aVal;}
inline void SetCorrectWeightForPostStepInModel(G4bool aBool) {correct_weight_for_post_step_in_model = aBool;}
inline void SetAdditionalWeightCorrectionFactorForPostStepOutsideModel(G4double factor) {additional_weight_correction_factor_for_post_step_outside_model = factor;}
protected:
//Some of them can be overriden by daughter classes
@@ -272,8 +275,7 @@ protected: //attributes
G4double kinEnergyProdForIntegration;
G4double kinEnergyScatProjForIntegration;
G4double kinEnergyProjForIntegration;
//for the adjoint simulation we need for each element or material:
//an adjoint CS Matrix
//-----------------------------
@@ -287,9 +289,6 @@ protected: //attributes
G4double lastAdjointCSForScatProjToProjCase;
G4double lastAdjointCSForProdToProjCase;
//particle definition
//------------------
@@ -298,7 +297,6 @@ protected: //attributes
G4ParticleDefinition* theDirectPrimaryPartDef;
G4bool second_part_of_same_type;
//Prestep energy
//-------------
G4double preStepEnergy;
@@ -313,48 +311,39 @@ protected: //attributes
G4double currentTcutForDirectSecond;
G4bool ApplyCutInRange;
//For ions
//---------
G4double mass_ratio_product;
G4double mass_ratio_projectile;
//Energy limits
//-------------
G4double HighEnergyLimit;
G4double LowEnergyLimit;
//Cross Section biasing factor
//---------------------------
G4double CS_biasing_factor;
//Type of Model with Matrix or not
//--------------------------------
G4bool UseMatrix;
G4bool UseMatrixPerElement; //other possibility is per Material
G4bool UseOnlyOneMatrixForAllElements;
//Index of Cross section matrices to be used
//------------
size_t indexOfUsedCrossSectionMatrix;
size_t model_index;
//This is needed for the forced interaction where part of the weight correction
// is given outside the model while the secondary are created in the model
//The weight should be fixed before adding the secondary
G4bool correct_weight_for_post_step_in_model;
G4double additional_weight_correction_factor_for_post_step_outside_model;
};
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eAdjointMultipleScattering.hh 96934 2016-05-18 09:10:41Z gcosmo $
//
// -----------------------------------------------------------------------------
//
// GEANT4 Class header file
//
// File name: G4eAdjointMultipleScattering
//
// Author: Vladimir Ivanchenko
//
// Creation date: 10 March 2001
//
// Modifications:
//
//
//------------------------------------------------------------------------------
//
// class description
//
// The class simulates the multiple scattering for e+ and e-
//
// class description - end
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4eAdjointMultipleScattering_h
#define G4eAdjointMultipleScattering_h 1
#include "G4VMultipleScattering.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4eAdjointMultipleScattering : public G4VMultipleScattering
{
public: // with description
explicit G4eAdjointMultipleScattering(const G4String& processName = "msc");
virtual ~G4eAdjointMultipleScattering();
// This is called in the beginning of tracking for a new track
void StartTracking(G4Track*) override;
// returns true for charged particles, false otherwise
G4bool IsApplicable (const G4ParticleDefinition& p) final;
// Print few lines of informations about the process: validity range,
void PrintInfo() override;
protected:
// This function initialise models
void InitialiseProcess(const G4ParticleDefinition*) override;
private: // data members
G4bool isInitialized;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 66892 2013-01-17 10:57:59Z gunter $
# $Id: sources.cmake 100666 2016-10-31 10:27:00Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -64,11 +64,14 @@ GEANT4_DEFINE_MODULE(NAME G4emadjoint
G4InversePEEffect.hh
G4IonInverseIonisation.hh
G4VAdjointReverseReaction.hh
G4AdjointForcedInteractionForGamma.hh
G4VEmAdjointModel.hh
G4eInverseBremsstrahlung.hh
G4eInverseCompton.hh
G4eInverseIonisation.hh
G4hInverseIonisation.hh
G4UrbanAdjointMscModel.hh
G4eAdjointMultipleScattering.hh
SOURCES
G4AdjointAlongStepWeightCorrection.cc
G4AdjointBremsstrahlungModel.cc
@@ -86,11 +89,14 @@ GEANT4_DEFINE_MODULE(NAME G4emadjoint
G4InversePEEffect.cc
G4IonInverseIonisation.cc
G4VAdjointReverseReaction.cc
G4AdjointForcedInteractionForGamma.cc
G4VEmAdjointModel.cc
G4eInverseBremsstrahlung.cc
G4eInverseCompton.cc
G4eInverseIonisation.cc
G4hInverseIonisation.cc
G4UrbanAdjointMscModel.cc
G4eAdjointMultipleScattering.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointBremsstrahlungModel.cc 75591 2013-11-04 12:33:11Z gcosmo $
// $Id: G4AdjointBremsstrahlungModel.cc 100666 2016-10-31 10:27:00Z gcosmo $
//
#include "G4AdjointBremsstrahlungModel.hh"
#include "G4AdjointCSManager.hh"
@@ -70,18 +70,7 @@ G4AdjointBremsstrahlungModel::G4AdjointBremsstrahlungModel(G4VEmModel* aModel):
second_part_of_same_type=false;
/*UsePenelopeModel=false;
if (UsePenelopeModel) {
G4PenelopeBremsstrahlungModel* thePenelopeModel = new G4PenelopeBremsstrahlungModel(G4Electron::Electron(),"PenelopeBrem");
theEmModelManagerForFwdModels = new G4EmModelManager();
isPenelopeModelInitialised = false;
G4VEmFluctuationModel* f=0;
G4Region* r=0;
theDirectEMModel=thePenelopeModel;
theEmModelManagerForFwdModels->AddEmModel(1, thePenelopeModel, f, r);
}
*/
CS_biasing_factor =1.;
}
@@ -109,7 +98,6 @@ G4AdjointBremsstrahlungModel::G4AdjointBremsstrahlungModel():
theAdjEquivOfDirectSecondPartDef=G4AdjointGamma::AdjointGamma();
theDirectPrimaryPartDef=G4Electron::Electron();
second_part_of_same_type=false;
}
////////////////////////////////////////////////////////////////////////////////
//
@@ -223,7 +211,7 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
G4double Emin= GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);;
if (Emin>=Emax) return;
projectileKinEnergy=Emin*std::pow(Emax/Emin,G4UniformRand());
diffCSUsed=100.*CS_biasing_factor*lastCZ/projectileKinEnergy;
diffCSUsed=CS_biasing_factor*lastCZ/projectileKinEnergy;
}
else { G4double Emax = GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
@@ -231,7 +219,6 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
if (Emin>=Emax) return;
G4double f1=(Emin-adjointPrimKinEnergy)/Emin;
G4double f2=(Emax-adjointPrimKinEnergy)/Emax/f1;
//G4cout<<"f1 and f2 "<<f1<<'\t'<<f2<<G4endl;
projectileKinEnergy=adjointPrimKinEnergy/(1.-f1*std::pow(f2,G4UniformRand()));
gammaEnergy=projectileKinEnergy-adjointPrimKinEnergy;
diffCSUsed=lastCZ*adjointPrimKinEnergy/projectileKinEnergy/gammaEnergy;
@@ -244,16 +231,31 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
//Weight correction
//-----------------------
//First w_corr is set to the ratio between adjoint total CS and fwd total CS
G4double w_corr=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
//if this has to be done in the model
//For the case of forced interaction this will be done in the PostStepDoIt of the
//forced interaction
//It is important to set the weight before the vreation of the secondary
//
G4double w_corr=additional_weight_correction_factor_for_post_step_outside_model;
if (correct_weight_for_post_step_in_model) {
w_corr=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
}
//G4cout<<"Correction factor start in brem model "<<w_corr<<std::endl;
//Then another correction is needed due to the fact that a biaised differential CS has been used rather than the one consistent with the direct model
//Here we consider the true diffCS as the one obtained by the numericla differentiation over Tcut of the direct CS, corrected by the Migdal term.
//Basically any other differential CS diffCS could be used here (example Penelope).
G4double diffCS = DiffCrossSectionPerVolumePrimToSecond(currentMaterial, projectileKinEnergy, gammaEnergy);
/*G4cout<<"diffCS "<<diffCS <<std::endl;
G4cout<<"diffCS_Used "<<diffCSUsed <<std::endl;*/
w_corr*=diffCS/diffCSUsed;
G4double new_weight = aTrack.GetWeight()*w_corr;
/*G4cout<<"New weight brem "<<new_weight<<std::endl;
G4cout<<"Weight correction brem "<<w_corr<<std::endl;*/
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
fParticleChange->ProposeParentWeight(new_weight);
@@ -265,7 +267,22 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
G4double projectileP = std::sqrt(projectileP2);
//Use the angular model of the forward model to generate the gamma direction
//---------------------------------------------------------------------------
//Dum dynamic particle to use the model
G4DynamicParticle * aDynPart = new G4DynamicParticle(G4Electron::Electron(),G4ThreeVector(0.,0.,1.)*projectileP);
//Get the element from the direct model
const G4Element* elm = theDirectEMModel->SelectRandomAtom(currentCouple,G4Electron::Electron(),
projectileKinEnergy,currentTcutForDirectSecond);
G4int Z=elm->GetZasInt();
G4double energy = aDynPart->GetTotalEnergy()-gammaEnergy;
G4ThreeVector projectileMomentum =
theDirectEMModel->GetAngularDistribution()->SampleDirection(aDynPart,energy,Z,currentMaterial)*projectileP;
G4double phi = projectileMomentum.getPhi();
/*
//Angle of the gamma direction with the projectile taken from G4eBremsstrahlungModel
//------------------------------------------------
G4double u;
@@ -280,22 +297,19 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
G4double cost = std::cos(theta);
G4double phi = twopi * G4UniformRand() ;
G4ThreeVector projectileMomentum;
projectileMomentum=G4ThreeVector(std::cos(phi)*sint,std::sin(phi)*sint,cost)*projectileP; //gamma frame
*/
if (IsScatProjToProjCase) {//the adjoint primary is the scattered e-
G4ThreeVector gammaMomentum = (projectileTotalEnergy-adjointPrimTotalEnergy)*G4ThreeVector(0.,0.,1.);
G4ThreeVector dirProd=projectileMomentum-gammaMomentum;
G4double cost1 = std::cos(dirProd.angle(projectileMomentum));
G4double sint1 = std::sqrt(1.-cost1*cost1);
projectileMomentum=G4ThreeVector(std::cos(phi)*sint1,std::sin(phi)*sint1,cost1)*projectileP;
}
projectileMomentum.rotateUz(theAdjointPrimary->GetMomentumDirection());
if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
@@ -303,7 +317,6 @@ void G4AdjointBremsstrahlungModel::RapidSampleSecondaries(const G4Track& aTrack,
else {
fParticleChange->ProposeEnergy(projectileKinEnergy);
fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -316,13 +329,14 @@ G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond(con
theEmModelManagerForFwdModels->Initialise(G4Electron::Electron(),G4Gamma::Gamma(),1.,0);
isDirectModelInitialised =true;
}
/*
return DiffCrossSectionPerVolumePrimToSecondApproximated2(aMaterial,
kinEnergyProj,
kinEnergyProd);
/*return G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToSecond(aMaterial,
*/
return G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToSecond(aMaterial,
kinEnergyProj,
kinEnergyProd);*/
kinEnergyProd);
}
////////////////////////////////////////////////////////////////////////////////
@@ -376,22 +390,8 @@ G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecondAppr
G4double C1=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,(*theElementVector)[i]->GetZ(),dum ,E1);
G4double C2=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,(*theElementVector)[i]->GetZ(),dum,E2);
dCrossEprod += theAtomNumDensityVector[i] * (C1-C2)/dE;
}
//Now the Migdal correction
/*
G4double totalEnergy = kinEnergyProj+electron_mass_c2 ;
G4double kp2 = MigdalConstant*totalEnergy*totalEnergy
*(material->GetElectronDensity());
G4double MigdalFactor = 1./(1.+kp2/(kinEnergyProd*kinEnergyProd)); // its seems that the factor used in the CS compuation i the direct
//model is different than the one used in the secondary sampling by a
//factor (1.+kp2) To be checked!
dCrossEprod*=MigdalFactor;
*/
return dCrossEprod;
}
@@ -412,7 +412,7 @@ G4double G4AdjointBremsstrahlungModel::AdjointCrossSection(const G4MaterialCutsC
if (!IsScatProjToProjCase ){
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(primEnergy);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(primEnergy);
if (Emax_proj>Emin_proj && primEnergy > currentTcutForDirectSecond) Cross= 100.*CS_biasing_factor*lastCZ*std::log(Emax_proj/Emin_proj);
if (Emax_proj>Emin_proj && primEnergy > currentTcutForDirectSecond) Cross= CS_biasing_factor*lastCZ*std::log(Emax_proj/Emin_proj);
}
else {
G4double Emax_proj = GetSecondAdjEnergyMaxForScatProjToProjCase(primEnergy);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointComptonModel.cc 91870 2015-08-07 15:21:40Z gcosmo $
// $Id: G4AdjointComptonModel.cc 100666 2016-10-31 10:27:00Z gcosmo $
//
#include "G4AdjointComptonModel.hh"
#include "G4AdjointCSManager.hh"
@@ -193,7 +193,6 @@ void G4AdjointComptonModel::RapidSampleSecondaries(const G4Track& aTrack,
gammaE2 =adjointPrimKinEnergy;
gammaE1=Emin*std::pow(Emax/Emin,G4UniformRand());
diffCSUsed= diffCSUsed/gammaE1;
}
@@ -202,14 +201,17 @@ void G4AdjointComptonModel::RapidSampleSecondaries(const G4Track& aTrack,
//Weight correction
//-----------------------
//First w_corr is set to the ratio between adjoint total CS and fwd total CS
G4double w_corr=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
G4double w_corr=additional_weight_correction_factor_for_post_step_outside_model;
if (correct_weight_for_post_step_in_model) {
w_corr=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
}
//Then another correction is needed due to the fact that a biaised differential CS has been used rather than the
//one consistent with the direct model
G4double diffCS = DiffCrossSectionPerAtomPrimToScatPrim(gammaE1, gammaE2,1,0.);
if (diffCS >0) diffCS /=G4direct_CS; // here we have the normalised diffCS
//An we remultiply by the lambda of the forward process
diffCS*=theDirectEMProcess->GetLambda(gammaE1,currentCouple);
//diffCS*=theDirectEMModel->CrossSectionPerVolume(currentMaterial,G4Gamma::Gamma(),gammaE1,0.,2.*gammaE1);
//G4cout<<"diffCS/diffCSUsed "<<diffCS/diffCSUsed<<'\t'<<gammaE1<<'\t'<<gammaE2<<G4endl;
@@ -296,8 +298,8 @@ G4double G4AdjointComptonModel::DiffCrossSectionPerAtomPrimToScatPrim(
G4double Z,
G4double )
{ //Based on Klein Nishina formula
// In the forward case (see G4KleinNishinaModel) the cross section is parametrised
// the secondaries are sampled from the
// In the forward case (see G4KleinNishinaCompton) the cross section is parametrised
// but the secondaries are sampled from the
// Klein Nishida differential cross section
// The used diffrential cross section here is therefore the cross section multiplied by the normalised
//differential Klein Nishida cross section
@@ -0,0 +1,270 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointForcedInteractionForGamma.cc 87443 2014-12-04 12:26:31Z gunter $
//
#include "G4AdjointForcedInteractionForGamma.hh"
#include "G4SystemOfUnits.hh"
#include "G4AdjointCSManager.hh"
#include "G4AdjointCSMatrix.hh"
#include "G4VEmAdjointModel.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointGamma.hh"
G4AdjointForcedInteractionForGamma::
G4AdjointForcedInteractionForGamma(G4String process_name):
G4VContinuousDiscreteProcess(process_name),theAdjointComptonModel(0),theAdjointBremModel(0)
{ theAdjointCSManager = G4AdjointCSManager::GetAdjointCSManager();
fParticleChange=new G4ParticleChange();
lastAdjCS=0.;
trackid = nstep = 0;
is_free_flight_gamma = false;
copy_gamma_for_forced_interaction = false;
last_free_flight_trackid=1000;
theAdjointComptonModel =0;
theAdjointBremModel=0;
acc_track_length=0.;
acc_nb_adj_interaction_length=0.;
acc_nb_fwd_interaction_length=0.;
total_acc_nb_adj_interaction_length=0.;
total_acc_nb_fwd_interaction_length=0.;
continue_gamma_as_new_free_flight =false;
}
//////////////////////////////////////////////////////////////////////////////
//
G4AdjointForcedInteractionForGamma::
~G4AdjointForcedInteractionForGamma()
{ if (fParticleChange) delete fParticleChange;
}
//////////////////////////////////////////////////////////////////////////////
//
void G4AdjointForcedInteractionForGamma::PreparePhysicsTable(const G4ParticleDefinition&)
{;
}
//////////////////////////////////////////////////////////////////////////////
//
void G4AdjointForcedInteractionForGamma::BuildPhysicsTable(const G4ParticleDefinition&)
{
theAdjointCSManager->BuildCrossSectionMatrices(); //do not worry it will be done just once
theAdjointCSManager->BuildTotalSigmaTables();
}
//Note on weight correction for forced interaction
//For the forced interaction applied here we do use a truncated exponential law for the probability of survival
//over a fixed total length. This is done by using a linear transformation of the non biased probability survival
//In mathematic this writes
//P'(x)=C1P(x)+C2
//With P(x)=exp(-sum(sigma_ixi)) x and L can cross different volumes with different cross section sigma.
//For forced interaction we get the following limit conditions
//P'(L)=0 P'(0)=1 (L can be used over different volumes)
//From simple solving of linear equation we get
//C1=1/(1-P(L)) et C2=-P(L)/(1-P(L))
//P'(x)=(P(x)-P(L))/(1-P(L))
//For the probability over a step x1 to x2
//P'(x1->x2)=P'(x2)/P'(x1)
//The effective cross section is defined -d(P'(x))/dx/P'(x)
//We get therefore
//sigma_eff=C1sigmaP(x)/(C1P(x)+C2)=sigmaP(x)/(P(x)+C2/C1)=sigmaP(x)/(P(x)-P(L))=sigma/(1-P(L)/P(x))
//////////////////////////////////////////////////////////////////////////////
//
G4VParticleChange* G4AdjointForcedInteractionForGamma::PostStepDoIt(const G4Track& track, const G4Step& )
{ fParticleChange->Initialize(track);
//For the free flight gamma no interaction occur but a gamma with same property is
//produces for further forced interaction
//It is done at the very beginning of the track such that the weight can be the same
if (copy_gamma_for_forced_interaction) {
G4ThreeVector theGammaMomentum = track.GetMomentum();
fParticleChange->AddSecondary(new G4DynamicParticle(G4AdjointGamma::AdjointGamma(),theGammaMomentum));
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
}
else { //Occurrence of forced interaction
//Selection of the model to be called
G4VEmAdjointModel* theSelectedModel =0;
G4bool is_scat_proj_to_proj_case=false;
if (!theAdjointComptonModel && !theAdjointBremModel) return fParticleChange;
if (!theAdjointComptonModel) {
theSelectedModel = theAdjointBremModel;
is_scat_proj_to_proj_case=false;
//This is needed because the results of it will be used in the post step do it weight correction inside the model
theAdjointBremModel->AdjointCrossSection(
track.GetMaterialCutsCouple(),track.GetKineticEnergy(), false);
}
else if (!theAdjointBremModel) {
theSelectedModel = theAdjointComptonModel;
is_scat_proj_to_proj_case=true;
}
else { //Choose the model according to cross sections
G4double bremAdjCS = theAdjointBremModel->AdjointCrossSection(
track.GetMaterialCutsCouple(),track.GetKineticEnergy(), false);
if (G4UniformRand()*lastAdjCS<bremAdjCS) {
theSelectedModel = theAdjointBremModel;
is_scat_proj_to_proj_case=false;
}
else {
theSelectedModel = theAdjointComptonModel;
is_scat_proj_to_proj_case=true;
}
}
//Compute the weight correction factor
G4double one_over_effectiveAdjointCS= (1.-std::exp(acc_nb_adj_interaction_length-total_acc_nb_adj_interaction_length))/lastAdjCS;
G4double weight_correction_factor = lastAdjCS*one_over_effectiveAdjointCS;
//G4cout<<"Weight correction factor start "<<weight_correction_factor<<std::endl;
//Call the selected model without correction of the weight in the model
theSelectedModel->SetCorrectWeightForPostStepInModel(false);
theSelectedModel->SetAdditionalWeightCorrectionFactorForPostStepOutsideModel(weight_correction_factor);
theSelectedModel->SampleSecondaries(track,is_scat_proj_to_proj_case,fParticleChange);
theSelectedModel->SetCorrectWeightForPostStepInModel(true);
continue_gamma_as_new_free_flight =true;
}
return fParticleChange;
}
//////////////////////////////////////////////////////////////////////////////
//
G4VParticleChange* G4AdjointForcedInteractionForGamma::AlongStepDoIt(const G4Track& track, const G4Step& )
{ fParticleChange->Initialize(track);
//Compute nb of interactions length over step length
G4ThreeVector position = track.GetPosition();
G4double stepLength = track.GetStep()->GetStepLength();
G4double ekin = track.GetKineticEnergy();
G4double nb_fwd_interaction_length_over_step=0.;
G4double nb_adj_interaction_length_over_step=0.;
lastAdjCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(track.GetDefinition(), ekin, track.GetMaterialCutsCouple());
lastFwdCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalForwardCS(G4AdjointGamma::AdjointGamma(),
ekin,track.GetMaterialCutsCouple());
nb_fwd_interaction_length_over_step = stepLength*lastFwdCS;
nb_adj_interaction_length_over_step = stepLength*lastAdjCS;
G4double fwd_survival_probability=std::exp(-nb_fwd_interaction_length_over_step);
G4double mc_induced_survival_probability=1.;
if (is_free_flight_gamma) { //for free_flight survival probability stays 1
//Accumulate the number of interaction lengths during free flight of gamma
total_acc_nb_fwd_interaction_length+=nb_fwd_interaction_length_over_step;
total_acc_nb_adj_interaction_length+=nb_adj_interaction_length_over_step;
acc_track_length+=stepLength;
}
else {
G4double previous_acc_nb_adj_interaction_length =acc_nb_adj_interaction_length;
acc_nb_fwd_interaction_length+=nb_fwd_interaction_length_over_step;
acc_nb_adj_interaction_length+=nb_adj_interaction_length_over_step;
theNumberOfInteractionLengthLeft-=nb_adj_interaction_length_over_step;
mc_induced_survival_probability= std::exp(-acc_nb_adj_interaction_length)-std::exp(-total_acc_nb_adj_interaction_length);
mc_induced_survival_probability=mc_induced_survival_probability/(std::exp(-previous_acc_nb_adj_interaction_length)-std::exp(-total_acc_nb_adj_interaction_length));
}
G4double weight_correction = fwd_survival_probability/mc_induced_survival_probability;
//weight_correction = 1.;
//Caution!!!
// It is important to select the weight of the post_step_point
// as the current weight and not the weight of the track, as t
// the weight of the track is changed after having applied all
// the along_step_do_it.
G4double new_weight=weight_correction*track.GetStep()->GetPostStepPoint()->GetWeight();
/*
G4cout<<"New weight "<<new_weight<<std::endl;
G4cout<<"Weight correction "<<weight_correction<<std::endl;
*/
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
fParticleChange->ProposeParentWeight(new_weight);
return fParticleChange;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointForcedInteractionForGamma::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double ,
G4ForceCondition* condition)
{ G4int step_id = track.GetCurrentStepNumber();
*condition = NotForced;
copy_gamma_for_forced_interaction = false;
G4int track_id=track.GetTrackID();
is_free_flight_gamma = (track_id != last_free_flight_trackid+1 || continue_gamma_as_new_free_flight);
if (is_free_flight_gamma) {
if (step_id == 1 || continue_gamma_as_new_free_flight) {
*condition=Forced;
//A gamma with same conditions will be generate at next post_step do it for the forced interaction
copy_gamma_for_forced_interaction = true;
last_free_flight_trackid = track_id;
acc_track_length=0.;
total_acc_nb_adj_interaction_length=0.;
total_acc_nb_fwd_interaction_length=0.;
continue_gamma_as_new_free_flight=false;
return 1.e-90;
}
else {
//Computation of accumulated length for
return DBL_MAX;
}
}
else { //compute the interaction length for forced interaction
if (step_id ==1) {
G4double min_val= std::exp(-total_acc_nb_adj_interaction_length);
theNumberOfInteractionLengthLeft = -std::log( min_val+G4UniformRand()*(1.-min_val));
theInitialNumberOfInteractionLength = theNumberOfInteractionLengthLeft;
acc_nb_adj_interaction_length=0.;
acc_nb_fwd_interaction_length=0.;
}
G4VPhysicalVolume* thePostPhysVolume = track.GetStep()->GetPreStepPoint()->GetPhysicalVolume();
G4double ekin =track.GetKineticEnergy();
G4double postCS=0.;
if (thePostPhysVolume){
postCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(G4AdjointGamma::AdjointGamma(),
ekin,thePostPhysVolume->GetLogicalVolume()->GetMaterialCutsCouple());
}
if (postCS>0.) return theNumberOfInteractionLengthLeft/postCS;
else return DBL_MAX;
}
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointForcedInteractionForGamma::GetContinuousStepLimit(const G4Track& ,
G4double ,
G4double ,
G4double& )
{return DBL_MAX;
}
////////////////////////////////////////////////////////////////////////////////
//Not used in this process but should be implemented as virtual method
G4double G4AdjointForcedInteractionForGamma::GetMeanFreePath(const G4Track& ,
G4double ,
G4ForceCondition*)
{ return 0.;
}
File diff suppressed because it is too large Load Diff
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmAdjointModel.cc 93358 2015-10-19 13:41:21Z gcosmo $
// $Id: G4VEmAdjointModel.cc 100341 2016-10-18 08:02:25Z gcosmo $
//
#include "G4VEmAdjointModel.hh"
#include "G4AdjointCSManager.hh"
@@ -48,6 +48,7 @@ name(nam)
mass_ratio_product=1.;
mass_ratio_projectile=1.;
currentCouple=0;
additional_weight_correction_factor_for_post_step_outside_model=1.;
}
////////////////////////////////////////////////////////////////////////////////
//
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eAdjointMultipleScattering.cc 67990 2013-03-13 10:56:28Z gcosmo $
//
// -----------------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4eAdjointMultipleScattering
//
// Author: Vladimir Ivanchenko
//
// Creation date: 10 March 2008
//
// Modifications:
//
// -----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4eAdjointMultipleScattering.hh"
#include "G4UrbanAdjointMscModel.hh"
#include "G4MscStepLimitType.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4DynamicParticle.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4eAdjointMultipleScattering::G4eAdjointMultipleScattering(const G4String& processName)
: G4VMultipleScattering(processName)
{
isInitialized = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4eAdjointMultipleScattering::~G4eAdjointMultipleScattering()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4eAdjointMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4eAdjointMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
{
if(isInitialized) { return; }
if(!EmModel(1)) { SetEmModel(new G4UrbanAdjointMscModel(), 1); }
AddEmModel(1, EmModel(1));
isInitialized = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4eAdjointMultipleScattering::PrintInfo()
{
G4cout << " RangeFactor= " << RangeFactor()
<< ", stepLimitType: " << StepLimitType()
<< ", latDisplacement: " << LateralDisplasmentFlag();
if(StepLimitType() == fUseDistanceToBoundary) {
G4cout << ", skin= " << Skin() << ", geomFactor= " << GeomFactor();
}
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4eAdjointMultipleScattering::StartTracking(G4Track* )
{ G4DynamicParticle* aDynPart = new G4DynamicParticle(G4Electron::Electron(), G4ThreeVector(0.,0.,1.),1.);
G4Track* tempTrack = new G4Track(aDynPart,0.,G4ThreeVector(0.,0.,0.));
G4VMultipleScattering::StartTracking( tempTrack);
delete tempTrack;
}