Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.6 2006/09/21 21:35:20 vnivanch Exp $
# $Id: GNUmakefile,v 1.7 2008/11/14 19:54:40 gcosmo Exp $
# ------------------------------------------------------------------
# GNUmakefile for electromagnetic library. Gabriele Cosmo, 18/9/96.
# ------------------------------------------------------------------
@@ -7,8 +7,8 @@ MAKEFLAGS= --no-print-directory
name := G4electromagnetic
SUBDIRS = muons standard utils xrays lowenergy highenergy polarisation
SUBLIBS = G4muons G4emstandard G4emutils G4xrays G4emlowenergy G4emhighenergy G4polar
SUBDIRS = muons standard utils xrays lowenergy highenergy adjoint polarisation
SUBLIBS = G4muons G4emstandard G4emutils G4xrays G4emlowenergy G4emhighenergy G4emadjoint G4polar
ifndef G4INSTALL
G4INSTALL = ../../..
@@ -0,0 +1,37 @@
# $Id: GNUmakefile,v 1.2 2008/11/14 20:47:47 vnivanch Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. G.Cosmo, 14/11/2008.
# --------------------------------------------------------------------
name := G4emadjoint
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/adjoint/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,22 @@
$Id: History,v 1.1 2008/11/14 19:54:40 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14 Nov 2008: G.Cosmo (emadjoint-V09-01-00)
- First commit.
@@ -0,0 +1,138 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointAlongStepWeightCorrection.hh
// Author: L. Desorgher
// Date: 10 May 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 10 May 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Continuous processes acting on adjoint particles to correct continuously their weight during the adjoint reverse tracking.
//
#ifndef G4AdjointAlongStepWeightCorrection_h
#define G4AdjointAlongStepWeightCorrection_h 1
#include "G4VContinuousProcess.hh"
#include "globals.hh"
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Track.hh"
#include "G4ParticleChange.hh"
class G4Step;
class G4ParticleDefinition;
class G4AdjointAlongStepWeightCorrection : public G4VContinuousProcess
{
public:
G4AdjointAlongStepWeightCorrection(const G4String& name = "ContinuousWeightCorrection",
G4ProcessType type = fElectromagnetic);
virtual ~G4AdjointAlongStepWeightCorrection();
protected:
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Generic methods common to all processes
//------------------------------------------------------------------------
public:
void PreparePhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
private:
void DefineMaterial(const G4MaterialCutsCouple* couple);
G4AdjointAlongStepWeightCorrection(G4AdjointAlongStepWeightCorrection &);
G4AdjointAlongStepWeightCorrection & operator=(const G4AdjointAlongStepWeightCorrection &right);
protected:
G4ParticleChange* fParticleChange;
private:
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
G4double currentTcut;
G4double preStepKinEnergy;
};
inline void G4AdjointAlongStepWeightCorrection::DefineMaterial(
const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
//G4cout<<"Define Material"<<std::endl;
//if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
}
}
///////////////////////////////////////////////////////
//
inline G4double G4AdjointAlongStepWeightCorrection::GetContinuousStepLimit(const G4Track& track,
G4double , G4double , G4double& )
{
G4double x = DBL_MAX;
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
return x;
}
#endif
@@ -0,0 +1,133 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointBremsstrahlungModel.hh
// Author: L. Desorgher
// Date: 15 June 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 15 June 2007 creation by L. Desorgher. Adapted from G4eBremsstrahlungModel
//
//-------------------------------------------------------------
// Documentation:
// Adjoint Model for e- Bremsstrahlung
//
#ifndef G4AdjointBremsstrahlungModel_h
#define G4AdjointBremsstrahlungModel_h 1
#include "globals.hh"
#include "G4VEmAdjointModel.hh"
#include "G4eBremsstrahlungModel.hh"
class G4Timer;
class G4AdjointBremsstrahlungModel: public G4VEmAdjointModel
{
public:
G4AdjointBremsstrahlungModel();
~G4AdjointBremsstrahlungModel();
virtual void SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange);
virtual G4double DiffCrossSectionPerVolumePrimToSecond(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
);
G4double DiffCrossSectionPerVolumePrimToSecond1(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
);
G4double DiffCrossSectionPerVolumePrimToSecond2(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
);
G4double DiffCrossSectionPerVolumePrimToSecond3(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
);
void DefineDirectBremModel(G4eBremsstrahlungModel* aModel);
inline void SetdCSModel(G4String aString) {ModeldCS=aString;}
private:
void InitialiseParameters();
G4double SupressionFunction(const G4Material* material, G4double tkin,
G4double gammaEnergy);
private:
G4eBremsstrahlungModel* theDirectBremModel;
G4double highKinEnergy;
G4double lowKinEnergy;
G4double probsup;
G4double MigdalConstant;
G4double LPMconstant;
G4double highEnergyTh;
G4bool theLPMflag;
G4bool isElectron;
//Vector
std::vector<float> FZ;
std::vector<float> ah1;
std::vector<float> ah2;
std::vector<float> ah3;
std::vector<float> bh1;
std::vector<float> bh2;
std::vector<float> bh3;
std::vector<float> al0;
std::vector<float> al1;
std::vector<float> al2;
std::vector<float> bl0;
std::vector<float> bl1;
std::vector<float> bl2;
std::vector<float> SigmaPerAtom;
G4Timer* theTimer;
G4String ModeldCS;
};
#endif
@@ -0,0 +1,207 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointCSManager.hh
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Is responsible for the management of all adjoint cross sections matrices, and for the computation of the total forward and adjoint cross sections.
// Total adjoint and forward cross sections are needed to correct continuously the weight of a particle after a tracking step.
// It is also used to sample an adjoint secondary from a given adjoint cross section matrix.
//
#ifndef G4AdjointCSManager_h
#define G4AdjointCSManager_h 1
#include"globals.hh"
#include<vector>
#include"G4AdjointCSMatrix.hh"
class G4VEmAdjointModel;
class G4MaterialCutsCouple;
class G4Material;
class G4ParticleDefinition;
class G4Element;
class G4VEmProcess;
class G4VEnergyLossProcess;
class G4PhysicsTable;
////////////////////////////////////////////////////////////////////////////////
//
class G4AdjointCSManager
{
public:
~G4AdjointCSManager();
static G4AdjointCSManager* GetAdjointCSManager();
public:
G4int GetNbProcesses();
//Registration of the different models and processes
void RegisterEmAdjointModel(G4VEmAdjointModel*);
void RegisterEmProcess(G4VEmProcess* aProcess, G4ParticleDefinition* aPartDef);
void RegisterEnergyLossProcess(G4VEnergyLossProcess* aProcess, G4ParticleDefinition* aPartDef);
void RegisterAdjointParticle(G4ParticleDefinition* aPartDef);
//Building of thr CS Matrices and Total Forward and Adjoint LambdaTables
//----------------------------------------------------------------------
void BuildCrossSectionMatrices();
void BuildTotalSigmaTables();
//Get TotalCrossSections form Total Lambda Tables
//-------------------------------------------------
G4double GetTotalAdjointCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple);
G4double GetTotalForwardCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple);
//Weight correction
//------------------
G4double GetContinuousWeightCorrection(G4ParticleDefinition* aPartDef, G4double PreStepEkin,G4double AfterStepEkin,
const G4MaterialCutsCouple* aCouple, G4double step_length);
G4double GetPostStepWeightCorrection(G4ParticleDefinition* aPrimPartDef, G4ParticleDefinition* aSecondPartDef,
G4double EkinPrim,G4double EkinSecond,
const G4MaterialCutsCouple* aCouple);
double ComputeAdjointCS(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase,
std::vector<double>&
AdjointCS_for_each_element);
G4Element* SampleElementFromCSMatrices(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase);
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple* aMatCutCouple,G4ParticleDefinition* aPart,G4double PrimEnergy);
G4ParticleDefinition* GetAdjointParticleEquivalent(G4ParticleDefinition* theFwdPartDef);
G4ParticleDefinition* GetForwardParticleEquivalent(G4ParticleDefinition* theAdjPartDef);
//inline
inline void SetTmin(G4double aVal){Tmin=aVal;}
inline void SetTmax(G4double aVal){Tmax=aVal;}
inline void SetNbins(G4int aInt){nbins=aInt;}
//inline
inline void ConsiderContinuousWeightCorrection(G4bool aBool){consider_continuous_weight_correction=aBool;}
inline void ConsiderPoststepWeightCorrection(G4bool aBool){consider_poststep_weight_correction=aBool;}
private:
static G4AdjointCSManager* theInstance;
std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForScatProjToProj; //x dim is for G4VAdjointEM* while y dim is for elements
std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForProdToProj;
std::vector< G4VEmAdjointModel*> listOfAdjointEMModel;
std::vector<G4AdjointCSMatrix*>
BuildCrossSectionsMatricesForAGivenModelAndElement(G4VEmAdjointModel* aModel,
G4int Z,
G4int A,
G4int nbin_pro_decade);
std::vector<G4AdjointCSMatrix*>
BuildCrossSectionsMatricesForAGivenModelAndMaterial(G4VEmAdjointModel* aModel,
G4Material* aMaterial,
G4int nbin_pro_decade);
G4Material* lastMaterial;
G4double lastPrimaryEnergy;
G4double lastTcut;
std::vector< size_t> listOfIndexOfAdjointEMModelInAction;
std::vector< G4bool> listOfIsScatProjToProjCase;
std::vector< std::vector<double> > lastAdjointCSVsModelsAndElements;
G4bool CrossSectionMatrixesAreBuilt;
//total adjoint and total forward cross section table in function of material and in function of adjoint particle type
//--------------------------------------------------------------------------------------------------------------------
std::vector<G4PhysicsTable*> theTotalForwardSigmaTableVector;
std::vector<G4PhysicsTable*> theTotalAdjointSigmaTableVector;
//list of forward G4VEMLossProcess and of G4VEMProcess for the different adjoint particle
//--------------------------------------------------------------
std::vector< std::vector<G4VEmProcess*>* > listOfForwardEmProcess;
std::vector< std::vector<G4VEnergyLossProcess*>* > listOfForwardEnergyLossProcess;
//list of adjoint particles considered
std::vector< G4ParticleDefinition*> theListOfAdjointParticlesInAction;
G4double Tmin,Tmax;
G4int nbins;
//Current material
//----------------
G4MaterialCutsCouple* currentCouple;
G4Material* currentMaterial;
size_t currentMatIndex;
int verbose;
//Weight correction
//------------------
G4bool consider_continuous_weight_correction;
G4bool consider_poststep_weight_correction;
private:
G4AdjointCSManager();
void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
double ComputeAdjointCS(G4double aPrimEnergy, G4AdjointCSMatrix* anAdjointCSMatrix, G4double Tcut);
};
#endif
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointCSMatrix.hh
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// An adjoint CS matrix is used by the model of a reverse process to sample an adjoint secondary (being equivalent to a forward primary).
// It represents the integration over the energy of the adjoint secondary (therefore the forward primary) of the differential cross section
// of the equiavlent forward discrete process (Ionisation, Brem, PE effect, Compton,..) . Each reverse model has its own cross section matrix for a given cut,
// material couple. It is therefore recompute after a modification of the cuts by the user.
//
//
//
#ifndef G4AdjointCSMatrix_h
#define G4AdjointCSMatrix_h 1
#include"globals.hh"
#include<vector>
#include"G4ParticleDefinition.hh"
////////////////////////////////////////////////////////////////////////////////
//
class G4AdjointCSMatrix
{
////////////////////////////////
// Constructors and Destructor
////////////////////////////////
public:
G4AdjointCSMatrix(G4bool aBool);
~G4AdjointCSMatrix();
////////////
// Methods
////////////
void Clear();
void AddData(G4double aPrimEnergy,G4double aCS, std::vector< G4double>* aLogSecondEnergyVector,
std::vector< G4double>* aLogProbVector,size_t n_pro_decade=0);
bool GetData(unsigned int i, G4double& aPrimEnergy,G4double& aCS,G4double& log0, std::vector< G4double>*& aLogSecondEnergyVector,
std::vector< G4double>*& aLogProbVector,
std::vector< size_t>*& aLogProbVectorIndex);
inline std::vector< G4double >* GetLogPrimEnergyVector(){return &theLogPrimEnergyVector;}
inline std::vector< G4double >* GetLogCrossSectionvector(){return &theLogCrossSectionVector;}
inline G4double GetDlog(){return dlog;}
inline G4bool IsScatProjToProjCase(){return is_scat_proj_to_proj_case;}
void Write(G4String file_name);
void Read(G4String file_name);
private:
// we did first try to use G4PhysicsOrderedVector but they are not general enough for our purpose
std::vector< G4double > theLogPrimEnergyVector;
std::vector< G4double > theLogCrossSectionVector; //Adjoint Cross sections in function of primary energy
std::vector< std::vector< G4double >* > theLogSecondEnergyMatrix;
std::vector< std::vector< G4double >* > theLogProbMatrix; //Each column represents the integrated probability of getting a secondary
// in function of their energy
std::vector< std::vector< size_t >* > theLogProbMatrixIndex; //index of euqidistant LogProb
std::vector< G4double > log0Vector;
unsigned int nb_of_PrimEnergy;
G4bool is_scat_proj_to_proj_case;
G4double dlog;
};
#endif
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointComptonModel.hh
// Author: L. Desorgher
// Date: 1 September 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1 September 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Model for the adjoint compton scattering
//
#ifndef G4AdjointComptonModel_h
#define G4AdjointComptonModel_h 1
#include "globals.hh"
#include "G4VEmAdjointModel.hh"
class G4AdjointComptonModel: public G4VEmAdjointModel
{
public:
G4AdjointComptonModel();
~G4AdjointComptonModel();
virtual void SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange);
virtual G4double DiffCrossSectionPerAtomPrimToScatPrim(
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyScatProj, // kinetic energy of the primary particle after the interaction
G4double Z,
G4double A = 0.);
virtual G4double DiffCrossSectionPerAtomPrimToSecond(
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd, // kinetic energy of the secondary particle
G4double Z,
G4double A = 0.);
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
private:
};
#endif
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointInterpolator.hh
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Used by G4AdjointCSManager for interpolation purpose.
//
#ifndef G4AdjointInterpolator_h
#define G4AdjointInterpolator_h 1
#include"globals.hh"
#include<vector>
////////////////////////////////////////////////////////////////////////////////
//
class G4AdjointInterpolator
{
public:
static G4AdjointInterpolator* GetAdjointInterpolator();
static G4AdjointInterpolator* GetInstance();
public:
////////////////////////////////
// Constructors and Destructor
////////////////////////////////
~G4AdjointInterpolator();
////////////
// Methods
////////////
//Caution everywher it is considere thta x_vec increase monotically
G4double LinearInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2);
G4double LogarithmicInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2);
G4double ExponentialInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2);
G4double Interpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double &y2,G4String InterPolMethod="Log");
size_t FindPosition(G4double& x,std::vector<double>& x_vec,size_t ind_min=0, size_t ind_max=0);
size_t FindPositionForLogVector(G4double& x,std::vector<double>& x_vec);
G4double Interpolate(G4double& x,std::vector<double>& x_vec,std::vector<double>& y_vec,G4String InterPolMethod="Log"); //xvec should monotically increase
G4double InterpolateWithIndexVector(G4double& x,std::vector<double>& x_vec,std::vector<double>& y_vec,
std::vector<size_t>& index_vec, G4double x0,G4double dx); //xvec should monotically increase
G4double InterpolateForLogVector(G4double& x,std::vector<double>& x_vec,std::vector<double>& y_vec);
private:
static G4AdjointInterpolator* theInstance;
private:
G4AdjointInterpolator();
};
#endif
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointPhotoElectricModel.hh
// Author: L. Desorgher
// Date: 10 October 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1 September 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Model for the adjoint photo electric process
//
#ifndef G4AdjointPhotoElectricModel_h
#define G4AdjointPhotoElectricModel_h 1
#include "globals.hh"
#include "G4VEmAdjointModel.hh"
#include "G4PEEffectModel.hh"
class G4AdjointPhotoElectricModel: public G4VEmAdjointModel
{
public:
G4AdjointPhotoElectricModel();
~G4AdjointPhotoElectricModel();
virtual void SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange);
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
G4double primEnergy,
G4bool IsScatProjToProjCase);
G4double AdjointCrossSectionPerAtom(const G4Element* anElement,G4double electronEnergy);
inline void SetTheDirectPEEffectModel(G4PEEffectModel* aModel){theDirectPEEffectModel = aModel;
DefineDirectEMModel(aModel);}
private:
G4double xsec[40];
G4double totAdjointCS;
G4double shell_prob[40][40];
G4PEEffectModel* theDirectPEEffectModel;
size_t index_element;
G4double current_eEnergy;
private:
void DefineCurrentMaterialAndElectronEnergy(const G4MaterialCutsCouple* aCouple,
G4double eEnergy);
};
#endif
@@ -0,0 +1,181 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4ContinuousGainOfEnergy.hh
// Author: L. Desorgher
// Date: 10 May 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 10 May 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Continuous process acting on adjoint particles to compute the continuous gain of energy of charged particels whern they are tracked back!
//
#ifndef G4ContinuousGainOfEnergy_h
#define G4ContinuousGainOfEnergy_h 1
#include "G4VContinuousProcess.hh"
#include "globals.hh"
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
#include "G4ParticleChange.hh"
#include "G4VEnergyLossProcess.hh"
class G4Step;
class G4ParticleDefinition;
class G4VEmModel;
class G4VEmFluctuationModel;
class G4ContinuousGainOfEnergy : public G4VContinuousProcess
{
public:
G4ContinuousGainOfEnergy(const G4String& name = "EnergyGain",
G4ProcessType type = fElectromagnetic);
virtual ~G4ContinuousGainOfEnergy();
protected:
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
protected:
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Generic methods common to all processes
//------------------------------------------------------------------------
public:
void PreparePhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
void SetLossFluctuations(G4bool val);
inline void SetIsIntegral(G4bool val){is_integral= val;}
inline void SetDirectEnergyLossProcess(G4VEnergyLossProcess* aProcess){theDirectEnergyLossProcess=aProcess;};
inline void SetDirectParticle(G4ParticleDefinition* p){theDirectPartDef=p;};
protected:
private:
void DefineMaterial(const G4MaterialCutsCouple* couple);
// hide assignment operator
G4ContinuousGainOfEnergy(G4ContinuousGainOfEnergy &);
G4ContinuousGainOfEnergy & operator=(const G4ContinuousGainOfEnergy &right);
private:
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
G4double currentTcut;
G4double preStepKinEnergy;
G4double linLossLimit;
G4bool lossFluctuationFlag;
G4bool lossFluctuationArePossible;
G4VEnergyLossProcess* theDirectEnergyLossProcess;
G4ParticleDefinition* theDirectPartDef;
G4bool is_integral;
};
///////////////////////////////////////////////////////
//
inline void G4ContinuousGainOfEnergy::DefineMaterial(
const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
currentTcut = couple->GetProductionCuts()->GetProductionCut(theDirectPartDef->GetParticleName());
//G4cout<<"Define Material"<<std::endl;
//if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
}
}
///////////////////////////////////////////////////////
//
inline G4double G4ContinuousGainOfEnergy::GetContinuousStepLimit(const G4Track& track,
G4double , G4double , G4double& )
{
G4double x = DBL_MAX;
x=.1*mm;
//G4cout<<x<<std::endl;
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
G4double maxE=1.2*preStepKinEnergy;
G4double r = theDirectEnergyLossProcess->GetRange(preStepKinEnergy, currentCouple);
G4double r1 = theDirectEnergyLossProcess->GetRange(maxE, currentCouple);
x=std::max(r1-r,.1);
return x;
}
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointPEEffect.hh
// Author: L. Desorgher
// Date: 25 October 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 25 October 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Adjoint/reverse photo electric process
//
#ifndef G4InversePEEffect_h
#define G4InversePEEffect_h 1
#include "G4VAdjointInverseScattering.hh"
#include "globals.hh"
class G4AdjointPhotoElectricModel;
class G4InversePEEffect: public G4VAdjointInverseScattering
{
public:
G4InversePEEffect(G4String process_name, G4AdjointPhotoElectricModel* aModel);
~G4InversePEEffect();
private:
};
#endif
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4VAdjointInverseScattering.hh
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Abastract class for adjoint/reverse discrete scattering
//
#ifndef G4VAdjointInverseScattering_h
#define G4VAdjointInverseScattering_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 "G4VDiscreteProcess.hh"
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4ParticleChange;
class G4Track;
class G4VEmAdjointModel;
class G4AdjointCSMatrix;
class G4AdjointCSManager;
class G4Material;
class G4MaterialCutsCouple;
class G4VAdjointInverseScattering : public G4VDiscreteProcess
{
public:
G4VAdjointInverseScattering(G4String process_name,G4bool whichScatCase);
virtual ~G4VAdjointInverseScattering();
public:
void PreparePhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
protected :// with description
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
protected:
G4VEmAdjointModel* theAdjointEMModel;
G4ParticleChange* fParticleChange;
G4AdjointCSManager* theAdjointCSManager;
private:
G4Material* currentMaterial;
G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
G4double currentTcut;
G4double lastCS;
std::vector<double> CS_Vs_Element;
G4bool IsScatProjToProjCase;
};
#endif
@@ -0,0 +1,341 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4VEMAdjointModel.hh
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Base class for Adjoint model
//
#ifndef G4VEmAdjointModel_h
#define G4VEmAdjointModel_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 "G4VEmModel.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4ProductionCutsTable.hh"
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4ParticleChange;
class G4Track;
class G4AdjointCSMatrix;
class G4VEmAdjointModel
{
public:
G4VEmAdjointModel(const G4String& nam);
virtual ~G4VEmAdjointModel();
//------------------------------------------------------------------------
// Virtual methods to be implemented for the concrete model
//------------------------------------------------------------------------
//virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0;
virtual void SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange);
//------------------------------------------------------------------------
// Methods for adjoint processes; may be overwritten if needed;
//------------------------------------------------------------------------
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
G4double primEnergy,
G4bool IsScatProjToProjCase);
virtual G4double DiffCrossSectionPerAtomPrimToSecond(
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd, // kinetic energy of the secondary particle
G4double Z,
G4double A = 0.);
virtual G4double DiffCrossSectionPerAtomPrimToScatPrim(
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyScatProj, // kinetic energy of the primary particle after the interaction
G4double Z,
G4double A = 0.);
virtual G4double DiffCrossSectionPerVolumePrimToSecond(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
);
virtual G4double DiffCrossSectionPerVolumePrimToScatPrim(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyScatProj // kinetic energy of the primary particle after the interaction
);
G4double DiffCrossSectionFunction1(G4double kinEnergyProj);
G4double DiffCrossSectionMoller(G4double kinEnergyProj,G4double kinEnergyProd);
G4double DiffCrossSectionFunction2(G4double kinEnergyProj);
std::vector< std::vector< G4double >* > ComputeAdjointCrossSectionVectorPerAtomForSecond(
G4double kinEnergyProd,
G4double Z,
G4double A = 0.,
G4int nbin_pro_decade=10
);
std::vector< std::vector< G4double >* > ComputeAdjointCrossSectionVectorPerAtomForScatProj(
G4double kinEnergyProd,
G4double Z,
G4double A = 0.,
G4int nbin_pro_decade=10
);
std::vector< std::vector< G4double >* > ComputeAdjointCrossSectionVectorPerVolumeForSecond(
G4Material* aMaterial,
G4double kinEnergyProd,
G4int nbin_pro_decade=10
);
std::vector< std::vector< G4double >* > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(
G4Material* aMaterial,
G4double kinEnergyProd,
G4int nbin_pro_decade=10
);
virtual G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex,G4double prim_energy,G4bool IsScatProjToProjCase);
virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom(G4double prim_energy,G4bool IsScatProjToProjCase);
void CorrectPostStepWeight(G4ParticleChange* fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy);
//Set/Get methods
//------------------
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut=0);
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy);
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
virtual void SetCSBiasingFactor(G4double aVal) {CS_biasing_factor = aVal;}
public:
inline void SetCSMatrices(std::vector< G4AdjointCSMatrix* >* Vec1CSMatrix, std::vector< G4AdjointCSMatrix* >* Vec2CSMatrix){
pOnCSMatrixForProdToProjBackwardScattering = Vec1CSMatrix;
pOnCSMatrixForScatProjToProjBackwardScattering = Vec2CSMatrix;
};
inline G4ParticleDefinition* GetAdjointEquivalentOfDirectPrimaryParticleDefinition(){return theAdjEquivOfDirectPrimPartDef;}
inline G4ParticleDefinition* GetAdjointEquivalentOfDirectSecondaryParticleDefinition(){return theAdjEquivOfDirectSecondPartDef;}
inline G4double GetHighEnergyLimit(){return HighEnergyLimit;}
inline G4double GetLowEnergyLimit(){return LowEnergyLimit;}
inline void SetHighEnergyLimit(G4double aVal){HighEnergyLimit=aVal;}
inline void SetLowEnergyLimit(G4double aVal){LowEnergyLimit=aVal;}
inline void SetCorrectWeightMode(G4bool aBool){CorrectWeightMode=aBool;};
inline void SetApplyBiasing(G4bool aBool){ApplyBiasing=aBool;};
inline void DefineDirectEMModel(G4VEmModel* aModel){theDirectEMModel = aModel;}
inline void SetAdjointEquivalentOfDirectPrimaryParticleDefinition(G4ParticleDefinition* aPart){
theAdjEquivOfDirectPrimPartDef=aPart;
if (theAdjEquivOfDirectPrimPartDef->GetParticleName() =="adj_e-")
theDirectPrimaryPartDef=G4Electron::Electron();
if (theAdjEquivOfDirectPrimPartDef->GetParticleName() =="adj_gamma")
theDirectPrimaryPartDef=G4Gamma::Gamma();
}
inline void SetAdjointEquivalentOfDirectSecondaryParticleDefinition(G4ParticleDefinition* aPart){
theAdjEquivOfDirectSecondPartDef =aPart;
}
inline void SetSecondPartOfSameType(G4bool aBool){second_part_of_same_type =aBool;}
bool GetSecondPartOfSameType(){return second_part_of_same_type;}
inline void SetUseMatrix(G4bool aBool) { UseMatrix = aBool;}
inline void SetUseMatrixPerElement(G4bool aBool){ UseMatrixPerElement = aBool;}
inline void SetUseOnlyOneMatrixForAllElements(G4bool aBool){ UseOnlyOneMatrixForAllElements = aBool;}
inline void SetApplyCutInRange(G4bool aBool){ ApplyCutInRange = aBool;}
inline void SetIsIonisation(G4bool aBool){ IsIonisation = aBool;}
inline G4bool GetUseMatrix() {return UseMatrix;}
inline G4bool GetUseMatrixPerElement(){ return UseMatrixPerElement;}
inline G4bool GetUseOnlyOneMatrixForAllElements(){ return UseOnlyOneMatrixForAllElements;}
inline G4bool GetApplyCutInRange(){ return ApplyCutInRange;}
void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
inline G4String GetName(){ return name;}
private: //Methods
protected:
G4VEmModel* theDirectEMModel;
G4VParticleChange* pParticleChange;
protected:
// hide assignment operator
G4VEmAdjointModel & operator=(const G4VEmAdjointModel &right);
G4VEmAdjointModel(const G4VEmAdjointModel&);
//Name
//-----
const G4String name;
//Needed for CS integration at the initialisation phase
//-----------------------------------------------------
G4int ASelectedNucleus;
G4int ZSelectedNucleus;
G4Material* SelectedMaterial;
G4double kinEnergyProdForIntegration;
G4double kinEnergyScatProjForIntegration;
//for the adjoint simulation we need for each element or material:
//an adjoint CS Matrix
//-----------------------------
std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForProdToProjBackwardScattering;
std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForScatProjToProjBackwardScattering;
std::vector<double> CS_Vs_ElementForScatProjToProjCase;
std::vector<double> CS_Vs_ElementForProdToProjCase;
G4double lastCS;
//particle definition
//------------------
G4ParticleDefinition* theAdjEquivOfDirectPrimPartDef;
G4ParticleDefinition* theAdjEquivOfDirectSecondPartDef;
G4ParticleDefinition* theDirectPrimaryPartDef;
G4bool second_part_of_same_type;
//Current couple material
//----------------------
G4Material* currentMaterial;
G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
size_t currentCoupleIndex;
G4double currentTcutForDirectPrim;
G4double currentTcutForDirectSecond;
G4bool ApplyCutInRange;
//CorrectWeightMode
//------------------
bool CorrectWeightMode;
//Apply biasing
//------------
bool ApplyBiasing;
//Energy limits
//-------------
G4double HighEnergyLimit;
G4double LowEnergyLimit;
//Cross Section biasing factor
//---------------------------
G4double CS_biasing_factor;
//Type of Model with Matrix or not
//--------------------------------
bool UseMatrix;
bool UseMatrixPerElement; //other possibility is per Material
bool UseOnlyOneMatrixForAllElements;
bool IsIonisation;
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4eInverseBremstrahlung.hh
// Author: L. Desorgher
// Date: 25 October 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 25 October 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Adjoint/reverse bremstrahlung
//
#ifndef G4eInverseBremsstrahlung_h
#define G4eInverseBremsstrahlung_h 1
#include "G4VAdjointInverseScattering.hh"
#include "globals.hh"
#include "G4eIonisation.hh"
class G4AdjointBremsstrahlungModel;
class G4eInverseBremsstrahlung: public G4VAdjointInverseScattering
{
public:
G4eInverseBremsstrahlung(G4bool whichScatCase, G4String process_name, G4AdjointBremsstrahlungModel* aEmAdjointModel);
~G4eInverseBremsstrahlung();
private:
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4eInverseCompton.hh
// Author: L. Desorgher
// Date: 25 October 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 25 October 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Adjoint/reverse Compton
//
#ifndef G4eInverseCompton_h
#define G4eInverseCompton_h 1
#include "G4VAdjointInverseScattering.hh"
#include "globals.hh"
#include "G4eIonisation.hh"
class G4AdjointComptonModel;
class G4eInverseCompton: public G4VAdjointInverseScattering
{
public:
G4eInverseCompton(G4bool whichScatCase, G4String process_name, G4AdjointComptonModel* aEmAdjointModel);
~G4eInverseCompton();
private:
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4eInverseIonisation.hh
// Author: L. Desorgher
// Date: 15 April 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 15 April 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Adjoint/revrese discrete ionisation
//
#ifndef G4eInverseIonisation_h
#define G4eInverseIonisation_h 1
#include "G4VAdjointInverseScattering.hh"
#include "globals.hh"
#include "G4eIonisation.hh"
#include "G4VEmAdjointModel.hh"
class G4eInverseIonisation: public G4VAdjointInverseScattering
{
public:
G4eInverseIonisation(G4bool whichScatCase, G4String process_name, G4VEmAdjointModel* aEmAdjointModel);
~G4eInverseIonisation();
private:
};
#endif
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointAlongStepWeightCorrection.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VParticleChange.hh"
#include "G4AdjointCSManager.hh"
///////////////////////////////////////////////////////
//
G4AdjointAlongStepWeightCorrection::G4AdjointAlongStepWeightCorrection(const G4String& name,
G4ProcessType type): G4VContinuousProcess(name, type)
{fParticleChange = new G4ParticleChange();
}
///////////////////////////////////////////////////////
//
G4AdjointAlongStepWeightCorrection::~G4AdjointAlongStepWeightCorrection()
{;
}
///////////////////////////////////////////////////////
//
void G4AdjointAlongStepWeightCorrection::PreparePhysicsTable(
const G4ParticleDefinition& )
{
;
}
///////////////////////////////////////////////////////
//
void G4AdjointAlongStepWeightCorrection::BuildPhysicsTable(const G4ParticleDefinition& )
{;
}
///////////////////////////////////////////////////////
//
G4VParticleChange* G4AdjointAlongStepWeightCorrection::AlongStepDoIt(const G4Track& track,
const G4Step& step)
{
fParticleChange->Initialize(track);
// Get the actual (true) Step length
//----------------------------------
G4double length = step.GetStepLength();
G4double Tkin = step.GetPostStepPoint()->GetKineticEnergy();
G4ParticleDefinition* thePartDef= const_cast<G4ParticleDefinition*> (track.GetDynamicParticle()->GetDefinition());
G4double weight_correction=G4AdjointCSManager::GetAdjointCSManager()->GetContinuousWeightCorrection(thePartDef,
preStepKinEnergy,Tkin, currentCouple,length);
G4double new_weight=weight_correction*track.GetWeight();
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
fParticleChange->ProposeParentWeight(new_weight);
return fParticleChange;
}
@@ -0,0 +1,664 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointBremsstrahlungModel.hh"
#include "G4AdjointCSManager.hh"
#include "G4Integrator.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointElectron.hh"
#include "G4Timer.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointBremsstrahlungModel::G4AdjointBremsstrahlungModel():
G4VEmAdjointModel("AdjointBremModel"),
probsup(1.0),
MigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length/pi),
LPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)),
theLPMflag(true)
{ isElectron= true;
SetUseMatrix(true);
SetUseMatrixPerElement(false);
SetApplyCutInRange(true);
SetIsIonisation(false);
highKinEnergy= 100.*TeV;
lowKinEnergy = 1.0*keV;
theTimer =new G4Timer();
theTimer->Start();
InitialiseParameters();
theTimer->Stop();
G4cout<<"Time elapsed in second for the initialidation of AdjointBrem "<<theTimer->GetRealElapsed()<<std::endl;
ModeldCS="MODEL1";
}
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointBremsstrahlungModel::~G4AdjointBremsstrahlungModel()
{;}
////////////////////////////////////////////////////////////////////////////////
//
/*G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
)
{
static const G4double
ah10 = 4.67733E+00, ah11 =-6.19012E-01, ah12 = 2.02225E-02,
ah20 =-7.34101E+00, ah21 = 1.00462E+00, ah22 =-3.20985E-02,
ah30 = 2.93119E+00, ah31 =-4.03761E-01, ah32 = 1.25153E-02;
static const G4double
bh10 = 4.23071E+00, bh11 =-6.10995E-01, bh12 = 1.95531E-02,
bh20 =-7.12527E+00, bh21 = 9.69160E-01, bh22 =-2.74255E-02,
bh30 = 2.69925E+00, bh31 =-3.63283E-01, bh32 = 9.55316E-03;
static const G4double
al00 =-2.05398E+00, al01 = 2.38815E-02, al02 = 5.25483E-04,
al10 =-7.69748E-02, al11 =-6.91499E-02, al12 = 2.22453E-03,
al20 = 4.06463E-02, al21 =-1.01281E-02, al22 = 3.40919E-04;
static const G4double
bl00 = 1.04133E+00, bl01 =-9.43291E-03, bl02 =-4.54758E-04,
bl10 = 1.19253E-01, bl11 = 4.07467E-02, bl12 =-1.30718E-03,
bl20 =-1.59391E-02, bl21 = 7.27752E-03, bl22 =-1.94405E-04;
static const G4double tlow = 1.*MeV;
G4double dCrossEprod=0.;
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
G4double cross = 0.0;
G4double E1=kinEnergyProd;
G4double E2=kinEnergyProd*1.000000001;
G4double dE=(E2-E1);
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double dum=0.;
for (size_t i=0; i<aMaterial->GetNumberOfElements(); i++) {
G4double fac=
cross += theAtomNumDensityVector[i] * theDirectEMModel->ComputeCrossSectionPerAtom(G4Electron::Electron(),
kinEnergyProj, (*theElementVector)[i]->GetZ(), dum,E1);
}
dCrossEprod=(cross1-cross2)/dE; //first term
//Now come the correction
//-----------------------
//First compute fsig for E1
//-------------------------
G4double totalEnergy = kinEnergyProj+electron_mass_c2 ;
G4double kp2 = MigdalConstant*totalEnergy*totalEnergy
*(aMaterial->GetElectronDensity());
G4double fsig = 0.;
G4int nmax = 100;
G4double vmin=std::log(E1);
G4double vmax=std::log(kinEnergyProj) ;
G4int nn = (G4int)(nmax*(vmax-vmin)/(std::log(highKinEnergy)-vmin));
G4double u,fac,c,v,dv,y ;
if(nn > 0) {
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++) {
v += dv;
u = std::exp(v);
fac = SupressionFunction(aMaterial, kinEnergyProj, u);
y = u/kinEnergyProj;
fac *= (4.-4.*y+3.*y*y)/3.;
fac *= probsup*(u*u/(u*u+kp2))+1.-probsup;
if ((n==0)||(n==nn)) c=0.5;
else c=1. ;
fac *= c;
fsig += fac;
}
y = E1/kinEnergyProj ;
fsig *=dv/(-4.*std::log(y)/3.-4.*(1.-y)/3.+0.5*(1.-y*y));
}
else {
fsig = 1.;
}
if (fsig > 1.) fsig = 1.;
dCrossEprod*=fsig;
//return dCrossEprod;
//Now we compute dfsig
//-------------------------
G4double dfsig = 0.;
nn=20;
vmax=std::log(E2) ;
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++) {
v += dv;
u = std::exp(v);
fac = SupressionFunction(aMaterial, kinEnergyProj, u);
y = u/kinEnergyProj;
fac *= (4.-4.*y+3.*y*y)/3.;
fac *= probsup*(u*u/(u*u+kp2))+1.-probsup;
if ((n==0)||(n==nn)) c=0.5;
else c=1. ;
fac *= c;
dfsig += fac;
}
y = E1/kinEnergyProj;
dfsig *=dv/(-4.*std::log(y)/3.-4.*(1.-y)/3.+0.5*(1.-y*y));
dCrossEprod+=dfsig*cross1/dE;
}
return dCrossEprod;
}
*/
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond(const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
)
{if (ModeldCS=="MODEL2") return DiffCrossSectionPerVolumePrimToSecond2(aMaterial,
kinEnergyProj, // kinetic energy of the primary particle before the interaction
kinEnergyProd);
if (ModeldCS=="MODEL3") return DiffCrossSectionPerVolumePrimToSecond3(aMaterial,
kinEnergyProj, // kinetic energy of the primary particle before the interaction
kinEnergyProd);
return DiffCrossSectionPerVolumePrimToSecond1(aMaterial,
kinEnergyProj, // kinetic energy of the primary particle before the interaction
kinEnergyProd);
}
////////////////////////////////////////////////////////////////////////////////
// the one used till now
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond1(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
)
{
G4double dCrossEprod=0.;
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
G4double cross1 = 0.0;
G4double cross2 = 0.0;
G4double E1=kinEnergyProd;
G4double E2=kinEnergyProd*1.01;
G4double dE=(E2-E1);
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double dum=0.;
for (size_t i=0; i<aMaterial->GetNumberOfElements(); i++) {
cross1 += theAtomNumDensityVector[i] * theDirectEMModel->ComputeCrossSectionPerAtom(G4Electron::Electron(),
kinEnergyProj, (*theElementVector)[i]->GetZ(), dum,E1);
cross2 += theAtomNumDensityVector[i] * theDirectEMModel->ComputeCrossSectionPerAtom(G4Electron::Electron(),
kinEnergyProj, (*theElementVector)[i]->GetZ(), dum, E2);
}
dCrossEprod=(cross1-cross2)/dE; //first term
//Now come the correction
//-----------------------
//First compute fsig for E1
//-------------------------
G4double totalEnergy = kinEnergyProj+electron_mass_c2 ;
G4double kp2 = MigdalConstant*totalEnergy*totalEnergy
*(aMaterial->GetElectronDensity());
G4double fsig1 = 0.;
G4int nmax = 100;
G4double vmin=std::log(E1);
G4double vmax=std::log(kinEnergyProj) ;
G4int nn = (G4int)(nmax*(vmax-vmin)/(std::log(highKinEnergy)-vmin));
G4double u,fac,c,v,dv,y ;
if(nn > 0) {
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++) {
v += dv;
u = std::exp(v);
fac = SupressionFunction(aMaterial, kinEnergyProj, u);
y = u/kinEnergyProj;
fac *= (4.-4.*y+3.*y*y)/3.;
fac *= probsup*(u*u/(u*u+kp2))+1.-probsup;
if ((n==0)||(n==nn)) c=0.5;
else c=1. ;
fac *= c;
fsig1 += fac;
}
y = E1/kinEnergyProj ;
fsig1 *=dv/(-4.*std::log(y)/3.-4.*(1.-y)/3.+0.5*(1.-y*y));
}
else {
fsig1 = 1.;
}
if (fsig1 > 1.) fsig1 = 1.;
dCrossEprod*=fsig1;
G4double fsig2 = 0.;
vmin=std::log(E2);
nn = (G4int)(nmax*(vmax-vmin)/(std::log(highKinEnergy)-vmin));
if(nn > 0) {
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++) {
v += dv;
u = std::exp(v);
fac = SupressionFunction(aMaterial, kinEnergyProj, u);
y = u/kinEnergyProj;
fac *= (4.-4.*y+3.*y*y)/3.;
fac *= probsup*(u*u/(u*u+kp2))+1.-probsup;
if ((n==0)||(n==nn)) c=0.5;
else c=1. ;
fac *= c;
fsig2 += fac;
}
y = E2/kinEnergyProj ;
fsig2 *=dv/(-4.*std::log(y)/3.-4.*(1.-y)/3.+0.5*(1.-y*y));
}
else {
fsig2 = 1.;
}
if (fsig2 > 1.) fsig2 = 1.;
G4double dfsig=(fsig2-fsig1);
dCrossEprod+=dfsig*cross1/dE;
dCrossEprod=(fsig1*cross1-fsig2*cross2)/dE;
/*if (fsig < 1.){
//Now we compute dfsig
//-------------------------
G4double dfsig = 0.;
nn=20;
vmax=std::log(E2) ;
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++) {
v += dv;
u = std::exp(v);
fac = SupressionFunction(aMaterial, kinEnergyProj, u);
y = u/kinEnergyProj;
fac *= (4.-4.*y+3.*y*y)/3.;
fac *= probsup*(u*u/(u*u+kp2))+1.-probsup;
if ((n==0)||(n==nn)) c=0.5;
else c=1. ;
fac *= c;
dfsig += fac;
}
y = E1/kinEnergyProj;
dfsig *=dv/(-4.*std::log(y)/3.-4.*(1.-y)/3.+0.5*(1.-y*y));
dCrossEprod+=dfsig*cross1/dE;
}
*/
}
return dCrossEprod;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond2(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
)
{
G4double dCrossEprod=0.;
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
G4double dEdX1 = 0.0;
G4double dEdX2 = 0.0;
G4double E1=kinEnergyProd;
G4double E2=kinEnergyProd*1.001;
G4double dE=(E2-E1);
//G4double dum=0.;
dEdX1 = theDirectEMModel->ComputeDEDXPerVolume(aMaterial,G4Electron::Electron(),kinEnergyProj,E1);
dEdX2 = theDirectEMModel->ComputeDEDXPerVolume(aMaterial,G4Electron::Electron(),kinEnergyProj,E2);
dCrossEprod=(dEdX2-dEdX1)/dE/E1;
}
return dCrossEprod;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond3(
const G4Material* aMaterial,
G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
G4double kinEnergyProd // kinetic energy of the secondary particle
)
{
return G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToSecond(aMaterial,
kinEnergyProj, // kinetic energy of the primary particle before the interaction
kinEnergyProd);
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointBremsstrahlungModel::SupressionFunction(const G4Material* material,
G4double kineticEnergy, G4double gammaEnergy)
{
// supression due to the LPM effect+polarisation of the medium/
// supression due to the polarisation alone
G4double totEnergy = kineticEnergy+electron_mass_c2 ;
G4double totEnergySquare = totEnergy*totEnergy ;
G4double LPMEnergy = LPMconstant*(material->GetRadlen()) ;
G4double gammaEnergySquare = gammaEnergy*gammaEnergy ;
G4double electronDensity = material->GetElectronDensity();
G4double sp = gammaEnergySquare/
(gammaEnergySquare+MigdalConstant*totEnergySquare*electronDensity);
G4double supr = 1.0;
if (theLPMflag) {
G4double s2lpm = LPMEnergy*gammaEnergy/totEnergySquare;
if (s2lpm < 1.) {
G4double LPMgEnergyLimit = totEnergySquare/LPMEnergy ;
G4double LPMgEnergyLimit2 = LPMgEnergyLimit*LPMgEnergyLimit;
G4double splim = LPMgEnergyLimit2/
(LPMgEnergyLimit2+MigdalConstant*totEnergySquare*electronDensity);
G4double w = 1.+1./splim ;
if ((1.-sp) < 1.e-6) w = s2lpm*(3.-sp);
else w = s2lpm*(1.+1./sp);
supr = (std::sqrt(w*w+4.*s2lpm)-w)/(std::sqrt(w*w+4.)-w) ;
supr /= sp;
}
}
return supr;
}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointBremsstrahlungModel::SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange)
{
//G4cout<<"Adjoint Brem"<<std::endl;
const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
size_t ind=0;
if (UseMatrixPerElement ) { //Select Material
std::vector<double>* CS_Vs_Element = &CS_Vs_ElementForScatProjToProjCase;
if ( !IsScatProjToProjCase) CS_Vs_Element = &CS_Vs_ElementForProdToProjCase;
G4double rand_var= G4UniformRand();
G4double SumCS=0.;
for (size_t i=0;i<CS_Vs_Element->size();i++){
SumCS+=(*CS_Vs_Element)[i];
if (rand_var<=SumCS/lastCS){
ind=i;
break;
}
}
}
else {
ind = currentMaterialIndex;
}
//Elastic inverse scattering modified compared to general G4VEmAdjointModel
//---------------------------
G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
G4double adjointPrimTotalEnergy = theAdjointPrimary->GetTotalEnergy();
//G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
return;
}
//Sample secondary energy
//-----------------------
G4double projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(ind,
adjointPrimKinEnergy,
IsScatProjToProjCase);
//Weight correction
//-----------------------
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), adjointPrimKinEnergy,projectileKinEnergy);
//Kinematic
//---------
G4double projectileM0 = electron_mass_c2;
G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
G4double projectileP = std::sqrt(projectileP2);
//Angle of the gamma direction with the projectile taken from G4eBremsstrahlungModel
//------------------------------------------------
G4double u;
const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
if (9./(9.+d) > G4UniformRand()) u = - std::log(G4UniformRand()*G4UniformRand())/a1;
else u = - std::log(G4UniformRand()*G4UniformRand())/a2;
G4double theta = u*electron_mass_c2/projectileTotalEnergy;
G4double sint = std::sin(theta);
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 && CorrectWeightMode){ //kill the primary and add a secondary
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
//G4cout<<"projectileMomentum "<<projectileMomentum<<std::endl;
}
else {
fParticleChange->ProposeEnergy(projectileKinEnergy);
fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
//G4cout<<"projectileMomentum "<<projectileMomentum<<std::endl;
}
}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointBremsstrahlungModel::DefineDirectBremModel(G4eBremsstrahlungModel* aModel)
{theDirectBremModel=aModel;
DefineDirectEMModel(aModel);
}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointBremsstrahlungModel::InitialiseParameters()
{
static const G4double
ah10 = 4.67733E+00, ah11 =-6.19012E-01, ah12 = 2.02225E-02,
ah20 =-7.34101E+00, ah21 = 1.00462E+00, ah22 =-3.20985E-02,
ah30 = 2.93119E+00, ah31 =-4.03761E-01, ah32 = 1.25153E-02;
static const G4double
bh10 = 4.23071E+00, bh11 =-6.10995E-01, bh12 = 1.95531E-02,
bh20 =-7.12527E+00, bh21 = 9.69160E-01, bh22 =-2.74255E-02,
bh30 = 2.69925E+00, bh31 =-3.63283E-01, bh32 = 9.55316E-03;
/* static const G4double
al00 =-2.05398E+00, al01 = 2.38815E-02, al02 = 5.25483E-04,
al10 =-7.69748E-02, al11 =-6.91499E-02, al12 = 2.22453E-03,
al20 = 4.06463E-02, al21 =-1.01281E-02, al22 = 3.40919E-04;
static const G4double
bl00 = 1.04133E+00, bl01 =-9.43291E-03, bl02 =-4.54758E-04,
bl10 = 1.19253E-01, bl11 = 4.07467E-02, bl12 =-1.30718E-03,
bl20 =-1.59391E-02, bl21 = 7.27752E-03, bl22 =-1.94405E-04;*/
const G4ElementTable* theElementTable = G4Element::GetElementTable();
FZ.clear();
ah1.clear();
ah2.clear();
ah3.clear();
bh1.clear();
bh2.clear();
bh3.clear();
al0.clear();
al1.clear();
al2.clear();
bl0.clear();
bl1.clear();
bl2.clear();
SigmaPerAtom.clear();
for (size_t j=0; j<theElementTable->size();j++){
G4Element* anElement=(*theElementTable)[j];
G4double lnZ = 3.*(anElement->GetIonisation()->GetlogZ3());
FZ.push_back(lnZ* (4.- 0.55*lnZ));
G4double ZZ = anElement->GetIonisation()->GetZZ3();
ah1.push_back(ah10 + ZZ* (ah11 + ZZ* ah12));
ah2.push_back(ah20 + ZZ* (ah21 + ZZ* ah22));
ah3.push_back(ah30 + ZZ* (ah31 + ZZ* ah32));
bh1.push_back(bh10 + ZZ* (bh11 + ZZ* bh12));
bh2.push_back(bh20 + ZZ* (bh21 + ZZ* bh22));
bh3.push_back(bh30 + ZZ* (bh31 + ZZ* bh32));
/*SigmaPerAtom.push_back(theDirectEMModel->ComputeCrossSectionPerAtom(
theDirectPrimaryPartDef,GetHighEnergyLimit()/2.,
anElement->GetZ(),1.,GetLowEnergyLimit(),1.e20));*/
}
}
@@ -0,0 +1,873 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointCSManager.hh"
#include "G4AdjointCSMatrix.hh"
#include "G4AdjointInterpolator.hh"
#include "G4AdjointCSMatrix.hh"
#include "G4VEmAdjointModel.hh"
#include "G4ElementTable.hh"
#include "G4Element.hh"
#include "G4ParticleDefinition.hh"
#include "G4Element.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4AdjointElectron.hh"
#include "G4AdjointGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4ProductionCutsTable.hh"
G4AdjointCSManager* G4AdjointCSManager::theInstance = 0;
///////////////////////////////////////////////////////
//
G4AdjointCSManager* G4AdjointCSManager::GetAdjointCSManager()
{ if(theInstance == 0) {
static G4AdjointCSManager ins;
theInstance = &ins;
}
return theInstance;
}
///////////////////////////////////////////////////////
//
G4AdjointCSManager::G4AdjointCSManager()
{ CrossSectionMatrixesAreBuilt=false;
theTotalForwardSigmaTableVector.clear();
theTotalAdjointSigmaTableVector.clear();
listOfForwardEmProcess.clear();
listOfForwardEnergyLossProcess.clear();
theListOfAdjointParticlesInAction.clear();
Tmin=0.1*keV;
Tmax=100.*TeV;
nbins=240;
RegisterAdjointParticle(G4AdjointElectron::AdjointElectron());
RegisterAdjointParticle(G4AdjointGamma::AdjointGamma());
verbose = 1;
consider_continuous_weight_correction =true;
consider_poststep_weight_correction =false;
}
///////////////////////////////////////////////////////
//
G4AdjointCSManager::~G4AdjointCSManager()
{;
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::RegisterEmAdjointModel(G4VEmAdjointModel* aModel)
{listOfAdjointEMModel.push_back(aModel);
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::RegisterEmProcess(G4VEmProcess* aProcess, G4ParticleDefinition* aFwdPartDef)
{
G4ParticleDefinition* anAdjPartDef = GetAdjointParticleEquivalent(aFwdPartDef);
if (anAdjPartDef && aProcess){
RegisterAdjointParticle(anAdjPartDef);
int index=-1;
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
if (anAdjPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
}
listOfForwardEmProcess[index]->push_back(aProcess);
}
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::RegisterEnergyLossProcess(G4VEnergyLossProcess* aProcess, G4ParticleDefinition* aFwdPartDef)
{
G4ParticleDefinition* anAdjPartDef = GetAdjointParticleEquivalent(aFwdPartDef);
if (anAdjPartDef && aProcess){
RegisterAdjointParticle(anAdjPartDef);
int index=-1;
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
if (anAdjPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
}
listOfForwardEnergyLossProcess[index]->push_back(aProcess);
}
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::RegisterAdjointParticle(G4ParticleDefinition* aPartDef)
{ int index=-1;
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
if (aPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
}
if (index ==-1){
listOfForwardEnergyLossProcess.push_back(new std::vector<G4VEnergyLossProcess*>());
theTotalForwardSigmaTableVector.push_back(new G4PhysicsTable);
theTotalAdjointSigmaTableVector.push_back(new G4PhysicsTable);
listOfForwardEmProcess.push_back(new std::vector<G4VEmProcess*>());
theListOfAdjointParticlesInAction.push_back(aPartDef);
}
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::BuildCrossSectionMatrices()
{
if (CrossSectionMatrixesAreBuilt) return;
//Tcut, Tmax
//The matrices will be computed probably just once
//When Tcut will change some PhysicsTable will be recomputed
// for each MaterialCutCouple but not all the matrices
//The Tcut defines a lower limit in the energy of the Projectile before the scattering
//In the Projectile to Scattered Projectile case we have
// E_ScatProj<E_Proj-Tcut
//Therefore in the adjoint case we have
// Eproj> E_ScatProj+Tcut
//This implies that when computing the adjoint CS we should integrate over Epro
// from E_ScatProj+Tcut to Emax
//In the Projectile to Secondary case Tcut plays a role only in the fact that
// Esecond should be greater than Tcut to have the possibility to have any adjoint
//process
//To avoid to recompute the matrices for all changes of MaterialCutCouple
//We propose to compute the matrices only once for the minimum possible Tcut and then
//to interpolate the probability for a new Tcut (implemented in G4VAdjointEmModel)
theAdjointCSMatricesForScatProjToProj.clear();
theAdjointCSMatricesForProdToProj.clear();
const G4ElementTable* theElementTable = G4Element::GetElementTable();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
for (size_t i=0; i<listOfAdjointEMModel.size();i++){
G4VEmAdjointModel* aModel =listOfAdjointEMModel[i];
G4cout<<"Build adjoint cross section matrices for "<<aModel->GetName()<<std::endl;
if (aModel->GetUseMatrix()){
std::vector<G4AdjointCSMatrix*>* aListOfMat1 = new std::vector<G4AdjointCSMatrix*>();
std::vector<G4AdjointCSMatrix*>* aListOfMat2 = new std::vector<G4AdjointCSMatrix*>();
aListOfMat1->clear();
aListOfMat2->clear();
if (aModel->GetUseMatrixPerElement()){
if (aModel->GetUseOnlyOneMatrixForAllElements()){
std::vector<G4AdjointCSMatrix*>
two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,1, 1, 10);
aListOfMat1->push_back(two_matrices[0]);
aListOfMat2->push_back(two_matrices[1]);
}
else {
for (size_t j=0; j<theElementTable->size();j++){
G4Element* anElement=(*theElementTable)[j];
G4int Z = G4int(anElement->GetZ());
G4int A = G4int(anElement->GetA());
std::vector<G4AdjointCSMatrix*>
two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,Z, A, 10);
aListOfMat1->push_back(two_matrices[0]);
aListOfMat2->push_back(two_matrices[1]);
}
}
}
else { //Per material case
for (size_t j=0; j<theMaterialTable->size();j++){
G4Material* aMaterial=(*theMaterialTable)[j];
std::vector<G4AdjointCSMatrix*>
two_matrices=BuildCrossSectionsMatricesForAGivenModelAndMaterial(aModel,aMaterial, 10);
aListOfMat1->push_back(two_matrices[0]);
aListOfMat2->push_back(two_matrices[1]);
}
}
theAdjointCSMatricesForProdToProj.push_back(*aListOfMat1);
theAdjointCSMatricesForScatProjToProj.push_back(*aListOfMat2);
aModel->SetCSMatrices(aListOfMat1, aListOfMat2);
}
else { std::vector<G4AdjointCSMatrix*> two_empty_matrices;
theAdjointCSMatricesForProdToProj.push_back(two_empty_matrices);
theAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices);
}
}
G4cout<<"All adjoint cross section matrices are built "<<std::endl;
CrossSectionMatrixesAreBuilt = true;
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::BuildTotalSigmaTables()
{
const G4ProductionCutsTable* theCoupleTable= G4ProductionCutsTable::GetProductionCutsTable();
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
G4ParticleDefinition* thePartDef = theListOfAdjointParticlesInAction[i];
theTotalForwardSigmaTableVector[i]->clearAndDestroy();
theTotalAdjointSigmaTableVector[i]->clearAndDestroy();
for (size_t j=0;j<theCoupleTable->GetTableSize();j++){
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(j);
//make first the total fwd CS table for FwdProcess
G4PhysicsVector* aVector = new G4PhysicsLogVector(Tmin, Tmax, nbins);
for(size_t l=0; l<aVector->GetVectorLength(); l++) {
G4double totCS=0;
G4double e=aVector->GetLowEdgeEnergy(l);
for (size_t k=0; k<listOfForwardEmProcess[i]->size(); k++){
totCS+=(*listOfForwardEmProcess[i])[k]->GetLambda(e, couple);
}
for (size_t k=0; k<listOfForwardEnergyLossProcess[i]->size(); k++){
totCS+=(*listOfForwardEnergyLossProcess[i])[k]->GetLambda(e, couple);
}
//G4cout<<totCS<<std::endl;
aVector->PutValue(l,totCS);
}
theTotalForwardSigmaTableVector[i]->push_back(aVector);
G4PhysicsVector* aVector1 = new G4PhysicsLogVector(Tmin, Tmax, nbins);
for(size_t l=0; l<aVector->GetVectorLength(); l++) {
G4double e=aVector->GetLowEdgeEnergy(l);
G4double totCS =ComputeTotalAdjointCS(couple,thePartDef,e);
//G4cout<<totCS<<std::endl;
aVector1->PutValue(l,totCS);
}
theTotalAdjointSigmaTableVector[i]->push_back(aVector1);
}
}
}
///////////////////////////////////////////////////////
//
G4double G4AdjointCSManager::GetTotalAdjointCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple)
{ DefineCurrentMaterial(aCouple);
int index=-1;
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
if (aPartDef == theListOfAdjointParticlesInAction[i]) index=i;
}
if (index == -1) return 0.;
G4bool b;
return (((*theTotalAdjointSigmaTableVector[index])[currentMatIndex])->GetValue(Ekin, b));
}
///////////////////////////////////////////////////////
//
G4double G4AdjointCSManager::GetTotalForwardCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple)
{ DefineCurrentMaterial(aCouple);
int index=-1;
for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
if (aPartDef == theListOfAdjointParticlesInAction[i]) index=i;
}
if (index == -1) return 0.;
G4bool b;
return (((*theTotalForwardSigmaTableVector[index])[currentMatIndex])->GetValue(Ekin, b));
}
///////////////////////////////////////////////////////
//
G4double G4AdjointCSManager::GetContinuousWeightCorrection(G4ParticleDefinition* aPartDef, G4double PreStepEkin,G4double AfterStepEkin,
const G4MaterialCutsCouple* aCouple, G4double step_length)
{ //G4double fwdCS = GetTotalForwardCS(aPartDef, AfterStepEkin,aCouple);
G4double corr_fac = 1.;
if (consider_continuous_weight_correction) {
G4double adjCS = GetTotalAdjointCS(aPartDef, PreStepEkin,aCouple);
G4double PrefwdCS;
PrefwdCS = GetTotalForwardCS(aPartDef, PreStepEkin,aCouple);
G4double fwdCS = GetTotalForwardCS(aPartDef, (AfterStepEkin+PreStepEkin)/2.,aCouple);
G4cout<<adjCS<<'\t'<<fwdCS<<std::endl;
//if (aPartDef ==G4AdjointGamma::AdjointGamma()) G4cout<<adjCS<<'\t'<<fwdCS<<std::endl;
/*if (adjCS >0 ) corr_fac = std::exp((PrefwdCS-fwdCS)*step_length);
else corr_fac = std::exp(-fwdCS*step_length);*/
corr_fac *=std::exp((adjCS-fwdCS)*step_length);
corr_fac=std::max(corr_fac,1.e-6);
corr_fac *=PreStepEkin/AfterStepEkin;
}
G4cout<<"Cont "<<corr_fac<<std::endl;
G4cout<<"Ekin0 "<<PreStepEkin<<std::endl;
G4cout<<"Ekin1 "<<AfterStepEkin<<std::endl;
G4cout<<"step_length "<<step_length<<std::endl;
return corr_fac;
}
///////////////////////////////////////////////////////
//
G4double G4AdjointCSManager::GetPostStepWeightCorrection(G4ParticleDefinition* , G4ParticleDefinition* ,
G4double ,G4double ,
const G4MaterialCutsCouple* )
{ G4double corr_fac = 1.;
if (consider_poststep_weight_correction) {
/*G4double fwdCS = GetTotalForwardCS(aSecondPartDef, EkinPrim,aCouple);
G4double adjCS = GetTotalAdjointCS(aPrimPartDef, EkinPrim,aCouple);*/
//G4double fwd1CS = GetTotalForwardCS(aPrimPartDef, EkinPrim,aCouple);
//if (adjCS>0 && fwd1CS>0) adjCS = fwd1CS;
//corr_fac =fwdCS*EkinSecond/adjCS/EkinPrim;
//corr_fac = adjCS/fwdCS;
}
return corr_fac;
}
///////////////////////////////////////////////////////
//
double G4AdjointCSManager::ComputeAdjointCS(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase,
std::vector<double>& CS_Vs_Element)
{
G4bool need_to_compute=false;
if ( aMaterial!= lastMaterial || PrimEnergy != lastPrimaryEnergy || Tcut != lastTcut){
lastMaterial =aMaterial;
lastPrimaryEnergy = PrimEnergy;
lastTcut=Tcut;
listOfIndexOfAdjointEMModelInAction.clear();
listOfIsScatProjToProjCase.clear();
lastAdjointCSVsModelsAndElements.clear();
need_to_compute=true;
}
size_t ind=0;
if (!need_to_compute){
need_to_compute=true;
for (size_t i=0;i<listOfIndexOfAdjointEMModelInAction.size();i++){
size_t ind1=listOfIndexOfAdjointEMModelInAction[i];
if (aModel == listOfAdjointEMModel[ind1] && IsScatProjToProjCase == listOfIsScatProjToProjCase[i]){
need_to_compute=false;
CS_Vs_Element = lastAdjointCSVsModelsAndElements[ind];
}
ind++;
}
}
if (need_to_compute){
size_t ind_model=0;
for (size_t i=0;i<listOfAdjointEMModel.size();i++){
if (aModel == listOfAdjointEMModel[i]){
ind_model=i;
break;
}
}
G4double Tlow=Tcut;
if (!listOfAdjointEMModel[ind_model]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[ind_model]->GetLowEnergyLimit();
listOfIndexOfAdjointEMModelInAction.push_back(ind_model);
listOfIsScatProjToProjCase.push_back(IsScatProjToProjCase);
CS_Vs_Element.clear();
if (!aModel->GetUseMatrix()){
return aModel->AdjointCrossSection(currentCouple,PrimEnergy,IsScatProjToProjCase);
}
else if (aModel->GetUseMatrixPerElement()){
size_t n_el = aMaterial->GetNumberOfElements();
if (aModel->GetUseOnlyOneMatrixForAllElements()){
G4AdjointCSMatrix* theCSMatrix;
if (IsScatProjToProjCase){
theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][0];
}
else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][0];
G4double CS =0.;
if (PrimEnergy > Tlow)
CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow);
G4double factor=0.;
for (size_t i=0;i<n_el;i++){
size_t ind_el = aMaterial->GetElement(i)->GetIndex();
factor+=aMaterial->GetElement(i)->GetZ()*aMaterial->GetVecNbOfAtomsPerVolume()[i];
G4AdjointCSMatrix* theCSMatrix;
if (IsScatProjToProjCase){
theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_el];
}
else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_el];
//G4double CS =0.;
//G4cout<<CS<<std::endl;
}
CS *=factor;
CS_Vs_Element.push_back(CS);
}
else {
for (size_t i=0;i<n_el;i++){
size_t ind_el = aMaterial->GetElement(i)->GetIndex();
//G4cout<<aMaterial->GetName()<<std::endl;
G4AdjointCSMatrix* theCSMatrix;
if (IsScatProjToProjCase){
theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_el];
}
else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_el];
G4double CS =0.;
if (PrimEnergy > Tlow)
CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow);
//G4cout<<CS<<std::endl;
CS_Vs_Element.push_back(CS*(aMaterial->GetVecNbOfAtomsPerVolume()[i]));
}
}
}
else {
size_t ind_mat = aMaterial->GetIndex();
G4AdjointCSMatrix* theCSMatrix;
if (IsScatProjToProjCase){
theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_mat];
}
else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_mat];
G4double CS =0.;
if (PrimEnergy > Tlow)
CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow);
CS_Vs_Element.push_back(CS);
}
lastAdjointCSVsModelsAndElements.push_back(CS_Vs_Element);
}
G4double CS=0;
for (size_t i=0;i<CS_Vs_Element.size();i++){
CS+=CS_Vs_Element[i];
}
return CS;
}
///////////////////////////////////////////////////////
//
G4Element* G4AdjointCSManager::SampleElementFromCSMatrices(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase)
{ std::vector<double> CS_Vs_Element;
G4double CS = ComputeAdjointCS(aMaterial,aModel,PrimEnergy,Tcut,IsScatProjToProjCase,CS_Vs_Element);
G4double rand_var= G4UniformRand();
G4double SumCS=0.;
size_t ind=0;
for (size_t i=0;i<CS_Vs_Element.size();i++){
SumCS+=CS_Vs_Element[i];
if (rand_var<=SumCS/CS){
ind=i;
break;
}
}
return const_cast<G4Element*>(aMaterial->GetElement(ind));
}
///////////////////////////////////////////////////////
//
G4double G4AdjointCSManager::ComputeTotalAdjointCS(const G4MaterialCutsCouple* aCouple,
G4ParticleDefinition* aPartDef,
G4double Ekin)
{
G4double TotalCS=0.;
// G4ParticleDefinition* theDirPartDef = GetForwardParticleEquivalent(aPartDef);
DefineCurrentMaterial(aCouple);
/* size_t idx=-1;
if (theDirPartDef->GetParticleName() == "gamma") idx = 0;
else if (theDirPartDef->GetParticleName() == "e-") idx = 1;
else if (theDirPartDef->GetParticleName() == "e+") idx = 2;
//THe tCut computation is wrong this should be on Tcut per model the secondary determioming the Tcut
const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
//G4cout<<aVec<<std::endl;
G4double Tcut =(*aVec)[aCouple->GetIndex()];*/
//G4cout<<"Tcut "<<Tcut<<std::endl;
//G4cout<<(*aVec)[0]<<std::endl;
// G4double Tcut =converters[idx]->Convert(Rcut,aCouple->GetMaterial());
std::vector<double> CS_Vs_Element;
for (size_t i=0; i<listOfAdjointEMModel.size();i++){
/*G4ParticleDefinition* theDirSecondPartDef =
GetForwardParticleEquivalent(listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition());
*/
G4double Tlow=0;
if (!listOfAdjointEMModel[i]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[i]->GetLowEnergyLimit();
else {
G4ParticleDefinition* theDirSecondPartDef =
GetForwardParticleEquivalent(listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition());
G4int idx=-1;
if (theDirSecondPartDef->GetParticleName() == "gamma") idx = 0;
else if (theDirSecondPartDef->GetParticleName() == "e-") idx = 1;
else if (theDirSecondPartDef->GetParticleName() == "e+") idx = 2;
const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
Tlow =(*aVec)[aCouple->GetIndex()];
}
if ( Ekin<=listOfAdjointEMModel[i]->GetHighEnergyLimit() && Ekin>=listOfAdjointEMModel[i]->GetLowEnergyLimit()){
if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectPrimaryParticleDefinition()){
//G4cout<<"Yes1 before "<<std::endl;
TotalCS += ComputeAdjointCS(currentMaterial,
listOfAdjointEMModel[i],
Ekin, Tlow,true,CS_Vs_Element);
//G4cout<<"Yes1 "<<Ekin<<'\t'<<TotalCS<<std::endl;
}
if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition()){
TotalCS += ComputeAdjointCS(currentMaterial,
listOfAdjointEMModel[i],
Ekin, Tlow,false, CS_Vs_Element);
//G4cout<<"Yes2 "<<TotalCS<<std::endl;
}
}
}
return TotalCS;
}
///////////////////////////////////////////////////////
//
std::vector<G4AdjointCSMatrix*>
G4AdjointCSManager::BuildCrossSectionsMatricesForAGivenModelAndElement(G4VEmAdjointModel* aModel,G4int Z,G4int A,
int nbin_pro_decade)
{
G4AdjointCSMatrix* theCSMatForProdToProjBackwardScattering = new G4AdjointCSMatrix(false);
G4AdjointCSMatrix* theCSMatForScatProjToProjBackwardScattering = new G4AdjointCSMatrix(true);
//make the vector of primary energy of the adjoint particle, could try to make this just once ?
G4double EkinMin =aModel->GetLowEnergyLimit();
G4double EkinMaxForScat =aModel->GetHighEnergyLimit()*0.999;
G4double EkinMaxForProd =aModel->GetHighEnergyLimit()*0.999;
if (aModel->GetSecondPartOfSameType() )EkinMaxForProd =EkinMaxForProd/2.;
//Product to projectile backward scattering
//-----------------------------------------
G4double fE=std::pow(10.,1./nbin_pro_decade);
G4double E2=std::pow(10.,G4double( G4int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
G4double E1=EkinMin;
while (E1 <EkinMaxForProd){
E1=std::max(EkinMin,E2);
E1=std::min(EkinMaxForProd,E1);
std::vector< std::vector< G4double >* > aMat= aModel->ComputeAdjointCrossSectionVectorPerAtomForSecond(E1,Z,A,nbin_pro_decade);
if (aMat.size()>=2) {
std::vector< G4double >* log_ESecVec=aMat[0];
std::vector< G4double >* log_CSVec=aMat[1];
G4double log_adjointCS=log_CSVec->back();
//normalise CSVec such that it becomes a probability vector
/*for (size_t j=0;j<log_CSVec->size();j++) (*log_CSVec)[j]=(*log_CSVec)[j]-log_adjointCS;
(*log_CSVec)[0]=-90.;*/
for (size_t j=0;j<log_CSVec->size();j++) {
//G4cout<<"CSMan1 "<<(*log_CSVec)[j]<<std::endl;
if (j==0) (*log_CSVec)[j] = 0.;
else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
//G4cout<<"CSMan2 "<<(*log_CSVec)[j]<<std::endl;
}
(*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-1.;
theCSMatForProdToProjBackwardScattering->AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
}
E1=E2;
E2*=fE;
}
//Scattered projectile to projectile backward scattering
//-----------------------------------------
E2=std::pow(10.,G4double( G4int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
E1=EkinMin;
while (E1 <EkinMaxForScat){
E1=std::max(EkinMin,E2);
E1=std::min(EkinMaxForScat,E1);
std::vector< std::vector< G4double >* > aMat= aModel->ComputeAdjointCrossSectionVectorPerAtomForScatProj(E1,Z,A,nbin_pro_decade);
if (aMat.size()>=2) {
std::vector< G4double >* log_ESecVec=aMat[0];
std::vector< G4double >* log_CSVec=aMat[1];
G4double log_adjointCS=log_CSVec->back();
//normalise CSVec such that it becomes a probability vector
for (size_t j=0;j<log_CSVec->size();j++) {
//G4cout<<"CSMan1 "<<(*log_CSVec)[j]<<std::endl;
if (j==0) (*log_CSVec)[j] = 0.;
else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
//G4cout<<"CSMan2 "<<(*log_CSVec)[j]<<std::endl;
}
(*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-1.;
theCSMatForScatProjToProjBackwardScattering->AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
}
E1=E2;
E2*=fE;
}
std::vector<G4AdjointCSMatrix*> res;
res.clear();
res.push_back(theCSMatForProdToProjBackwardScattering);
res.push_back(theCSMatForScatProjToProjBackwardScattering);
#ifdef TEST_MODE
G4String file_name;
std::stringstream astream;
G4String str_Z;
astream<<Z;
astream>>str_Z;
theCSMatForProdToProjBackwardScattering->Write(aModel->GetName()+G4String("_CSMat_Z")+str_Z+"_ProdToProj.txt");
theCSMatForScatProjToProjBackwardScattering->Write(aModel->GetName()+G4String("_CSMat_Z")+str_Z+"_ScatProjToProj.txt");
/*G4AdjointCSMatrix* aMat1 = new G4AdjointCSMatrix(false);
G4AdjointCSMatrix* aMat2 = new G4AdjointCSMatrix(true);
aMat1->Read(G4String("test_Z")+str_Z+"_1.txt");
aMat2->Read(G4String("test_Z")+str_Z+"_2.txt");
aMat1->Write(G4String("test_Z")+str_Z+"_11.txt");
aMat2->Write(G4String("test_Z")+str_Z+"_22.txt"); */
#endif
return res;
}
///////////////////////////////////////////////////////
//
std::vector<G4AdjointCSMatrix*>
G4AdjointCSManager::BuildCrossSectionsMatricesForAGivenModelAndMaterial(G4VEmAdjointModel* aModel,
G4Material* aMaterial,
G4int nbin_pro_decade)
{
G4AdjointCSMatrix* theCSMatForProdToProjBackwardScattering = new G4AdjointCSMatrix(false);
G4AdjointCSMatrix* theCSMatForScatProjToProjBackwardScattering = new G4AdjointCSMatrix(true);
//make the vector of primary energy of the adjoint particle, could try to make this just once ?
G4double EkinMin =aModel->GetLowEnergyLimit();
G4double EkinMaxForScat =aModel->GetHighEnergyLimit()*0.999;
G4double EkinMaxForProd =aModel->GetHighEnergyLimit()*0.999;
if (aModel->GetSecondPartOfSameType() )EkinMaxForProd =EkinMaxForProd/2.;
//Product to projectile backward scattering
//-----------------------------------------
G4double fE=std::pow(10.,1./nbin_pro_decade);
G4double E2=std::pow(10.,G4double( G4int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
G4double E1=EkinMin;
while (E1 <EkinMaxForProd){
E1=std::max(EkinMin,E2);
E1=std::min(EkinMaxForProd,E1);
std::vector< std::vector< G4double >* > aMat= aModel->ComputeAdjointCrossSectionVectorPerVolumeForSecond(aMaterial,E1,nbin_pro_decade);
if (aMat.size()>=2) {
std::vector< G4double >* log_ESecVec=aMat[0];
std::vector< G4double >* log_CSVec=aMat[1];
G4double log_adjointCS=log_CSVec->back();
//normalise CSVec such that it becomes a probability vector
for (size_t j=0;j<log_CSVec->size();j++) {
//G4cout<<"CSMan1 "<<(*log_CSVec)[j]<<std::endl;
if (j==0) (*log_CSVec)[j] = 0.;
else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
//G4cout<<"CSMan2 "<<(*log_CSVec)[j]<<std::endl;
}
(*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-1.;
theCSMatForProdToProjBackwardScattering->AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
}
E1=E2;
E2*=fE;
}
//Scattered projectile to projectile backward scattering
//-----------------------------------------
E2=std::pow(10.,G4double( G4int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
E1=EkinMin;
while (E1 <EkinMaxForScat){
E1=std::max(EkinMin,E2);
E1=std::min(EkinMaxForScat,E1);
std::vector< std::vector< G4double >* > aMat= aModel->ComputeAdjointCrossSectionVectorPerVolumeForScatProj(aMaterial,E1,nbin_pro_decade);
if (aMat.size()>=2) {
std::vector< G4double >* log_ESecVec=aMat[0];
std::vector< G4double >* log_CSVec=aMat[1];
G4double log_adjointCS=log_CSVec->back();
for (size_t j=0;j<log_CSVec->size();j++) {
//G4cout<<"CSMan1 "<<(*log_CSVec)[j]<<std::endl;
if (j==0) (*log_CSVec)[j] = 0.;
else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
//G4cout<<"CSMan2 "<<(*log_CSVec)[j]<<std::endl;
}
(*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-1.;
theCSMatForScatProjToProjBackwardScattering->AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
}
E1=E2;
E2*=fE;
}
std::vector<G4AdjointCSMatrix*> res;
res.clear();
res.push_back(theCSMatForProdToProjBackwardScattering);
res.push_back(theCSMatForScatProjToProjBackwardScattering);
#ifdef TEST_MODE
theCSMatForProdToProjBackwardScattering->Write(aModel->GetName()+"_CSMat_"+aMaterial->GetName()+"_ProdToProj.txt");
theCSMatForScatProjToProjBackwardScattering->Write(aModel->GetName()+"_CSMat_"+aMaterial->GetName()+"_ScatProjToProj.txt");
#endif
return res;
}
///////////////////////////////////////////////////////
//
G4ParticleDefinition* G4AdjointCSManager::GetAdjointParticleEquivalent(G4ParticleDefinition* theFwdPartDef)
{
if (theFwdPartDef->GetParticleName() == "e-") return G4AdjointElectron::AdjointElectron();
if (theFwdPartDef->GetParticleName() == "gamma") return G4AdjointGamma::AdjointGamma();
return 0;
}
///////////////////////////////////////////////////////
//
G4ParticleDefinition* G4AdjointCSManager::GetForwardParticleEquivalent(G4ParticleDefinition* theAdjPartDef)
{
if (theAdjPartDef->GetParticleName() == "adj_e-") return G4Electron::Electron();
if (theAdjPartDef->GetParticleName() == "adj_gamma") return G4Gamma::Gamma();
return 0;
}
///////////////////////////////////////////////////////
//
void G4AdjointCSManager::DefineCurrentMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = const_cast<G4MaterialCutsCouple*> (couple);
currentMaterial = const_cast<G4Material*> (couple->GetMaterial());
currentMatIndex = couple->GetIndex();
//G4cout<<"Index material "<<currentMatIndex<<std::endl;
}
}
///////////////////////////////////////////////////////
//
double G4AdjointCSManager::ComputeAdjointCS(G4double aPrimEnergy,G4AdjointCSMatrix*
anAdjointCSMatrix,G4double Tcut)
{
std::vector< G4double > *theLogPrimEnergyVector = anAdjointCSMatrix->GetLogPrimEnergyVector();
if (theLogPrimEnergyVector->size() ==0){
G4cout<<"No data are contained in the given AdjointCSMatrix!"<<std::endl;
G4cout<<"The sampling procedure will be stopped."<<std::endl;
return 0.;
}
//G4cout<<"A prim/Tcut "<<aPrimEnergy<<'\t'<<Tcut<<std::endl;
G4double log_Tcut = std::log(Tcut);
G4double log_E =std::log(aPrimEnergy);
if (aPrimEnergy <= Tcut || log_E > theLogPrimEnergyVector->back()) return 0.;
G4AdjointInterpolator* theInterpolator=G4AdjointInterpolator::GetInstance();
size_t ind =theInterpolator->FindPositionForLogVector(log_E,*theLogPrimEnergyVector);
//G4cout<<"Prim energy "<<(*thePrimEnergyVector)[0]<<std::endl;
//G4cout<<"Prim energy[ind]"<<(*thePrimEnergyVector)[ind]<<std::endl;
//G4cout<<"Prim energy ind"<<ind<<std::endl;
G4double aLogPrimEnergy1,aLogPrimEnergy2;
G4double aLogCS1,aLogCS2;
G4double log01,log02;
std::vector< G4double>* aLogSecondEnergyVector1 =0;
std::vector< G4double>* aLogSecondEnergyVector2 =0;
std::vector< G4double>* aLogProbVector1=0;
std::vector< G4double>* aLogProbVector2=0;
std::vector< size_t>* aLogProbVectorIndex1=0;
std::vector< size_t>* aLogProbVectorIndex2=0;
anAdjointCSMatrix->GetData(ind, aLogPrimEnergy1,aLogCS1,log01, aLogSecondEnergyVector1,aLogProbVector1,aLogProbVectorIndex1);
anAdjointCSMatrix->GetData(ind+1, aLogPrimEnergy2,aLogCS2,log02, aLogSecondEnergyVector2,aLogProbVector2,aLogProbVectorIndex2);
//G4cout<<"aSecondEnergyVector1.size() "<<aSecondEnergyVector1->size()<<std::endl;
//G4cout<<aSecondEnergyVector1<<std::endl;
//G4cout<<"aSecondEnergyVector2.size() "<<aSecondEnergyVector2->size()<<std::endl;
if (anAdjointCSMatrix->IsScatProjToProjCase()){ //case where the Tcut plays a role
G4double log_minimum_prob1, log_minimum_prob2;
//G4cout<<aSecondEnergyVector1->size()<<std::endl;
log_minimum_prob1=theInterpolator->InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector1,*aLogProbVector1);
log_minimum_prob2=theInterpolator->InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector2,*aLogProbVector2);
//G4cout<<"minimum_prob1 "<< std::exp(log_minimum_prob1)<<std::endl;
//G4cout<<"minimum_prob2 "<< std::exp(log_minimum_prob2)<<std::endl;
//G4cout<<"Tcut "<<std::endl;
aLogCS1+= log_minimum_prob1;
aLogCS2+= log_minimum_prob2;
}
G4double log_adjointCS = theInterpolator->LinearInterpolation(log_E,aLogPrimEnergy1,aLogPrimEnergy2,aLogCS1,aLogCS2);
return std::exp(log_adjointCS);
}
@@ -0,0 +1,201 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointCSMatrix.hh"
#include <iomanip>
#include <fstream>
#include "G4AdjointInterpolator.hh"
///////////////////////////////////////////////////////
//
G4AdjointCSMatrix::G4AdjointCSMatrix(G4bool aBool){
theLogPrimEnergyVector.clear();
theLogCrossSectionVector.clear();
theLogSecondEnergyMatrix.clear();
theLogProbMatrix.clear();
theLogProbMatrixIndex.clear();
log0Vector.clear();
nb_of_PrimEnergy=0;
is_scat_proj_to_proj_case =aBool;
}
///////////////////////////////////////////////////////
//
G4AdjointCSMatrix::~G4AdjointCSMatrix(){
theLogPrimEnergyVector.clear();
theLogCrossSectionVector.clear();
theLogSecondEnergyMatrix.clear();
theLogProbMatrix.clear();
}
///////////////////////////////////////////////////////
//
void G4AdjointCSMatrix::Clear()
{
theLogPrimEnergyVector.clear();
theLogCrossSectionVector.clear();
theLogSecondEnergyMatrix.clear();
theLogProbMatrix.clear();
theLogProbMatrixIndex.clear();
log0Vector.clear();
nb_of_PrimEnergy=0;
}
///////////////////////////////////////////////////////
//
void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy,G4double aLogCS, std::vector< G4double>* aLogSecondEnergyVector,
std::vector< G4double>* aLogProbVector,size_t n_pro_decade){
G4AdjointInterpolator* theInterpolator=G4AdjointInterpolator::GetInstance();
//Add this time we consider that the energy are given monotically
theLogPrimEnergyVector.push_back(aLogPrimEnergy);
theLogCrossSectionVector.push_back(aLogCS);
theLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
//G4cout<<"Test Add Data "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
//G4cout<<theSecondEnergyMatrix.size()<<std::endl;
theLogProbMatrix.push_back(aLogProbVector);
//G4cout<<"Test Add Data 1 "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
//G4cout<<theSecondEnergyMatrix.size()<<std::endl;
std::vector< size_t>* aLogProbVectorIndex = 0;
dlog =0;
if (n_pro_decade > 0 && aLogProbVector->size()>0) {
aLogProbVectorIndex = new std::vector< size_t>();
dlog=std::log(10.)/n_pro_decade;
G4double log_val = int(std::min((*aLogProbVector)[0],aLogProbVector->back())/dlog)*dlog;
log0Vector.push_back(log_val);
while(log_val<0.) {
aLogProbVectorIndex->push_back(theInterpolator->FindPosition(log_val,(*aLogProbVector)));
log_val+=dlog;
}
}
else {
log0Vector.push_back(0.);
}
theLogProbMatrixIndex.push_back(aLogProbVectorIndex);
nb_of_PrimEnergy++;
}
///////////////////////////////////////////////////////
//
bool G4AdjointCSMatrix::GetData(unsigned int i, G4double& aLogPrimEnergy,G4double& aLogCS,G4double& log0, std::vector< G4double>*& aLogSecondEnergyVector,
std::vector< G4double>*& aLogProbVector, std::vector< size_t>*& aLogProbVectorIndex)
{ if (i>= nb_of_PrimEnergy) return false;
//G4cout<<"Test Get Data "<<std::endl;
aLogPrimEnergy = theLogPrimEnergyVector[i];
aLogCS = theLogCrossSectionVector[i];
aLogSecondEnergyVector = theLogSecondEnergyMatrix[i];
//G4cout<<"Test Get Data "<<this<<'\t'<<theSecondEnergyMatrix[i]->size()<<std::endl;
//G4cout<<"Test Get Data "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
//G4cout<<"Test Get Data "<<this<<'\t'<<aSecondEnergyVector<<std::endl;
aLogProbVector = theLogProbMatrix[i];
aLogProbVectorIndex = theLogProbMatrixIndex[i];
log0=log0Vector[i];
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<theProbMatrix[i]->size()<<std::endl;
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<aProbVector->size()<<std::endl;
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<aLogProbVectorIndex<<std::endl;
return true;
}
///////////////////////////////////////////////////////
//
void G4AdjointCSMatrix::Write(G4String file_name)
{ std::fstream FileOutput(file_name, std::ios::out);
FileOutput<<std::setiosflags(std::ios::scientific);
FileOutput<<std::setprecision(6);
FileOutput<<theLogPrimEnergyVector.size()<<std::endl;
for (size_t i=0;i<theLogPrimEnergyVector.size();i++){
FileOutput<<std::exp(theLogPrimEnergyVector[i])/MeV<<'\t'<<std::exp(theLogCrossSectionVector[i])<<std::endl;
size_t j1=0;
FileOutput<<theLogSecondEnergyMatrix[i]->size()<<std::endl;
for (size_t j=0;j<theLogSecondEnergyMatrix[i]->size();j++){
FileOutput<<std::exp((*theLogSecondEnergyMatrix[i])[j]);
j1++;
if (j1<10) FileOutput<<'\t';
else {
FileOutput<<std::endl;
j1=0;
}
}
if (j1>0) FileOutput<<std::endl;
j1=0;
FileOutput<<theLogProbMatrix[i]->size()<<std::endl;
for (size_t j=0;j<theLogProbMatrix[i]->size();j++){
FileOutput<<std::exp((*theLogProbMatrix[i])[j]);
j1++;
if (j1<10) FileOutput<<'\t';
else {
FileOutput<<std::endl;
j1=0;
}
}
if (j1>0) FileOutput<<std::endl;
}
}
///////////////////////////////////////////////////////
//
void G4AdjointCSMatrix::Read(G4String file_name)
{ std::fstream FileOutput(file_name, std::ios::in);
size_t n1,n2;
theLogPrimEnergyVector.clear();
theLogCrossSectionVector.clear();
theLogSecondEnergyMatrix.clear();
theLogProbMatrix.clear();
FileOutput>>n1;
for (size_t i=0; i<n1;i++){
G4double E,CS;
FileOutput>>E>>CS;
theLogPrimEnergyVector.push_back(E);
theLogCrossSectionVector.push_back(CS);
FileOutput>>n2;
theLogSecondEnergyMatrix.push_back(new std::vector<double>());
theLogProbMatrix.push_back(new std::vector<double>());
for (size_t j=0; j<n2;j++){
G4double E1;
FileOutput>>E1;
theLogSecondEnergyMatrix[i]->push_back(E1);
}
FileOutput>>n2;
for (size_t j=0; j<n2;j++){
G4double prob;
FileOutput>>prob;
theLogProbMatrix[i]->push_back(prob);
}
}
}
@@ -0,0 +1,252 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointComptonModel.hh"
#include "G4AdjointCSManager.hh"
#include "G4Integrator.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointElectron.hh"
#include "G4AdjointGamma.hh"
#include "G4Gamma.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointComptonModel::G4AdjointComptonModel():
G4VEmAdjointModel("AdjointCompton")
{ SetApplyCutInRange(false);
SetUseMatrix(true);
SetUseMatrixPerElement(true);
SetIsIonisation(false);
SetUseOnlyOneMatrixForAllElements(true);
theAdjEquivOfDirectPrimPartDef =G4AdjointGamma::AdjointGamma();
theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
theDirectPrimaryPartDef=G4Gamma::Gamma();
second_part_of_same_type=false;
}
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointComptonModel::~G4AdjointComptonModel()
{;}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointComptonModel::SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange)
{
//A recall of the compton scattering law is
//Egamma2=Egamma1/(1+(Egamma1/E0_electron)(1.-cos_th))
//Therefore Egamma2_max= Egamma2(cos_th=1) = Egamma1
//Therefore Egamma2_min= Egamma2(cos_th=-1) = Egamma1/(1+2.(Egamma1/E0_electron))
const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
//DefineCurrentMaterial(aTrack->GetMaterialCutsCouple());
size_t ind= 0;
//Elastic inverse scattering //not correct in all the cases
//---------------------------------------------------------
G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
//G4cout<<adjointPrimKinEnergy<<std::endl;
if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
return;
}
//Sample secondary energy
//-----------------------
G4double gammaE1;
gammaE1 = SampleAdjSecEnergyFromCSMatrix(ind,
adjointPrimKinEnergy,
IsScatProjToProjCase);
//gammaE2
//-----------
G4double gammaE2 = adjointPrimKinEnergy;
if (!IsScatProjToProjCase) gammaE2 = gammaE1 - adjointPrimKinEnergy;
//Cos th
//-------
// G4cout<<"Compton scattering "<<gammaE1<<'\t'<<gammaE2<<std::endl;
G4double cos_th = 1.+ electron_mass_c2*(1./gammaE1 -1./gammaE2);
if (!IsScatProjToProjCase) {
G4double p_elec=theAdjointPrimary->GetTotalMomentum();
cos_th = (gammaE1 - gammaE2*cos_th)/p_elec;
}
G4double sin_th = 0.;
if (std::abs(cos_th)>1){
//G4cout<<"Problem in compton scattering with cos_th "<<cos_th<<std::endl;
if (cos_th>0) {
cos_th=1.;
}
else cos_th=-1.;
sin_th=0.;
}
else sin_th = std::sqrt(1.-cos_th*cos_th);
//gamma0 momentum
//--------------------
G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
G4double phi =G4UniformRand()*2.*3.1415926;
G4ThreeVector gammaMomentum1 = gammaE1*G4ThreeVector(std::cos(phi)*sin_th,std::sin(phi)*sin_th,cos_th);
gammaMomentum1.rotateUz(dir_parallel);
// G4cout<<gamma0Energy<<'\t'<<gamma0Momentum<<std::endl;
//It is important to correct the weight of particles before adding the secondary
//------------------------------------------------------------------------------
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), adjointPrimKinEnergy,gammaE1);
if (!IsScatProjToProjCase && CorrectWeightMode){ //kill the primary and add a secondary
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,gammaMomentum1));
//G4cout<<"gamma0Momentum "<<gamma0Momentum<<std::endl;
}
else {
fParticleChange->ProposeEnergy(gammaE1);
fParticleChange->ProposeMomentumDirection(gammaMomentum1.unit());
}
}
////////////////////////////////////////////////////////////////////////////////
//
//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
G4double G4AdjointComptonModel::DiffCrossSectionPerAtomPrimToSecond(
G4double gamEnergy0,
G4double kinEnergyElec,
G4double Z,
G4double A)
{
G4double gamEnergy1 = gamEnergy0 - kinEnergyElec;
G4double dSigmadEprod=0.;
if (gamEnergy1>0.) dSigmadEprod=DiffCrossSectionPerAtomPrimToScatPrim(gamEnergy0,gamEnergy1,Z,A);
return dSigmadEprod;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointComptonModel::DiffCrossSectionPerAtomPrimToScatPrim(
G4double gamEnergy0,
G4double gamEnergy1,
G4double Z,
G4double )
{ //Based on Klein Nishina formula
//* In the forward case (see G4KleinNishinaModel) the cross section is parametrised while 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 normalidsed differential Klein Nishida cross section
//Klein Nishida Cross Section
//-----------------------------
G4double epsilon = gamEnergy0 / electron_mass_c2 ;
G4double one_plus_two_epsi =1.+2.*epsilon;
G4double gamEnergy1_max = gamEnergy0;
G4double gamEnergy1_min = gamEnergy0/one_plus_two_epsi;
if (gamEnergy1 >gamEnergy1_max || gamEnergy1<gamEnergy1_min) {
/*G4cout<<"the differential CS is null"<<std::endl;
G4cout<<gamEnergy0<<std::endl;
G4cout<<gamEnergy1<<std::endl;
G4cout<<gamEnergy1_min<<std::endl;*/
return 0.;
}
G4double epsi2 = epsilon *epsilon ;
G4double one_plus_two_epsi_2=one_plus_two_epsi*one_plus_two_epsi;
G4double CS=std::log(one_plus_two_epsi)*(1.- 2.*(1.+epsilon)/epsi2);
CS+=4./epsilon +0.5*(1.-1./one_plus_two_epsi_2);
CS/=epsilon;
//Note that the pi*re2*Z factor is neglected because it is suppresed when computing dCS_dE1/CS;
// in the differential cross section
//Klein Nishida Differential Cross Section
//-----------------------------------------
G4double epsilon1 = gamEnergy1 / electron_mass_c2 ;
G4double v= epsilon1/epsilon;
G4double term1 =1.+ 1./epsilon -1/epsilon1;
G4double dCS_dE1= 1./v +v + term1*term1 -1.;
dCS_dE1 *=1./epsilon/gamEnergy0;
//Normalised to the CS used in G4
//-------------------------------
G4double G4direct_CS = theDirectEMModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),
gamEnergy0,
Z, 0., 0.,0.);
dCS_dE1 *= G4direct_CS/CS;
/* G4cout<<"the differential CS is not null"<<std::endl;
G4cout<<gamEnergy0<<std::endl;
G4cout<<gamEnergy1<<std::endl;*/
return dCS_dE1;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointComptonModel::GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
{ G4double inv_e_max = 1./PrimAdjEnergy - 2./electron_mass_c2;
G4double e_max = HighEnergyLimit;
if (inv_e_max > 0. ) e_max=std::min(1./inv_e_max,HighEnergyLimit);
return e_max;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointComptonModel::GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
{ G4double half_e=PrimAdjEnergy/2.;
G4double term=std::sqrt(half_e*(electron_mass_c2+half_e));
G4double emin=half_e+term;
return emin;
}
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointCSMatrix.hh"
#include "G4AdjointInterpolator.hh"
G4AdjointInterpolator* G4AdjointInterpolator::theInstance = 0;
///////////////////////////////////////////////////////
//
G4AdjointInterpolator* G4AdjointInterpolator::GetAdjointInterpolator()
{ if(theInstance == 0) {
static G4AdjointInterpolator interpolator;
theInstance = &interpolator;
}
return theInstance;
}
///////////////////////////////////////////////////////
//
G4AdjointInterpolator* G4AdjointInterpolator::GetInstance()
{ if(theInstance == 0) {
static G4AdjointInterpolator interpolator;
theInstance = &interpolator;
}
return theInstance;
}
///////////////////////////////////////////////////////
//
G4AdjointInterpolator::G4AdjointInterpolator()
{;
}
///////////////////////////////////////////////////////
//
G4AdjointInterpolator::~G4AdjointInterpolator()
{;
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::LinearInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2)
{ G4double res = y1+ (x-x1)*(y2-y1)/(x2-x1);
//G4cout<<"Linear "<<res<<std::endl;
return res;
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::LogarithmicInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2)
{ if (y1<=0 || y2<=0 || x1<=0) return LinearInterpolation(x,x1,x2,y1,y2);
G4double B=std::log(y2/y1)/std::log(x2/x1);
//G4cout<<"x1,x2,y1,y2 "<<x1<<'\t'<<x2<<'\t'<<y1<<'\t'<<y2<<'\t'<<std::endl;
G4double A=y1/std::pow(x1,B);
G4double res=A*std::pow(x,B);
// G4cout<<"Log "<<res<<std::endl;
return res;
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::ExponentialInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2)
{ G4double B=(std::log(y2)-std::log(y1));
B=B/(x2-x1);
G4double A=y1*std::exp(-B*x1);
G4double res=A*std::exp(B*x);
return res;
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::Interpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2,G4String InterPolMethod)
{
if (InterPolMethod == "Log" ){
return LogarithmicInterpolation(x,x1,x2,y1,y2);
}
else if (InterPolMethod == "Lin" ){
return LinearInterpolation(x,x1,x2,y1,y2);
}
else if (InterPolMethod == "Exp" ){
return ExponentialInterpolation(x,x1,x2,y1,y2);
}
else {
//G4cout<<"The interpolation method that you invoked does not exist!"<<std::endl;
return -1111111111.;
}
}
///////////////////////////////////////////////////////
//
size_t G4AdjointInterpolator::FindPosition(G4double& x,std::vector<double>& x_vec,size_t , size_t ) //only valid if x_vec is monotically increasing
{ //most rapid nethod could be used probably
//It is important to put std::vector<double>& such that the vector itself is used and not a copy
size_t ndim = x_vec.size();
size_t ind1 = 0;
size_t ind2 = ndim - 1;
/* if (ind_max >= ind_min){
ind1=ind_min;
ind2=ind_max;
}
*/
if (ndim >1) {
if (x_vec[0] < x_vec[1] ) { //increasing
do {
size_t midBin = (ind1 + ind2)/2;
if (x < x_vec[midBin])
ind2 = midBin;
else
ind1 = midBin;
} while (ind2 - ind1 > 1);
}
else {
do {
size_t midBin = (ind1 + ind2)/2;
if (x < x_vec[midBin])
ind1 = midBin;
else
ind2 = midBin;
} while (ind2 - ind1 > 1);
}
}
return ind1;
}
///////////////////////////////////////////////////////
//
size_t G4AdjointInterpolator::FindPositionForLogVector(G4double& log_x,std::vector<double>& log_x_vec) //only valid if x_vec is monotically increasing
{ //most rapid nethod could be used probably
//It is important to put std::vector<double>& such that the vector itself is used and not a copy
if (log_x_vec.size()>3){
size_t ind=0;
G4double log_x1=log_x_vec[1];
G4double d_log =log_x_vec[2]-log_x1;
G4double dind=(log_x-log_x1)/d_log +1.;
if (dind <1.) ind=0;
else if (dind >= double(log_x_vec.size())-2.) ind =log_x_vec.size()-2;
else ind =size_t(dind);
return ind;
}
else return FindPosition(log_x, log_x_vec);
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::Interpolate(G4double& x,std::vector<double>& x_vec,std::vector<double>& y_vec,G4String InterPolMethod)
{ size_t i=FindPosition(x,x_vec);
//G4cout<<i<<std::endl;
//G4cout<<x<<std::endl;
//G4cout<<x_vec[i]<<std::endl;
return Interpolation( x,x_vec[i],x_vec[i+1],y_vec[i],y_vec[i+1],InterPolMethod);
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::InterpolateWithIndexVector(G4double& x,std::vector<double>& x_vec,std::vector<double>& y_vec,
std::vector<size_t>& index_vec,G4double x0, G4double dx) //only linear interpolation possible
{ size_t ind=0;
if (x>x0) ind=int((x-x0)/dx);
if (ind >= index_vec.size()-1) ind= index_vec.size()-2;
size_t ind1 = index_vec[ind];
size_t ind2 = index_vec[ind+1];
if (ind1 >ind2) {
size_t ind11=ind1;
ind1=ind2;
ind2=ind11;
}
ind=FindPosition(x,x_vec,ind1,ind2);
return Interpolation( x,x_vec[ind],x_vec[ind+1],y_vec[ind],y_vec[ind+1],"Lin");
}
///////////////////////////////////////////////////////
//
G4double G4AdjointInterpolator::InterpolateForLogVector(G4double& log_x,std::vector<double>& log_x_vec,std::vector<double>& log_y_vec)
{ //size_t i=0;
size_t i=FindPositionForLogVector(log_x,log_x_vec);
/*G4cout<<"In interpolate "<<std::endl;
G4cout<<i<<std::endl;
G4cout<<log_x<<std::endl;
G4cout<<log_x_vec[i]<<std::endl;
G4cout<<log_x_vec[i+1]<<std::endl;
G4cout<<log_y_vec[i]<<std::endl;
G4cout<<log_y_vec[i+1]<<std::endl;*/
G4double log_y=LinearInterpolation(log_x,log_x_vec[i],log_x_vec[i+1],log_y_vec[i],log_y_vec[i+1]);
return log_y;
}
@@ -0,0 +1,221 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4AdjointPhotoElectricModel.hh"
#include "G4AdjointCSManager.hh"
#include "G4Integrator.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointElectron.hh"
#include "G4Gamma.hh"
#include "G4AdjointGamma.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointPhotoElectricModel::G4AdjointPhotoElectricModel():
G4VEmAdjointModel("AdjointPEEffect")
{ SetUseMatrix(false);
current_eEnergy =0.;
totAdjointCS=0.;
}
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointPhotoElectricModel::~G4AdjointPhotoElectricModel()
{;}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointPhotoElectricModel::SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange)
{ if (IsScatProjToProjCase) return ;
//Compute the totAdjointCS vectors if not already done for the current couple and electron energy
const G4MaterialCutsCouple* aCouple = aTrack.GetMaterialCutsCouple();
const G4DynamicParticle* aDynPart = aTrack.GetDynamicParticle() ;
G4double electronEnergy = aDynPart->GetKineticEnergy();
G4ThreeVector electronDirection= aDynPart->GetMomentumDirection() ;
totAdjointCS = AdjointCrossSection(aCouple, electronEnergy,IsScatProjToProjCase);
//Sample gamma energy
//-------------
/////////////////////////////////////////////////////////////////////////////////
// Module: G4ContinuousGainOfEnergy.hh
// Author: L. Desorgher
// Date: 1 September 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1 September 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Modell for the adjoint compton scattering
//
//Sample element
//-------------
const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
size_t nelm = currentMaterial->GetNumberOfElements();
G4double rand_CS= totAdjointCS*G4UniformRand();
for (index_element=0; index_element<nelm-1; index_element++){
if (rand_CS<xsec[index_element]) break;
}
//Sample shell and binding energy
//-------------
rand_CS= totAdjointCS*G4UniformRand()/theAtomNumDensityVector[index_element];
G4int nShells = (*theElementVector)[index_element]->GetNbOfAtomicShells();
G4int i = 0;
for (i=0; i<nShells-1; i++){
if (rand_CS<shell_prob[index_element][i]) break;
}
G4double gammaEnergy= electronEnergy+(*theElementVector)[index_element]->GetAtomicShell(i);
//Sample cos theta
//Copy of the G4PEEffectModel cos theta sampling method ElecCosThetaDistribution.
//This method cannot be used directly from G4PEEffectModel because it is a friend method. I should ask Vladimir to change that
//------------------------------------------------------------------------------------------------
//G4double cos_theta = theDirectPEEffectModel->ElecCosThetaDistribution(electronEnergy);
G4double cos_theta = 1.;
G4double gamma = 1. + electronEnergy/electron_mass_c2;
if (gamma <= 5.) {
G4double beta = std::sqrt(gamma*gamma-1.)/gamma;
G4double b = 0.5*gamma*(gamma-1.)*(gamma-2);
G4double rndm,term,greject,grejsup;
if (gamma < 2.) grejsup = gamma*gamma*(1.+b-beta*b);
else grejsup = gamma*gamma*(1.+b+beta*b);
do { rndm = 1.-2*G4UniformRand();
cos_theta = (rndm+beta)/(rndm*beta+1.);
term = 1.-beta*cos_theta;
greject = (1.-cos_theta*cos_theta)*(1.+b*term)/(term*term);
} while(greject < G4UniformRand()*grejsup);
}
// direction of the adjoint gamma electron
//---------------------------------------
G4double sin_theta = std::sqrt(1.-cos_theta*cos_theta);
G4double Phi = twopi * G4UniformRand();
G4double dirx = sin_theta*std::cos(Phi),diry = sin_theta*std::sin(Phi),dirz = cos_theta;
G4ThreeVector adjoint_gammaDirection(dirx,diry,dirz);
adjoint_gammaDirection.rotateUz(electronDirection);
//Weight correction
//-----------------------
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), electronEnergy,gammaEnergy);
//Create secondary and modify fParticleChange
//--------------------------------------------
G4DynamicParticle* anAdjointGamma = new G4DynamicParticle (
G4AdjointGamma::AdjointGamma(),adjoint_gammaDirection, gammaEnergy);
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(anAdjointGamma);
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointPhotoElectricModel::AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
G4double electronEnergy,
G4bool IsScatProjToProjCase)
{ if (IsScatProjToProjCase) return 0.;
if (aCouple !=currentCouple || current_eEnergy !=electronEnergy) {
totAdjointCS = 0.;
DefineCurrentMaterialAndElectronEnergy(aCouple, electronEnergy);
const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
size_t nelm = currentMaterial->GetNumberOfElements();
for (index_element=0;index_element<nelm;index_element++){
totAdjointCS +=AdjointCrossSectionPerAtom((*theElementVector)[index_element],electronEnergy)*theAtomNumDensityVector[index_element];
xsec[index_element] = totAdjointCS;
}
}
return totAdjointCS;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4AdjointPhotoElectricModel::AdjointCrossSectionPerAtom(const G4Element* anElement,G4double electronEnergy)
{
G4int nShells = anElement->GetNbOfAtomicShells();
G4double Z= anElement->GetZ();
G4double N= anElement->GetN();
G4int i = 0;
G4double B0=anElement->GetAtomicShell(0);
G4double gammaEnergy = electronEnergy+B0;
G4double adjointCS = theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,N,0.,0.)*electronEnergy/gammaEnergy;
shell_prob[index_element][0] = adjointCS;
for (i=1;i<nShells;i++){
//G4cout<<i<<std::endl;
G4double Bi_= anElement->GetAtomicShell(i-1);
G4double Bi = anElement->GetAtomicShell(i);
//G4cout<<Bi_<<'\t'<<Bi<<std::endl;
if (electronEnergy <Bi_-Bi) {
gammaEnergy = electronEnergy+Bi;
adjointCS +=theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,anElement->GetZ(),N,0.,0.)*electronEnergy/gammaEnergy;
}
shell_prob[index_element][i] = adjointCS;
}
return adjointCS;
}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointPhotoElectricModel::DefineCurrentMaterialAndElectronEnergy(const G4MaterialCutsCouple* couple, G4double anEnergy)
{ currentCouple = const_cast<G4MaterialCutsCouple*> (couple);
currentMaterial = const_cast<G4Material*> (couple->GetMaterial());
currentCoupleIndex = couple->GetIndex();
currentMaterialIndex = currentMaterial->GetIndex();
current_eEnergy = anEnergy;
}
@@ -0,0 +1,169 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4ContinuousGainOfEnergy.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VEmModel.hh"
#include "G4VEmFluctuationModel.hh"
#include "G4VParticleChange.hh"
#include "G4UnitsTable.hh"
///////////////////////////////////////////////////////
//
G4ContinuousGainOfEnergy::G4ContinuousGainOfEnergy(const G4String& name,
G4ProcessType type): G4VContinuousProcess(name, type)
{
linLossLimit=0.05;
lossFluctuationArePossible =true;
lossFluctuationFlag=true;
is_integral = false;
}
///////////////////////////////////////////////////////
//
G4ContinuousGainOfEnergy::~G4ContinuousGainOfEnergy()
{
}
///////////////////////////////////////////////////////
//
void G4ContinuousGainOfEnergy::PreparePhysicsTable(
const G4ParticleDefinition& )
{//theDirectEnergyLossProcess->PreparePhysicsTable(part);
;
}
///////////////////////////////////////////////////////
//
void G4ContinuousGainOfEnergy::BuildPhysicsTable(const G4ParticleDefinition&)
{//theDirectEnergyLossProcess->BuildPhysicsTable(part);
;
}
///////////////////////////////////////////////////////
//
//
G4VParticleChange* G4ContinuousGainOfEnergy::AlongStepDoIt(const G4Track& track,
const G4Step& step)
{
aParticleChange.Initialize(track);
// Get the actual (true) Step length
//----------------------------------
G4double length = step.GetStepLength();
G4double degain = 0.0;
// Compute this for weight change after continuous energy loss
//-------------------------------------------------------------
G4double DEDX_before =
theDirectEnergyLossProcess
->GetDEDX(preStepKinEnergy, currentCouple);
// For the fluctuation we generate a new dynamic particle with energy =preEnergy+egain
// and then compute the fluctuation given in the direct case.
//-----------------------------------------------------------------------
G4DynamicParticle* dynParticle = new G4DynamicParticle();
*dynParticle = *(track.GetDynamicParticle());
G4double Tkin = dynParticle->GetKineticEnergy();
size_t n=1;
if (is_integral ) n=10;
G4double dlength= length/n;
for (size_t i=0;i<n;i++) {
G4double r = theDirectEnergyLossProcess->GetRange(Tkin, currentCouple);
if( dlength <= linLossLimit * r ) {
degain = DEDX_before*dlength;
}
else {
G4double x = r + length;
degain = theDirectEnergyLossProcess->GetKineticEnergy(x,currentCouple) - theDirectEnergyLossProcess->GetKineticEnergy(r,currentCouple);
}
G4VEmModel* currentModel = theDirectEnergyLossProcess->SelectModelForMaterial(Tkin+degain,currentMaterialIndex);
G4double tmax = currentModel->MaxSecondaryKinEnergy(dynParticle);
tmax = std::min(tmax,currentTcut);
// Sample fluctuations
//-------------------
G4double deltaE =0.;
if (lossFluctuationFlag ) {
deltaE = currentModel->GetModelOfFluctuations()->
SampleFluctuations(currentMaterial,dynParticle,tmax,length,degain)-degain;
}
Tkin+=degain+deltaE;
dynParticle->SetKineticEnergy(Tkin);
}
// Corrections, which cannot be tabulated
// probably this should be also changed
// at this time it does nothing so we can leave it
//CorrectionsAlongStep(currentCouple, dynParticle, egain, length);
delete dynParticle;
G4double DEDX_after = theDirectEnergyLossProcess->GetDEDX(Tkin, currentCouple);
G4double weight_correction=DEDX_after/DEDX_before; //probably not needed
weight_correction=1.;
aParticleChange.ProposeEnergy(Tkin);
//we still need to register in the particleChange the modification of the weight of the particle
G4double new_weight=weight_correction*track.GetWeight();
aParticleChange.SetParentWeightByProcess(true);
aParticleChange.ProposeParentWeight(new_weight);
return &aParticleChange;
}
///////////////////////////////////////////////////////
//
void G4ContinuousGainOfEnergy::SetLossFluctuations(G4bool val)
{
if(val && !lossFluctuationArePossible) return;
lossFluctuationFlag = val;
}
@@ -0,0 +1,40 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4InversePEEffect.hh"
#include "G4VEmAdjointModel.hh"
#include "G4AdjointPhotoElectricModel.hh"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4InversePEEffect::G4InversePEEffect(G4String process_name,G4AdjointPhotoElectricModel* aModel):
G4VAdjointInverseScattering(process_name,false)
{theAdjointEMModel = aModel;
theAdjointEMModel->SetSecondPartOfSameType(false);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4InversePEEffect::~G4InversePEEffect(){
}
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4VAdjointInverseScattering.hh"
#include "G4AdjointCSManager.hh"
#include "G4AdjointCSMatrix.hh"
#include "G4AdjointInterpolator.hh"
#include "G4AdjointCSMatrix.hh"
#include "G4VEmAdjointModel.hh"
#include "G4ElementTable.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4AdjointCSManager.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointElectron.hh"
G4VAdjointInverseScattering::
G4VAdjointInverseScattering(G4String process_name, G4bool whichScatCase):
G4VDiscreteProcess(process_name)
{theAdjointCSManager = G4AdjointCSManager::GetAdjointCSManager();
IsScatProjToProjCase=whichScatCase;
/*theAdjointEMModel=aModel;
IsScatProjToProjCase=whichScatCase;*/
fParticleChange=new G4ParticleChange();
}
//////////////////////////////////////////////////////////////////////////////
//
G4VAdjointInverseScattering::
~G4VAdjointInverseScattering()
{;
}
//////////////////////////////////////////////////////////////////////////////
//
void G4VAdjointInverseScattering::PreparePhysicsTable(const G4ParticleDefinition&)
{;
}
//////////////////////////////////////////////////////////////////////////////
//
void G4VAdjointInverseScattering::BuildPhysicsTable(const G4ParticleDefinition&)
{
theAdjointCSManager->BuildCrossSectionMatrices(); //do not worry it will be done just once
theAdjointCSManager->BuildTotalSigmaTables();
}
//////////////////////////////////////////////////////////////////////////////
//
G4VParticleChange* G4VAdjointInverseScattering::PostStepDoIt(const G4Track& track, const G4Step& )
{
fParticleChange->Initialize(track);
theAdjointEMModel->SampleSecondaries(track,
IsScatProjToProjCase,
fParticleChange);
ClearNumberOfInteractionLengthLeft();
return fParticleChange;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VAdjointInverseScattering::GetMeanFreePath(const G4Track& track,
G4double ,
G4ForceCondition* condition)
{ *condition = NotForced;
G4double preStepKinEnergy = track.GetKineticEnergy();
G4double Sigma =
theAdjointEMModel->AdjointCrossSection(track.GetMaterialCutsCouple(),preStepKinEnergy,IsScatProjToProjCase);
G4double mean_free_path = 1./Sigma;
//G4cout<<"mean_free_path [mm] "<<mean_free_path/mm<<std::endl;
return mean_free_path;
}
@@ -0,0 +1,878 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4VEmAdjointModel.hh"
#include "G4AdjointCSManager.hh"
#include "G4Integrator.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleChange.hh"
#include "G4AdjointElectron.hh"
#include "G4AdjointInterpolator.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4VEmAdjointModel::G4VEmAdjointModel(const G4String& nam):
name(nam)
// lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
{ G4AdjointCSManager::GetAdjointCSManager()->RegisterEmAdjointModel(this);
CorrectWeightMode =true;
UseMatrix =true;
UseMatrixPerElement = true;
ApplyCutInRange = true;
ApplyBiasing = true;
UseOnlyOneMatrixForAllElements = true;
IsIonisation =true;
CS_biasing_factor =1.;
//ApplyBiasing = false;
}
////////////////////////////////////////////////////////////////////////////////
//
G4VEmAdjointModel::~G4VEmAdjointModel()
{;}
////////////////////////////////////////////////////////////////////////////////
//
void G4VEmAdjointModel::SampleSecondaries(const G4Track& aTrack,
G4bool IsScatProjToProjCase,
G4ParticleChange* fParticleChange)
{
const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
//DefineCurrentMaterial(aTrack->GetMaterialCutsCouple());
size_t ind=0;
if (!UseMatrixPerElement) ind = currentMaterialIndex;
//G4cout<<theAdjointPrimary<<std::endl;
else if (!UseOnlyOneMatrixForAllElements) { //Select Material
std::vector<double>* CS_Vs_Element = &CS_Vs_ElementForScatProjToProjCase;
if ( !IsScatProjToProjCase) CS_Vs_Element = &CS_Vs_ElementForProdToProjCase;
G4double rand_var= G4UniformRand();
G4double SumCS=0.;
for (size_t i=0;i<CS_Vs_Element->size();i++){
SumCS+=(*CS_Vs_Element)[i];
if (rand_var<=SumCS/lastCS){
ind=i;
break;
}
}
ind = currentMaterial->GetElement(ind)->GetIndex();
}
//Elastic inverse scattering //not correct in all the cases
//---------------------------------------------------------
G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
G4double adjointPrimTotalEnergy = theAdjointPrimary->GetTotalEnergy();
G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
//G4cout<<adjointPrimKinEnergy<<std::endl;
if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
return;
}
//Sample secondary energy
//-----------------------
G4double projectileKinEnergy;
// if (!IsIonisation ) {
projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(ind,
adjointPrimKinEnergy,
IsScatProjToProjCase);
//}
/*else {
projectileKinEnergy = SampleAdjSecEnergyFromDiffCrossSectionPerAtom(adjointPrimKinEnergy,IsScatProjToProjCase);
//G4cout<<projectileKinEnergy<<std::endl;
}*/
//Weight correction
//-----------------------
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), adjointPrimKinEnergy,projectileKinEnergy);
//Kinematic
//---------
G4double projectileM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
//Companion
//-----------
G4double companionM0;
companionM0=(adjointPrimTotalEnergy-adjointPrimKinEnergy);
if (IsScatProjToProjCase) {
companionM0=theAdjEquivOfDirectSecondPartDef->GetPDGMass();
}
G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;
//Projectile momentum
//--------------------
G4double P_parallel = (adjointPrimP*adjointPrimP + projectileP2 - companionP2)/(2.*adjointPrimP);
G4double P_perp = std::sqrt( projectileP2 - P_parallel*P_parallel);
G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
G4double phi =G4UniformRand()*2.*3.1415926;
G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
projectileMomentum.rotateUz(dir_parallel);
if (!IsScatProjToProjCase && CorrectWeightMode){ //kill the primary and add a secondary
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
//G4cout<<"projectileMomentum "<<projectileMomentum<<std::endl;
}
else {
fParticleChange->ProposeEnergy(projectileKinEnergy);
fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
}
}
////////////////////////////////////////////////////////////////////////////////
//
void G4VEmAdjointModel::CorrectPostStepWeight(G4ParticleChange* fParticleChange, G4double old_weight, G4double , G4double )
{
G4double new_weight=old_weight;
if (CorrectWeightMode) {
G4double w_corr =1./CS_biasing_factor;
//G4cout<<w_corr<<std::endl;
/*G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection(theAdjEquivOfDirectPrimPartDef,
theAdjEquivOfDirectSecondPartDef,
adjointPrimKinEnergy,projectileKinEnergy,
aTrack.GetMaterialCutsCouple());
w_corr = projectileKinEnergy;
G4double Emin,Emax;
if (IsScatProjToProjCase) {
Emax = GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
Emin = GetSecondAdjEnergyMinForScatProjToProjCase(adjointPrimKinEnergy, currentTcutForDirectSecond);
}
else {
Emax = GetSecondAdjEnergyMaxForProdToProjCase(adjointPrimKinEnergy);
Emin = GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);
}
w_corr *=std::log(Emax/Emin)/(Emax-Emin); */
new_weight*=w_corr;
}
G4cout<< "new weight"<<new_weight<<std::endl;
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
fParticleChange->ProposeParentWeight(new_weight);
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
G4double primEnergy,
G4bool IsScatProjToProjCase)
{
DefineCurrentMaterial(aCouple);
//G4double fwdCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalForwardCS(G4AdjointElectron::AdjointElectron(),primEnergy,aCouple);
//G4double adjCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(G4AdjointElectron::AdjointElectron(), primEnergy,aCouple);
if (IsScatProjToProjCase){
lastCS = G4AdjointCSManager::GetAdjointCSManager()->ComputeAdjointCS(currentMaterial,
this,
primEnergy,
currentTcutForDirectSecond,
true,
CS_Vs_ElementForScatProjToProjCase);
/*G4double fwdCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalForwardCS(theAdjEquivOfDirectPrimPartDef,primEnergy,aCouple);
G4double adjCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(theAdjEquivOfDirectPrimPartDef, primEnergy,aCouple);
*/
//if (adjCS >0 )lastCS *=fwdCS/adjCS;
}
else {
lastCS = G4AdjointCSManager::GetAdjointCSManager()->ComputeAdjointCS(currentMaterial,
this,
primEnergy,
currentTcutForDirectSecond,
false,
CS_Vs_ElementForProdToProjCase);
/*G4double fwdCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalForwardCS(theAdjEquivOfDirectSecondPartDef,primEnergy,aCouple);
G4double adjCS = G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(theAdjEquivOfDirectSecondPartDef, primEnergy,aCouple);
*/
//if (adjCS >0 )lastCS *=fwdCS/adjCS;
//lastCS=0.;
}
return lastCS;
}
////////////////////////////////////////////////////////////////////////////////
//
//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
G4double G4VEmAdjointModel::DiffCrossSectionPerAtomPrimToSecond(
G4double kinEnergyProj,
G4double kinEnergyProd,
G4double Z,
G4double A)
{
G4double dSigmadEprod=0;
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){ //the produced particle should have a kinetic energy smaller than the projectile
G4double Tmax=kinEnergyProj;
if (second_part_of_same_type) Tmax = kinEnergyProj/2.;
return Z*DiffCrossSectionMoller(kinEnergyProj,kinEnergyProd);
//it could be thta Tmax here should be DBLMAX
//Tmax=DBLMAX;
G4double E1=kinEnergyProd;
G4double E2=kinEnergyProd*1.000001;
G4double dE=(E2-E1);
G4double sigma1=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E1,1.e20);
G4double sigma2=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E2,1.e20);
dSigmadEprod=(sigma1-sigma2)/dE;
if (dSigmadEprod>1.) {
G4cout<<"sigma1 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma1<<std::endl;
G4cout<<"sigma2 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma2<<std::endl;
G4cout<<"dsigma "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<dSigmadEprod<<std::endl;
}
}
return dSigmadEprod;
}
//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
////////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::DiffCrossSectionPerAtomPrimToScatPrim(
G4double kinEnergyProj,
G4double kinEnergyScatProj,
G4double Z,
G4double A)
{ G4double kinEnergyProd = kinEnergyProj - kinEnergyScatProj;
G4double dSigmadEprod;
if (kinEnergyProd <=0) dSigmadEprod=0;
else dSigmadEprod=DiffCrossSectionPerAtomPrimToSecond(kinEnergyProj,kinEnergyProd,Z,A);
return dSigmadEprod;
}
////////////////////////////////////////////////////////////////////////////////
//
//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
G4double G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToSecond(
const G4Material* aMaterial,
G4double kinEnergyProj,
G4double kinEnergyProd)
{
G4double dSigmadEprod=0;
G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
G4double Tmax=kinEnergyProj;
if (second_part_of_same_type) Tmax = kinEnergyProj/2.;
//it could be thta Tmax here should be DBLMAX
//Tmax=DBLMAX;
G4double E1=kinEnergyProd;
G4double E2=kinEnergyProd*1.0001;
G4double dE=(E2-E1);
G4double sigma1=theDirectEMModel->CrossSectionPerVolume(aMaterial,theDirectPrimaryPartDef,kinEnergyProj,E1,E2);
//G4double sigma2=theDirectEMModel->CrossSectionPerVolume(aMaterial,theDirectPrimaryPartDef,kinEnergyProj,E2,1.e50);
dSigmadEprod=sigma1/dE;
if (dSigmadEprod <0) { //could happen with bremstrahlung dur to suppression effect
G4cout<<"Halllllllllllllllllllllllllllllllllllllllllllllllo "<<kinEnergyProj<<'\t'<<E1<<'\t'<<dSigmadEprod<<std::endl;
E1=kinEnergyProd;
E2=E1*1.1;
dE=E2-E1;
sigma1=theDirectEMModel->CrossSectionPerVolume(aMaterial,theDirectPrimaryPartDef,kinEnergyProj,E1,1.e50);
G4double sigma2=theDirectEMModel->CrossSectionPerVolume(aMaterial,theDirectPrimaryPartDef,kinEnergyProj,E2,1.e50);
dSigmadEprod=(sigma1-sigma2)/dE;
G4cout<<dSigmadEprod<<std::endl;
}
}
return dSigmadEprod;
}
//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
////////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToScatPrim(
const G4Material* aMaterial,
G4double kinEnergyProj,
G4double kinEnergyScatProj)
{ G4double kinEnergyProd = kinEnergyProj - kinEnergyScatProj;
G4double dSigmadEprod;
if (kinEnergyProd <=0) dSigmadEprod=0;
else dSigmadEprod=DiffCrossSectionPerVolumePrimToSecond(aMaterial,kinEnergyProj,kinEnergyProd);
return dSigmadEprod;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::DiffCrossSectionFunction1(G4double kinEnergyProj){
//return kinEnergyProj*kinEnergyProj;
//ApplyBiasing=false;
G4double bias_factor = CS_biasing_factor*kinEnergyProdForIntegration/kinEnergyProj;
if (!ApplyBiasing) bias_factor =CS_biasing_factor;
//G4cout<<bias_factor<<std::endl;
if (UseMatrixPerElement ) {
return DiffCrossSectionPerAtomPrimToSecond(kinEnergyProj,kinEnergyProdForIntegration,ZSelectedNucleus,ASelectedNucleus)*bias_factor;
}
else {
return DiffCrossSectionPerVolumePrimToSecond(SelectedMaterial,kinEnergyProj,kinEnergyProdForIntegration)*bias_factor;
}
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::DiffCrossSectionMoller(G4double kinEnergyProj,G4double kinEnergyProd){
G4double electron_mass_c2=0.51099906*MeV;
G4double energy = kinEnergyProj + electron_mass_c2;
G4double x = kinEnergyProd/kinEnergyProj;
G4double gam = energy/electron_mass_c2;
G4double gamma2 = gam*gam;
G4double beta2 = 1.0 - 1.0/gamma2;
G4double g = (2.0*gam - 1.0)/gamma2;
G4double y = 1.0 - x;
G4double fac=twopi_mc2_rcl2/electron_mass_c2;
G4double dCS = fac*( 1.-g + ((1.0 - g*x)/(x*x)) + ((1.0 - g*y)/(y*y)))/(beta2*(gam-1));
return dCS/kinEnergyProj;
}
////////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::DiffCrossSectionFunction2(G4double kinEnergyProj){
//return kinEnergyProj*kinEnergyProj;
G4double bias_factor = CS_biasing_factor*kinEnergyScatProjForIntegration/kinEnergyProj;
//ApplyBiasing=false;
if (!ApplyBiasing) bias_factor = CS_biasing_factor;
//G4cout<<bias_factor<<std::endl;
if (UseMatrixPerElement ) {
return DiffCrossSectionPerAtomPrimToScatPrim(kinEnergyProj,kinEnergyScatProjForIntegration,ZSelectedNucleus,ASelectedNucleus)*bias_factor;
}
else {
return DiffCrossSectionPerVolumePrimToScatPrim(SelectedMaterial,kinEnergyProj,kinEnergyScatProjForIntegration)*bias_factor;
}
}
////////////////////////////////////////////////////////////////////////////////
//
std::vector< std::vector<G4double>* > G4VEmAdjointModel::ComputeAdjointCrossSectionVectorPerAtomForSecond(
G4double kinEnergyProd,
G4double Z,
G4double A ,
G4int nbin_pro_decade) //nb bins pro order of magnitude of energy
{ G4Integrator<G4VEmAdjointModel, G4double(G4VEmAdjointModel::*)(G4double)> integral;
ASelectedNucleus= G4int(A);
ZSelectedNucleus=G4int(Z);
kinEnergyProdForIntegration = kinEnergyProd;
//compute the vector of integrated cross sections
//-------------------
G4double minEProj= GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
G4double maxEProj= GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double E1=minEProj;
std::vector< G4double >* log_ESec_vector = new std::vector< G4double >();
std::vector< G4double >* log_Prob_vector = new std::vector< G4double >();
log_ESec_vector->clear();
log_Prob_vector->clear();
log_ESec_vector->push_back(std::log(E1));
log_Prob_vector->push_back(-50.);
G4double E2=std::pow(10.,G4double( G4int(std::log10(minEProj)*nbin_pro_decade)+1)/nbin_pro_decade);
G4double fE=std::pow(10.,1./nbin_pro_decade);
G4double int_cross_section=0.;
if (std::pow(fE,5.)>(maxEProj/minEProj)) fE = std::pow(maxEProj/minEProj,0.2);
while (E1 <maxEProj*0.9999999){
//G4cout<<E1<<'\t'<<E2<<std::endl;
int_cross_section +=integral.Simpson(this, &G4VEmAdjointModel::DiffCrossSectionFunction1,E1,std::min(E2,maxEProj*0.99999999), 10);
//G4cout<<"int_cross_section 1 "<<'\t'<<int_cross_section<<std::endl;
log_ESec_vector->push_back(std::log(std::min(E2,maxEProj)));
log_Prob_vector->push_back(std::log(int_cross_section));
E1=E2;
E2*=fE;
}
std::vector< std::vector<G4double>* > res_mat;
res_mat.clear();
if (int_cross_section >0.) {
res_mat.push_back(log_ESec_vector);
res_mat.push_back(log_Prob_vector);
}
return res_mat;
}
/////////////////////////////////////////////////////////////////////////////////////
//
std::vector< std::vector<G4double>* > G4VEmAdjointModel::ComputeAdjointCrossSectionVectorPerAtomForScatProj(
G4double kinEnergyScatProj,
G4double Z,
G4double A ,
G4int nbin_pro_decade) //nb bins pro order of magnitude of energy
{ G4Integrator<G4VEmAdjointModel, G4double(G4VEmAdjointModel::*)(G4double)> integral;
ASelectedNucleus=G4int(A);
ZSelectedNucleus=G4int(Z);
kinEnergyScatProjForIntegration = kinEnergyScatProj;
//compute the vector of integrated cross sections
//-------------------
G4double minEProj= GetSecondAdjEnergyMinForScatProjToProjCase(kinEnergyScatProj);
G4double maxEProj= GetSecondAdjEnergyMaxForScatProjToProjCase(kinEnergyScatProj);
G4double dEmax=maxEProj-kinEnergyScatProj;
G4double dEmin=GetLowEnergyLimit();
G4double dE1=dEmin;
G4double dE2=dEmin;
std::vector< G4double >* log_ESec_vector = new std::vector< G4double >();
std::vector< G4double >* log_Prob_vector = new std::vector< G4double >();
log_ESec_vector->push_back(std::log(dEmin));
log_Prob_vector->push_back(-50.);
G4int nbins=std::max( G4int(std::log10(dEmax/dEmin))*nbin_pro_decade,5);
G4double fE=std::pow(dEmax/dEmin,1./nbins);
G4double int_cross_section=0.;
while (dE1 <dEmax*0.9999999999999){
dE2=dE1*fE;
int_cross_section +=integral.Simpson(this,
&G4VEmAdjointModel::DiffCrossSectionFunction2,minEProj+dE1,std::min(minEProj+dE2,maxEProj), 20);
//G4cout<<"int_cross_section "<<minEProj+dE1<<'\t'<<int_cross_section<<std::endl;
log_ESec_vector->push_back(std::log(std::min(dE2,maxEProj)));
log_Prob_vector->push_back(std::log(int_cross_section));
dE1=dE2;
}
/*G4cout<<"total int_cross_section"<<'\t'<<int_cross_section<<std::endl;
G4cout<<"energy "<<kinEnergyScatProj<<std::endl;*/
std::vector< std::vector<G4double> *> res_mat;
res_mat.clear();
if (int_cross_section >0.) {
res_mat.push_back(log_ESec_vector);
res_mat.push_back(log_Prob_vector);
}
return res_mat;
}
////////////////////////////////////////////////////////////////////////////////
//
std::vector< std::vector<G4double>* > G4VEmAdjointModel::ComputeAdjointCrossSectionVectorPerVolumeForSecond(
G4Material* aMaterial,
G4double kinEnergyProd,
G4int nbin_pro_decade) //nb bins pro order of magnitude of energy
{ G4Integrator<G4VEmAdjointModel, G4double(G4VEmAdjointModel::*)(G4double)> integral;
SelectedMaterial= aMaterial;
kinEnergyProdForIntegration = kinEnergyProd;
//G4cout<<aMaterial->GetName()<<std::endl;
//G4cout<<kinEnergyProd/MeV<<std::endl;
//compute the vector of integrated cross sections
//-------------------
G4double minEProj= GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
G4double maxEProj= GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
G4double E1=minEProj;
std::vector< G4double >* log_ESec_vector = new std::vector< G4double >();
std::vector< G4double >* log_Prob_vector = new std::vector< G4double >();
log_ESec_vector->clear();
log_Prob_vector->clear();
log_ESec_vector->push_back(std::log(E1));
log_Prob_vector->push_back(-50.);
G4double E2=std::pow(10.,G4double( G4int(std::log10(minEProj)*nbin_pro_decade)+1)/nbin_pro_decade);
G4double fE=std::pow(10.,1./nbin_pro_decade);
G4double int_cross_section=0.;
if (std::pow(fE,5.)>(maxEProj/minEProj)) fE = std::pow(maxEProj/minEProj,0.2);
while (E1 <maxEProj*0.9999999){
//G4cout<<E1<<'\t'<<E2<<std::endl;
int_cross_section +=integral.Simpson(this, &G4VEmAdjointModel::DiffCrossSectionFunction1,E1,std::min(E2,maxEProj*0.99999999), 10);
//G4cout<<"int_cross_section 1 "<<E1<<'\t'<<int_cross_section<<std::endl;
log_ESec_vector->push_back(std::log(std::min(E2,maxEProj)));
log_Prob_vector->push_back(std::log(int_cross_section));
E1=E2;
E2*=fE;
}
std::vector< std::vector<G4double>* > res_mat;
res_mat.clear();
//if (int_cross_section >0.) {
res_mat.push_back(log_ESec_vector);
res_mat.push_back(log_Prob_vector);
//}
return res_mat;
}
/////////////////////////////////////////////////////////////////////////////////////
//
std::vector< std::vector<G4double>* > G4VEmAdjointModel::ComputeAdjointCrossSectionVectorPerVolumeForScatProj(
G4Material* aMaterial,
G4double kinEnergyScatProj,
G4int nbin_pro_decade) //nb bins pro order of magnitude of energy
{ G4Integrator<G4VEmAdjointModel, G4double(G4VEmAdjointModel::*)(G4double)> integral;
SelectedMaterial= aMaterial;
kinEnergyScatProjForIntegration = kinEnergyScatProj;
/*G4cout<<name<<std::endl;
G4cout<<aMaterial->GetName()<<std::endl;
G4cout<<kinEnergyScatProj/MeV<<std::endl;*/
//compute the vector of integrated cross sections
//-------------------
G4double minEProj= GetSecondAdjEnergyMinForScatProjToProjCase(kinEnergyScatProj);
G4double maxEProj= GetSecondAdjEnergyMaxForScatProjToProjCase(kinEnergyScatProj);
G4double dEmax=maxEProj-kinEnergyScatProj;
G4double dEmin=GetLowEnergyLimit();
G4double dE1=dEmin;
G4double dE2=dEmin;
std::vector< G4double >* log_ESec_vector = new std::vector< G4double >();
std::vector< G4double >* log_Prob_vector = new std::vector< G4double >();
log_ESec_vector->push_back(std::log(dEmin));
log_Prob_vector->push_back(-50.);
G4int nbins=std::max( G4int(std::log10(dEmax/dEmin))*nbin_pro_decade,5);
G4double fE=std::pow(dEmax/dEmin,1./nbins);
G4double int_cross_section=0.;
while (dE1 <dEmax*0.9999999999999){
dE2=dE1*fE;
int_cross_section +=integral.Simpson(this,
&G4VEmAdjointModel::DiffCrossSectionFunction2,minEProj+dE1,std::min(minEProj+dE2,maxEProj), 20);
//G4cout<<"int_cross_section "<<minEProj+dE1<<'\t'<<int_cross_section<<std::endl;
log_ESec_vector->push_back(std::log(std::min(dE2,maxEProj)));
log_Prob_vector->push_back(std::log(int_cross_section));
dE1=dE2;
}
std::vector< std::vector<G4double> *> res_mat;
res_mat.clear();
if (int_cross_section >0.) {
res_mat.push_back(log_ESec_vector);
res_mat.push_back(log_Prob_vector);
}
return res_mat;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex,G4double aPrimEnergy,G4bool IsScatProjToProjCase)
{
G4AdjointCSMatrix* theMatrix= (*pOnCSMatrixForProdToProjBackwardScattering)[MatrixIndex];
if (IsScatProjToProjCase) theMatrix= (*pOnCSMatrixForScatProjToProjBackwardScattering)[MatrixIndex];
std::vector< G4double >* theLogPrimEnergyVector = theMatrix->GetLogPrimEnergyVector();
//G4double dLog = theMatrix->GetDlog();
if (theLogPrimEnergyVector->size() ==0){
G4cout<<"No data are contained in the given AdjointCSMatrix!"<<std::endl;
G4cout<<"The sampling procedure will be stopped."<<std::endl;
return 0.;
}
G4AdjointInterpolator* theInterpolator=G4AdjointInterpolator::GetInstance();
G4double aLogPrimEnergy = std::log(aPrimEnergy);
size_t ind =theInterpolator->FindPositionForLogVector(aLogPrimEnergy,*theLogPrimEnergyVector);
G4double aLogPrimEnergy1,aLogPrimEnergy2;
G4double aLogCS1,aLogCS2;
G4double log01,log02;
std::vector< G4double>* aLogSecondEnergyVector1 =0;
std::vector< G4double>* aLogSecondEnergyVector2 =0;
std::vector< G4double>* aLogProbVector1=0;
std::vector< G4double>* aLogProbVector2=0;
std::vector< size_t>* aLogProbVectorIndex1=0;
std::vector< size_t>* aLogProbVectorIndex2=0;
theMatrix->GetData(ind, aLogPrimEnergy1,aLogCS1,log01, aLogSecondEnergyVector1,aLogProbVector1,aLogProbVectorIndex1);
theMatrix->GetData(ind+1, aLogPrimEnergy2,aLogCS2,log02, aLogSecondEnergyVector2,aLogProbVector2,aLogProbVectorIndex2);
G4double rand_var = G4UniformRand();
G4double log_rand_var= std::log(rand_var);
G4double log_Tcut =std::log(currentTcutForDirectSecond);
G4double Esec=0;
G4double log_dE1,log_dE2;
G4double log_rand_var1,log_rand_var2;
G4double log_E1,log_E2;
log_rand_var1=log_rand_var;
log_rand_var2=log_rand_var;
G4double Emin=0.;
G4double Emax=0.;
if (theMatrix->IsScatProjToProjCase()){ //case where Tcut plays a role
//G4cout<<"Here "<<std::endl;
if (ApplyCutInRange) {
if (second_part_of_same_type && currentTcutForDirectSecond>aPrimEnergy) return aPrimEnergy;
/*if (IsIonisation){
G4double inv_Tcut= 1./currentTcutForDirectSecond;
G4double inv_dE=inv_Tcut-rand_var*(inv_Tcut-1./aPrimEnergy);
Esec= aPrimEnergy+1./inv_dE;
//return Esec;
G4double dE1=currentTcutForDirectSecond;
G4double dE2=currentTcutForDirectSecond*1.00001;
G4double dCS1=DiffCrossSectionMoller(aPrimEnergy+dE1,dE1);
G4double dCS2=DiffCrossSectionMoller(aPrimEnergy+dE2,dE2);
G4double alpha1=std::log(dCS1/dCS2)/std::log(dE1/dE2);
G4double a1=dCS1/std::pow(dE1,alpha1);
dCS1=DiffCrossSectionMoller(aPrimEnergy+dE1,dE1);
dCS2=DiffCrossSectionMoller(aPrimEnergy+dE2,dE2);
return Esec;
dE1=aPrimEnergy/1.00001;
dE2=aPrimEnergy;
dCS1=DiffCrossSectionMoller(aPrimEnergy+dE1,dE1);
dCS2=DiffCrossSectionMoller(aPrimEnergy+dE2,dE2);
G4double alpha2=std::log(dCS1/dCS2)/std::log(dE1/dE2);
G4double a2=dCS1/std::pow(dE1,alpha1);
return Esec;
}*/
log_rand_var1=log_rand_var+theInterpolator->InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector1,*aLogProbVector1);
log_rand_var2=log_rand_var+theInterpolator->InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector2,*aLogProbVector2);
}
log_dE1 = theInterpolator->Interpolate(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,"Lin");
log_dE2 = theInterpolator->Interpolate(log_rand_var2,*aLogProbVector2,*aLogSecondEnergyVector2,"Lin");
/*log_dE1 = theInterpolator->InterpolateWithIndexVector(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,*aLogProbVectorIndex1,log01,dLog);
log_dE2 = theInterpolator->InterpolateWithIndexVector(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,*aLogProbVectorIndex1,log02,dLog);
*/
Esec = aPrimEnergy +
std::exp(theInterpolator->LinearInterpolation(aLogPrimEnergy,aLogPrimEnergy1,aLogPrimEnergy2,log_dE1,log_dE2));
Emin=GetSecondAdjEnergyMinForScatProjToProjCase(aPrimEnergy);
Emax=GetSecondAdjEnergyMaxForScatProjToProjCase(aPrimEnergy);
Esec=std::max(Esec,Emin);
Esec=std::min(Esec,Emax);
//G4cout<<"Esec "<<Esec<<std::endl;
//if (Esec > 2.*aPrimEnergy && second_part_of_same_type) Esec = 2.*aPrimEnergy;
}
else { //Tcut condition is already full-filled
/*G4cout<<"Start "<<std::endl;
G4cout<<std::exp((*aLogProbVector1)[0])<<std::endl;
G4cout<<std::exp((*aLogProbVector2)[0])<<std::endl;*/
/*G4double inv_E1= .5/aPrimEnergy;
G4double inv_E=inv_E1-rand_var*(inv_E1-0.00001);
Esec= 1./inv_E;
return Esec;*/
log_E1 = theInterpolator->Interpolate(log_rand_var,*aLogProbVector1,*aLogSecondEnergyVector1,"Lin");
log_E2 = theInterpolator->Interpolate(log_rand_var,*aLogProbVector2,*aLogSecondEnergyVector2,"Lin");
/*log_E1 = theInterpolator->InterpolateWithIndexVector(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,*aLogProbVectorIndex1,log01,dLog);
log_E2 = theInterpolator->InterpolateWithIndexVector(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,*aLogProbVectorIndex1,log02,dLog);
*/
/*G4cout<<std::exp(log_E1)<<std::endl;
G4cout<<std::exp(log_E2)<<std::endl;*/
Esec = std::exp(theInterpolator->LinearInterpolation(aLogPrimEnergy,aLogPrimEnergy1,aLogPrimEnergy2,log_E1,log_E2));
Emin=GetSecondAdjEnergyMinForProdToProjCase(aPrimEnergy);
Emax=GetSecondAdjEnergyMaxForProdToProjCase(aPrimEnergy);
Esec=std::max(Esec,Emin);
Esec=std::min(Esec,Emax);
}
return Esec;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::SampleAdjSecEnergyFromDiffCrossSectionPerAtom(G4double prim_energy,G4bool IsScatProjToProjCase)
{
// here we try to use the rejection method
//-----------------------------------------
G4double E=0;
G4double x,xmin,greject,q;
if ( IsScatProjToProjCase){
G4double Emax = GetSecondAdjEnergyMaxForScatProjToProjCase(prim_energy);
G4double Emin= prim_energy+currentTcutForDirectSecond;
xmin=Emin/Emax;
G4double grejmax = DiffCrossSectionPerAtomPrimToScatPrim(Emin,prim_energy,1)*prim_energy;
do {
q = G4UniformRand();
x = 1./(q*(1./xmin -1.) +1.);
E=x*Emax;
greject = DiffCrossSectionPerAtomPrimToScatPrim( E,prim_energy ,1)*prim_energy;
}
while( greject < G4UniformRand()*grejmax );
}
else {
G4double Emax = GetSecondAdjEnergyMaxForProdToProjCase(prim_energy);
G4double Emin= GetSecondAdjEnergyMinForProdToProjCase(prim_energy);;
xmin=Emin/Emax;
G4double grejmax = DiffCrossSectionPerAtomPrimToSecond(Emin,prim_energy,1);
do {
q = G4UniformRand();
x = std::pow(xmin, q);
E=x*Emax;
greject = DiffCrossSectionPerAtomPrimToSecond( E,prim_energy ,1);
}
while( greject < G4UniformRand()*grejmax );
}
return E;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::GetSecondAdjEnergyMaxForScatProjToProjCase(G4double kinEnergyScatProj)
{ G4double maxEProj= HighEnergyLimit;
if (second_part_of_same_type) maxEProj=std::min(kinEnergyScatProj*2.,HighEnergyLimit);
return maxEProj;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut)
{ return PrimAdjEnergy+Tcut;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::GetSecondAdjEnergyMaxForProdToProjCase(G4double )
{ return HighEnergyLimit;
}
//////////////////////////////////////////////////////////////////////////////
//
G4double G4VEmAdjointModel::GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
{ G4double minEProj=PrimAdjEnergy;
if (second_part_of_same_type) minEProj=PrimAdjEnergy*2.;
return minEProj;
}
////////////////////////////////////////////////////////////////////////////////////////////
//
void G4VEmAdjointModel::DefineCurrentMaterial(const G4MaterialCutsCouple* couple)
{ if(couple != currentCouple) {
currentCouple = const_cast<G4MaterialCutsCouple*> (couple);
currentMaterial = const_cast<G4Material*> (couple->GetMaterial());
currentCoupleIndex = couple->GetIndex();
currentMaterialIndex = currentMaterial->GetIndex();
size_t idx=56;
if (theAdjEquivOfDirectPrimPartDef) {
if (theAdjEquivOfDirectPrimPartDef->GetParticleName() == "adj_gamma") idx = 0;
else if (theAdjEquivOfDirectPrimPartDef->GetParticleName() == "adj_e-") idx = 1;
else if (theAdjEquivOfDirectPrimPartDef->GetParticleName() == "adj_e+") idx = 2;
const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
currentTcutForDirectPrim=(*aVec)[currentCoupleIndex];
}
if (theAdjEquivOfDirectPrimPartDef == theAdjEquivOfDirectSecondPartDef) {
currentTcutForDirectSecond = currentTcutForDirectPrim;
}
else {
if (theAdjEquivOfDirectSecondPartDef){
if (theAdjEquivOfDirectSecondPartDef->GetParticleName() == "adj_gamma") idx = 0;
else if (theAdjEquivOfDirectSecondPartDef->GetParticleName() == "adj_e-") idx = 1;
else if (theAdjEquivOfDirectSecondPartDef->GetParticleName() == "adj_e+") idx = 2;
const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
currentTcutForDirectSecond=(*aVec)[currentCoupleIndex];
}
}
}
}
@@ -0,0 +1,40 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4eInverseBremsstrahlung.hh"
#include "G4VEmAdjointModel.hh"
#include "G4AdjointBremsstrahlungModel.hh"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseBremsstrahlung::G4eInverseBremsstrahlung(G4bool whichScatCase,G4String process_name,G4AdjointBremsstrahlungModel* aBremAdjointModel):
G4VAdjointInverseScattering(process_name,whichScatCase)
{theAdjointEMModel = aBremAdjointModel;
theAdjointEMModel->SetSecondPartOfSameType(false);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseBremsstrahlung::~G4eInverseBremsstrahlung(){
}
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////
// File name: G4eInverseCompton
//
// Author: Laurent Desorgher
//
// Creation date: 20.11.2006
//
///////////////////////////////////////////////////////
#include "G4eInverseCompton.hh"
#include "G4VEmAdjointModel.hh"
#include "G4AdjointComptonModel.hh"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseCompton::G4eInverseCompton(G4bool whichScatCase,G4String process_name,G4AdjointComptonModel* aComptonAdjointModel):
G4VAdjointInverseScattering(process_name,whichScatCase)
{theAdjointEMModel = aComptonAdjointModel;
theAdjointEMModel->SetSecondPartOfSameType(false);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseCompton::~G4eInverseCompton(){
}
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////
// File name: G4eInverseIonisation
//
// Author: Laurent Desorgher
//
// Creation date: 20.11.2006
//
///////////////////////////////////////////////////////
#include "G4eInverseIonisation.hh"
#include "G4VEmAdjointModel.hh"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseIonisation::G4eInverseIonisation(G4bool whichScatCase,G4String process_name,G4VEmAdjointModel* aEmAdjointModel):
G4VAdjointInverseScattering(process_name,whichScatCase)
{theAdjointEMModel = aEmAdjointModel;
theAdjointEMModel->SetSecondPartOfSameType(true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4eInverseIonisation::~G4eInverseIonisation(){
}
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2005/05/18 10:12:32 vnivanch Exp $
# $Id: GNUmakefile,v 1.4 2008/03/06 11:47:10 vnivanch Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# Modified:
@@ -24,6 +24,7 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/processes/electromagnetic/muons/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
@@ -1,4 +1,4 @@
$Id: History,v 1.22 2007/11/13 18:36:29 vnivanch Exp $
$Id: History,v 1.30 2008/10/16 14:29:48 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,32 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
16 October 08: V.Ivanchenko (emhighenergy-V09-01-06)
- Updated processes enumeration and printout
21 July 08: V.Ivanchenko (emhighenergy-V09-01-05)
- G4hBremsstrahlungModel, G4hPairProductionModel - do not use A in
the CrossSectionPerAtom
10 July 08: V.Ivanchenko (emhighenergy-V09-01-04)
- G4eeCrossSections - migrated to PDG 2006
- G4eeToHadronsMultiModel - added main reaction channels for omega and
phi resonances
- New models: G4eeTo3PiModel, G4eeToPGammaModel, G4ee2KChargedModel,
G4ee2KNeutralModel
8 July 08: V.Ivanchenko (emhighenergy-V09-01-03)
- G4GammaConversionToMuons - all exit() substituted by warnings
4 April 08: V.Ivanchenko (emhighenergy-V09-01-02)
- G4hBremsstrahlungModel - remove static const
14 March 08: V.Ivanchenko (emhighenergy-V09-01-01)
06 March 08: V.Ivanchenko (emhighenergy-V09-01-00)
- G4hBremsstrahlungModel, G4hBremsstrahlung, G4hPairProductionModel,
G4hPairProduction are added
- SubType for all processes is initialized
13 November 07: V.Ivanchenko (emhighenergy-V09-00-01)
- G4mplIonisationModel - introduced theoretical asymtotic low-energy
parameterization of dEdx
@@ -25,7 +25,7 @@
//
//
// $Id: G4AnnihiToMuPair.hh,v 1.2 2006/06/29 19:32:12 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// ------------ G4AnnihiToMuPair physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, November 2002
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheBlochNoDeltaModel.hh,v 1.7 2006/06/29 19:32:14 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BraggNoDeltaModel.hh,v 1.6 2006/06/29 19:32:16 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4GammaConversionToMuons.hh,v 1.2 2006/06/29 19:32:18 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// ------------ G4GammaConversionToMuons physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, April 2002
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Vee2hadrons.hh,v 1.3 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Vee2hadrons.hh,v 1.4 2008/07/10 18:06:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -62,7 +62,7 @@ class G4Vee2hadrons
public:
G4Vee2hadrons() {};
G4Vee2hadrons() : lowEnergy(0.0), highEnergy(1.1*GeV) {};
virtual ~G4Vee2hadrons() {};
@@ -75,7 +75,15 @@ public:
virtual G4PhysicsVector* PhysicsVector(G4double, G4double) const = 0;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&) const = 0;
G4double, const G4ThreeVector&) = 0;
void SetLowEnergy(G4double val) {lowEnergy = val;};
G4double LowEnergy() const {return lowEnergy;};
void SetHighEnergy(G4double val) {highEnergy = val;};
G4double HighEnergy() const {return highEnergy;};
private:
@@ -83,6 +91,9 @@ private:
G4Vee2hadrons & operator=(const G4Vee2hadrons &right);
G4Vee2hadrons(const G4Vee2hadrons&);
G4double lowEnergy;
G4double highEnergy;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,116 @@
//
// ********************************************************************
// * 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: G4ee2KChargedModel.hh,v 1.1 2008/07/10 18:07:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4ee2KChargedModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 09.07.2008
//
// Modifications:
//
//
// Class Description:
//
// -------------------------------------------------------------------
//
#ifndef G4ee2KChargedModel_h
#define G4ee2KChargedModel_h 1
#include "G4Vee2hadrons.hh"
#include "globals.hh"
#include "G4eeCrossSections.hh"
class G4DynamicParticle;
class G4PhysicsVector;
class G4ee2KChargedModel : public G4Vee2hadrons
{
public:
G4ee2KChargedModel(G4eeCrossSections*);
virtual ~G4ee2KChargedModel();
G4double ThresholdEnergy() const;
G4double PeakEnergy() const;
G4double ComputeCrossSection(G4double) const;
G4PhysicsVector* PhysicsVector(G4double, G4double) const;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&);
private:
// hide assignment operator
G4ee2KChargedModel & operator=(const G4ee2KChargedModel &right);
G4ee2KChargedModel(const G4ee2KChargedModel&);
G4eeCrossSections* cross;
G4double massK;
G4double massPhi;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KChargedModel::ThresholdEnergy() const
{
return 2.0*massK;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KChargedModel::PeakEnergy() const
{
return massPhi;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KChargedModel::ComputeCrossSection(G4double e) const
{
G4double ee = std::min(HighEnergy(),e);
return cross->CrossSection2Kcharged(ee);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,116 @@
//
// ********************************************************************
// * 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: G4ee2KNeutralModel.hh,v 1.1 2008/07/10 18:07:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4ee2KNeutralModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 09.07.2008
//
// Modifications:
//
//
// Class Description:
//
// -------------------------------------------------------------------
//
#ifndef G4ee2KNeutralModel_h
#define G4ee2KNeutralModel_h 1
#include "G4Vee2hadrons.hh"
#include "globals.hh"
#include "G4eeCrossSections.hh"
class G4DynamicParticle;
class G4PhysicsVector;
class G4ee2KNeutralModel : public G4Vee2hadrons
{
public:
G4ee2KNeutralModel(G4eeCrossSections*);
virtual ~G4ee2KNeutralModel();
G4double ThresholdEnergy() const;
G4double PeakEnergy() const;
G4double ComputeCrossSection(G4double) const;
G4PhysicsVector* PhysicsVector(G4double, G4double) const;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&);
private:
// hide assignment operator
G4ee2KNeutralModel & operator=(const G4ee2KNeutralModel &right);
G4ee2KNeutralModel(const G4ee2KNeutralModel&);
G4eeCrossSections* cross;
G4double massK;
G4double massPhi;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KNeutralModel::ThresholdEnergy() const
{
return 2.0*massK;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KNeutralModel::PeakEnergy() const
{
return massPhi;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ee2KNeutralModel::ComputeCrossSection(G4double e) const
{
G4double ee = std::min(HighEnergy(),e);
return cross->CrossSection2Kneutral(ee);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeCrossSections.hh,v 1.2 2006/06/29 19:32:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeCrossSections.hh,v 1.3 2008/07/10 18:06:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -69,10 +69,16 @@ public:
G4double CrossSection3pi(G4double);
G4double CrossSectionPi0G(G4double);
G4double CrossSectionEtaG(G4double);
G4double CrossSection2Kcharged(G4double);
G4double CrossSection2Kneutral(G4double);
std::complex<G4double> DpRho(G4double e);
private:
void Initialise();
@@ -94,13 +100,10 @@ private:
G4double WidthPhi(G4double e);
std::complex<G4double> DpRho(G4double e);
std::complex<G4double> DpOm(G4double e);
std::complex<G4double> DpPhi(G4double e);
// hide assignment operator
G4eeCrossSections & operator=(const G4eeCrossSections &right);
G4eeCrossSections(const G4eeCrossSections&);
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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: G4eeTo3PiModel.hh,v 1.1 2008/07/10 18:07:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4eeTo3PiModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 25.10.2003
//
// Modifications:
//
//
// Class Description:
//
// -------------------------------------------------------------------
//
#ifndef G4eeTo3PiModel_h
#define G4eeTo3PiModel_h 1
#include "G4Vee2hadrons.hh"
#include "globals.hh"
#include "G4eeCrossSections.hh"
class G4DynamicParticle;
class G4PhysicsVector;
class G4eeTo3PiModel : public G4Vee2hadrons
{
public:
G4eeTo3PiModel(G4eeCrossSections*);
virtual ~G4eeTo3PiModel();
G4double ThresholdEnergy() const;
G4double PeakEnergy() const;
G4double ComputeCrossSection(G4double) const;
G4PhysicsVector* PhysicsVector(G4double, G4double) const;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&);
private:
// hide assignment operator
G4eeTo3PiModel & operator=(const G4eeTo3PiModel &right);
G4eeTo3PiModel(const G4eeTo3PiModel&);
G4eeCrossSections* cross;
G4double massPi;
G4double massPi0;
G4double massOm;
G4double massPhi;
G4double gcash;
G4double gmax;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeTo3PiModel::ThresholdEnergy() const
{
return std::max(LowEnergy(),2.0*massPi + massPi0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeTo3PiModel::PeakEnergy() const
{
G4double e = massOm;
if(HighEnergy() > massPhi) e = massPhi;
return e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeTo3PiModel::ComputeCrossSection(G4double e) const
{
G4double ee = std::min(HighEnergy(),e);
return cross->CrossSection3pi(ee);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eeToHadrons.hh,v 1.8 2007/05/23 08:50:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToHadronsModel.hh,v 1.6 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToHadronsModel.hh,v 1.7 2008/07/10 18:06:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -62,15 +62,13 @@ class G4eeToHadronsModel : public G4VEmModel
public:
G4eeToHadronsModel(const G4Vee2hadrons*, G4int ver=0,
G4eeToHadronsModel(G4Vee2hadrons*, G4int ver=0,
const G4String& nam = "eeToHadrons");
virtual ~G4eeToHadronsModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
G4double PeakEnergy() const;
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
@@ -98,6 +96,8 @@ public:
G4DynamicParticle* GenerateCMPhoton(G4double);
inline G4double PeakEnergy() const;
private:
void ComputeCMCrossSectionPerElectron();
@@ -106,7 +106,7 @@ private:
G4eeToHadronsModel & operator=(const G4eeToHadronsModel &right);
G4eeToHadronsModel(const G4eeToHadronsModel&);
const G4Vee2hadrons* model;
G4Vee2hadrons* model;
G4ParticleDefinition* theGamma;
G4PhysicsVector* crossPerElectron;
G4PhysicsVector* crossBornPerElectron;
@@ -132,27 +132,4 @@ inline G4double G4eeToHadronsModel::PeakEnergy() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToHadronsModel::CrossSectionPerVolume(
const G4Material* mat,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double, G4double)
{
return mat->GetElectronDensity()*
ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToHadronsModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double, G4double)
{
return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToHadronsMultiModel.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToHadronsMultiModel.hh,v 1.6 2008/07/10 18:06:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -58,6 +58,7 @@
#include <vector>
class G4eeCrossSections;
class G4Vee2hadrons;
class G4eeToHadronsMultiModel : public G4VEmModel
{
@@ -83,18 +84,18 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeCrossSectionPerElectron(
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin = 0.0,
G4double maxEnergy = DBL_MAX);
inline G4double ComputeCrossSectionPerElectron(
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
void PrintInfo();
// Set the factor to artificially increase the crossSection (default 1)
@@ -102,6 +103,8 @@ public:
private:
void AddEEModel(G4Vee2hadrons*);
// hide assignment operator
G4eeToHadronsMultiModel & operator=(const G4eeToHadronsMultiModel &right);
G4eeToHadronsMultiModel(const G4eeToHadronsMultiModel&);
@@ -127,29 +130,6 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToHadronsMultiModel::CrossSectionPerVolume(
const G4Material* mat,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double, G4double)
{
return mat->GetElectronDensity()*
ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double, G4double)
{
return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition*,
G4double kineticEnergy,
@@ -168,25 +148,4 @@ inline G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerElectron(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void G4eeToHadronsMultiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double, G4double)
{
G4double kinEnergy = dp->GetKineticEnergy();
if (kinEnergy > thKineticEnergy) {
G4double q = cumSum[nModels-1]*G4UniformRand();
for(G4int i=0; i<nModels; i++) {
if(q <= cumSum[i]) {
(models[i])->SampleSecondaries(newp, couple,dp);
if(newp->size() > 0) fParticleChange->ProposeTrackStatus(fStopAndKill);
break;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * 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: G4eeToPGammaModel.hh,v 1.1 2008/07/10 18:07:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4eeToPGammaModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 10.07.2008
//
// Modifications:
//
//
// Class Description:
//
// -------------------------------------------------------------------
//
#ifndef G4eeToPGammaModel_h
#define G4eeToPGammaModel_h 1
#include "G4Vee2hadrons.hh"
#include "globals.hh"
#include "G4eeCrossSections.hh"
#include "G4ParticleDefinition.hh"
class G4DynamicParticle;
class G4PhysicsVector;
class G4eeToPGammaModel : public G4Vee2hadrons
{
public:
G4eeToPGammaModel(G4eeCrossSections*, const G4String&);
virtual ~G4eeToPGammaModel();
G4double ThresholdEnergy() const;
G4double PeakEnergy() const;
G4double ComputeCrossSection(G4double) const;
G4PhysicsVector* PhysicsVector(G4double, G4double) const;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&);
private:
// hide assignment operator
G4eeToPGammaModel & operator=(const G4eeToPGammaModel &right);
G4eeToPGammaModel(const G4eeToPGammaModel&);
G4eeCrossSections* cross;
G4ParticleDefinition* particle;
G4ParticleDefinition* pi0;
G4double massP;
G4double massR;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToPGammaModel::ThresholdEnergy() const
{
return LowEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToPGammaModel::PeakEnergy() const
{
return massR;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eeToPGammaModel::ComputeCrossSection(G4double e) const
{
G4double ee = std::min(HighEnergy(),e);
G4double xs;
if(particle == pi0) xs = cross->CrossSectionPi0G(ee);
else xs = cross->CrossSectionEtaG(ee);
return xs;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToTwoPiModel.hh,v 1.3 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToTwoPiModel.hh,v 1.4 2008/07/10 18:06:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -75,12 +75,10 @@ public:
G4PhysicsVector* PhysicsVector(G4double, G4double) const;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
G4double, const G4ThreeVector&) const;
G4double, const G4ThreeVector&);
private:
void Initialise();
// hide assignment operator
G4eeToTwoPiModel & operator=(const G4eeToTwoPiModel &right);
G4eeToTwoPiModel(const G4eeToTwoPiModel&);
@@ -89,7 +87,6 @@ private:
G4double massPi;
G4double massRho;
G4double highEnergy;
};
@@ -111,7 +108,7 @@ inline G4double G4eeToTwoPiModel::PeakEnergy() const
inline G4double G4eeToTwoPiModel::ComputeCrossSection(G4double e) const
{
G4double ee = std::min(GeV,e);
G4double ee = std::min(HighEnergy(),e);
return cross->CrossSection2pi(ee);
}
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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: G4hBremsstrahlung.hh,v 1.1 2008/03/06 11:47:10 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4hBremsstrahlung
//
// Author: Vladimir Ivanchenko on base of model for muons
//
// Creation date: 01.03.2008
//
// Modifications:
//
//
// Class Description:
//
// This class manages the Bremsstrahlung process for hadrons
// it inherites from G4VContinuousDiscreteProcess via G4VEnergyLossProcess.
//
// -------------------------------------------------------------------
//
#ifndef G4hBremsstrahlung_h
#define G4hBremsstrahlung_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "globals.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VEmModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4ParticleDefinition;
class G4hBremsstrahlung : public G4VEnergyLossProcess
{
public:
G4hBremsstrahlung(const G4String& processName = "hBrems");
virtual ~G4hBremsstrahlung();
G4bool IsApplicable(const G4ParticleDefinition& p);
G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*,
G4double cut);
// Print out of the class parameters
void PrintInfo();
protected:
void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*);
private:
G4hBremsstrahlung & operator=(const G4hBremsstrahlung &right);
G4hBremsstrahlung(const G4hBremsstrahlung&);
const G4ParticleDefinition* theParticle;
const G4ParticleDefinition* theBaseParticle;
G4double lowestKinEnergy;
G4bool isInitialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4bool G4hBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 110.0*MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4double G4hBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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: G4hBremsstrahlungModel.hh,v 1.2 2008/07/22 16:15:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4hBremsstrahlungModel
//
// Author: Vladimir Ivanchenko on base of G4MuBremsstrahlungModel
//
// Creation date: 28.02.2008
//
// Modifications:
//
//
//
// Class Description:
//
// Implementation of energy loss for gamma emission by hadrons
// -------------------------------------------------------------------
//
#ifndef G4hBremsstrahlungModel_h
#define G4hBremsstrahlungModel_h 1
#include "G4MuBremsstrahlungModel.hh"
class G4hBremsstrahlungModel : public G4MuBremsstrahlungModel
{
public:
G4hBremsstrahlungModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "hBrem");
virtual ~G4hBremsstrahlungModel();
protected:
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double gammaEnergy);
private:
// hide assignment operator
G4hBremsstrahlungModel & operator=(const G4hBremsstrahlungModel &right);
G4hBremsstrahlungModel(const G4hBremsstrahlungModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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: G4hPairProduction.hh,v 1.1 2008/03/06 11:47:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4hPairProduction
//
// Author: Vladimir Ivanchenko on base of model for muons
//
// Creation date: 01.03.2008
//
// Modifications:
//
//
// Class Description:
//
// This class manages the PairProduction process for hadrons
// it inherites from G4VContinuousDiscreteProcess via G4VEnergyLossProcess.
//
// -------------------------------------------------------------------
//
#ifndef G4hPairProduction_h
#define G4hPairProduction_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "globals.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VEmModel.hh"
class G4ParticleChangeForLoss;
class G4hPairProduction : public G4VEnergyLossProcess
{
public:
G4hPairProduction(const G4String& processName = "hPairProd");
virtual ~G4hPairProduction();
G4bool IsApplicable(const G4ParticleDefinition& p);
G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*, G4double cut);
// Print out of the class parameters
void PrintInfo();
protected:
void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*);
private:
G4hPairProduction & operator=(const G4hPairProduction &right);
G4hPairProduction(const G4hPairProduction&);
const G4ParticleDefinition* theParticle;
const G4ParticleDefinition* theBaseParticle;
G4ParticleChangeForLoss* fParticleChange;
G4double lowestKinEnergy;
G4bool isInitialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4bool G4hPairProduction::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 110.0*MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4double G4hPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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: G4hPairProductionModel.hh,v 1.2 2008/07/22 16:15:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4hPairProductionModel
//
// Author: Vladimir Ivanchenko on base of G4MuPairProductionModel
//
// Creation date: 28.02.2008
//
// Modifications:
//
//
//
// Class Description:
//
// Implementation of e+e- pair production by hadrons
// -------------------------------------------------------------------
//
#ifndef G4hPairProductionModel_h
#define G4hPairProductionModel_h 1
#include "G4MuPairProductionModel.hh"
class G4hPairProductionModel : public G4MuPairProductionModel
{
public:
G4hPairProductionModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "hPairProd");
virtual ~G4hPairProductionModel();
protected:
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double pairEnergy);
private:
// hide assignment operator
G4hPairProductionModel & operator=(const G4hPairProductionModel &right);
G4hPairProductionModel(const G4hPairProductionModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4hhIonisation.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4mplIonisation.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4mplIonisationModel.hh,v 1.6 2007/11/13 18:36:29 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4AnnihiToMuPair.cc,v 1.3 2006/06/29 19:32:34 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4AnnihiToMuPair.cc,v 1.5 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// ------------ G4AnnihiToMuPair physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, November 2002
@@ -65,6 +65,8 @@ G4AnnihiToMuPair::G4AnnihiToMuPair(const G4String& processName,
HighestEnergyLimit = 1000*TeV;
CrossSecFactor = 1.;
SetProcessSubType(6);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -243,9 +245,10 @@ G4VParticleChange* G4AnnihiToMuPair::PostStepDoIt(const G4Track& aTrack,
void G4AnnihiToMuPair::PrintInfoDefinition()
{
G4String comments ="e+e->mu+mu- annihilation, atomic e- at rest.\n";
G4cout << G4endl << GetProcessName() << ": " << comments
<< " threshold at " << LowestEnergyLimit/GeV << " GeV"
G4String comments ="e+e->mu+mu- annihilation, atomic e- at rest, SubType=.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< GetProcessSubType() << G4endl;
G4cout << " threshold at " << LowestEnergyLimit/GeV << " GeV"
<< " good description up to "
<< HighestEnergyLimit/TeV << " TeV for all Z." << G4endl;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheBlochNoDeltaModel.cc,v 1.3 2006/06/29 19:32:36 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BraggNoDeltaModel.cc,v 1.3 2006/06/29 19:32:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GammaConversionToMuons.cc,v 1.4 2006/06/29 19:32:40 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GammaConversionToMuons.cc,v 1.7 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// ------------ G4GammaConversionToMuons physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, April 2002
@@ -50,7 +50,9 @@ G4GammaConversionToMuons::G4GammaConversionToMuons(const G4String& processName,
LowestEnergyLimit (4*G4MuonPlus::MuonPlus()->GetPDGMass()), // 4*Mmuon
HighestEnergyLimit(1e21*eV), // ok to 1e21eV=1e12GeV, then LPM suppression
CrossSecFactor(1.)
{ }
{
SetProcessSubType(15);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -260,9 +262,9 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
if(W<1.) W=1.; // to avoid negative cross section at xmin
G4double xxp=1.-4./3.*xPM; // the main xPlus dependence
result=xxp*log(W)*LogWmaxInv;
if(result>1.)
{ G4cout << "error in dSigxPlusGen, result=" << result << " is >1" << '\n';
exit(10);
if(result>1.) {
G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
<< " in dSigxPlusGen, result=" << result << " > 1" << G4endl;
}
}
while (G4UniformRand() > result);
@@ -284,9 +286,12 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
{ t=G4UniformRand();
f1=(1.-2.*xPM+4.*xPM*t*(1.-t)) / (1.+C1/(t*t));
if(f1<0 || f1> f1_max) // should never happend
{ G4cout << "outside allowed range f1=" << f1 << G4endl;
exit(1);
}
{
G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
<< "outside allowed range f1=" << f1 << " is set to zero"
<< G4endl;
f1 = 0.0;
}
}
while ( G4UniformRand()*f1_max > f1);
// generate psi by the rejection method
@@ -298,9 +303,12 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
{ psi=2.*pi*G4UniformRand();
f2=1.-2.*xPM+4.*xPM*t*(1.-t)*(1.+cos(2.*psi));
if(f2<0 || f2> f2_max) // should never happend
{ G4cout << "outside allowed range f2=" << f2 << G4endl;
exit(1);
}
{
G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
<< "outside allowed range f2=" << f2 << " is set to zero"
<< G4endl;
f2 = 0.0;
}
}
while ( G4UniformRand()*f2_max > f2);
@@ -386,9 +394,10 @@ G4Element* G4GammaConversionToMuons::SelectRandomAtom(
void G4GammaConversionToMuons::PrintInfoDefinition()
{
G4String comments ="gamma->mu+mu- Bethe Heitler process.\n";
G4String comments ="gamma->mu+mu- Bethe Heitler process, SubType= ";
G4cout << G4endl << GetProcessName() << ": " << comments
<< " good cross section parametrization from "
<< GetProcessSubType() << G4endl;
G4cout << " good cross section parametrization from "
<< G4BestUnit(LowestEnergyLimit,"Energy")
<< " to " << HighestEnergyLimit/GeV << " GeV for all Z." << G4endl;
}
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * 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: G4ee2KChargedModel.cc,v 1.1 2008/07/10 18:07:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4ee2KChargedModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 09.07.2008
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ee2KChargedModel.hh"
#include "Randomize.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4DynamicParticle.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4eeCrossSections.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4ee2KChargedModel::G4ee2KChargedModel(G4eeCrossSections* cr):
cross(cr)
{
massK = G4KaonPlus::KaonPlus()->GetPDGMass();
massPhi = 1019.46*MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ee2KChargedModel::~G4ee2KChargedModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4ee2KChargedModel::PhysicsVector(G4double emin,
G4double emax) const
{
G4double tmin = std::max(emin, 2.0*massK);
G4double tmax = std::max(tmin, emax);
G4int nbins = (G4int)((tmax - tmin)/(1.*MeV));
G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
v->SetSpline(true);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ee2KChargedModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4double e, const G4ThreeVector& direction)
{
G4double tkin = 0.5*e - massK;
if(tkin < 0.0) tkin = 0.0;
G4double cost;
do {
cost = 2.0*G4UniformRand() - 1.0;
} while( G4UniformRand() > 1.0 - cost*cost );
G4double sint = sqrt(1.0 - cost*cost);
G4double phi = twopi * G4UniformRand();
G4ThreeVector dir(sint*cos(phi),sint*sin(phi), cost);
dir.rotateUz(direction);
// create G4DynamicParticle objects
G4DynamicParticle* p1 =
new G4DynamicParticle(G4KaonPlus::KaonPlus(),dir,tkin);
G4DynamicParticle* p2 =
new G4DynamicParticle(G4KaonMinus::KaonMinus(),-dir,tkin);
newp->push_back(p1);
newp->push_back(p2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * 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: G4ee2KNeutralModel.cc,v 1.1 2008/07/10 18:07:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4ee2KNeutralModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 09.07.2008
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ee2KNeutralModel.hh"
#include "Randomize.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
#include "G4DynamicParticle.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4eeCrossSections.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4ee2KNeutralModel::G4ee2KNeutralModel(G4eeCrossSections* cr):
cross(cr)
{
massK = G4KaonZeroLong::KaonZeroLong()->GetPDGMass();
massPhi = 1019.46*MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ee2KNeutralModel::~G4ee2KNeutralModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4ee2KNeutralModel::PhysicsVector(G4double emin,
G4double emax) const
{
G4double tmin = std::max(emin, 2.0*massK);
G4double tmax = std::max(tmin, emax);
G4int nbins = (G4int)((tmax - tmin)/(1.0*MeV));
G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
v->SetSpline(true);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ee2KNeutralModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4double e, const G4ThreeVector& direction)
{
G4double tkin = 0.5*e - massK;
if(tkin < 0.0) tkin = 0.0;
G4double cost;
do {
cost = 2.0*G4UniformRand() - 1.0;
} while( G4UniformRand() > 1.0 - cost*cost );
G4double sint = sqrt(1.0 - cost*cost);
G4double phi = twopi * G4UniformRand();
G4ThreeVector dir(sint*cos(phi),sint*sin(phi), cost);
dir.rotateUz(direction);
// create G4DynamicParticle objects
G4DynamicParticle* p1 =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),dir,tkin);
G4DynamicParticle* p2 =
new G4DynamicParticle(G4KaonZeroShort::KaonZeroShort(),-dir,tkin);
newp->push_back(p1);
newp->push_back(p2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeCrossSections.cc,v 1.6 2006/06/29 19:32:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeCrossSections.cc,v 1.7 2008/07/10 18:06:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -38,7 +38,7 @@
// Creation date: 25.10.2003
//
// Modifications:
//
// 10.07.2008 Updated for PDG Jour. Physics, G33, 1 (2006)
//
// -------------------------------------------------------------------
//
@@ -51,6 +51,7 @@
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4Eta.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZeroLong.hh"
@@ -79,22 +80,22 @@ void G4eeCrossSections::Initialise()
{
MsPi = G4PionPlus::PionPlus()->GetPDGMass();
MsPi0= G4PionZero::PionZero()->GetPDGMass();
MsEta= 547.30*MeV;
MsEta= G4Eta::Eta()->GetPDGMass();
MsEtap=957.78*MeV;
MsKs = G4KaonZeroLong::KaonZeroLong()->GetPDGMass();
MsKc=G4KaonPlus::KaonPlus()->GetPDGMass();
MsRho= 770.0*MeV;
MsOm = 781.94*MeV;
MsKc = G4KaonPlus::KaonPlus()->GetPDGMass();
MsRho= 775.5*MeV;
MsOm = 782.62*MeV;
MsF0 = 980.0*MeV;
MsA0 = 983.4*MeV;
MsPhi= 1019.413*MeV;
MsA0 = 984.7*MeV;
MsPhi= 1019.46*MeV;
MsK892 = 891.66*MeV;
MsK0892 = 896.10*MeV;
GRho = 150.7*MeV;
GOm = 8.41*MeV;
GPhi = 4.43*MeV;
MsK0892 = 896.0*MeV;
GRho = 149.4*MeV;
GOm = 8.49*MeV;
GPhi = 4.26*MeV;
GK892 = 50.8*MeV;
GK0892 = 50.5*MeV;
GK0892 = 50.3*MeV;
PhRho = 0.0;
PhOm = 0.0;
PhPhi = 155.0*degree;
@@ -102,29 +103,29 @@ void G4eeCrossSections::Initialise()
BrRhoPiG = 4.5e-4;
BrRhoPi0G= 6.8e-4;
BrRhoEtaG= 2.4e-4;
BrRhoEe = 4.49e-5;
BrOm3Pi = 0.888;
BrOmPi0G= 0.085;
BrOmEtaG= 6.5e-4;
BrOm2Pi = 0.0221;
BrRhoEtaG= 2.95e-4;
BrRhoEe = 4.7e-5;
BrOm3Pi = 0.891;
BrOmPi0G= 0.089;
BrOmEtaG= 4.9e-4;
BrOm2Pi = 0.017;
PhOm2Pi = 90.0;
BrOmEe = 7.07e-5;
BrPhi2Kc = 0.491;
BrPhiKsKl= 0.341;
BrPhi3Pi = 0.155;
BrPhiPi0G= 1.31e-3;
BrPhiEtaG= 1.26e-2;
BrPhi2Pi = 8.e-5;
BrOmEe = 7.18e-5;
BrPhi2Kc = 0.492;
BrPhiKsKl= 0.34;
BrPhi3Pi = 0.153;
BrPhiPi0G= 1.25e-3;
BrPhiEtaG= 1.301e-2;
BrPhi2Pi = 7.3e-5;
PhPhi2Pi = -20.0*degree;
BrPhiEe = 2.99e-4;
BrPhiEe = 2.97e-4;
MsRho3 = MsRho*MsRho*MsRho;
MsOm3 = MsOm*MsOm*MsOm;
MsPhi3 = MsPhi*MsPhi*MsPhi;
MeVnb = 3.8938e+11*nanobarn;
Alpha = 1.0/137.036;
Alpha = fine_structure_const;
AOmRho = 3.0;
ARhoPRho = 0.72;
@@ -133,10 +134,10 @@ void G4eeCrossSections::Initialise()
gsig = 500.*MeV;
brsigpipi = 1.;
msrho1450 = 1465.*MeV;
msrho1700 = 1700.*MeV;
grho1450 = 310.*MeV;
grho1700 = 240.*MeV;
msrho1450 = 1459.*MeV;
msrho1700 = 1688.8*MeV;
grho1450 = 171.*MeV;
grho1700 = 161.*MeV;
arhoompi0 = 1.;
arho1450ompi0 = 1.;
arho1700ompi0 = 1.;
@@ -189,8 +190,7 @@ void G4eeCrossSections::Initialise()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSection2pi(G4double e)
{
{
complex<G4double> xr(cos(PhRho),sin(PhRho));
complex<G4double> xo(cos(PhOm2Pi),sin(PhOm2Pi));
complex<G4double> xf(cos(PhPhi2Pi),sin(PhPhi2Pi));
@@ -212,6 +212,97 @@ G4double G4eeCrossSections::CrossSection2pi(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSection3pi(G4double e)
{
complex<G4double> xf(cos(PhPhi2Pi),sin(PhPhi));
G4double s = e*e;
complex<G4double> dom = DpOm(e);
complex<G4double> dphi = DpPhi(e);
complex<G4double> amp =
sqrt(Width3p(s,MsOm,GOm,BrOm3Pi)*MsOm3*BrOmEe*GOm)/dom
+ sqrt(Width3p(s,MsPhi,GPhi,BrPhi3Pi)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSectionPi0G(G4double e)
{
complex<G4double> xf(cos(PhPhi),sin(PhPhi));
G4double s = e*e;
complex<G4double> drho = DpRho(e);
complex<G4double> dom = DpOm(e);
complex<G4double> dphi = DpPhi(e);
complex<G4double> amp =
sqrt(WidthPg(s,MsRho,GRho,BrRhoPi0G,MsPi0)*MsRho3*BrRhoEe*GRho)/drho
+ sqrt(WidthPg(s,MsOm,GOm,BrOmPi0G,MsPi0)*MsOm3*BrOmEe*GOm)/dom
+ sqrt(WidthPg(s,MsPhi,GPhi,BrPhiPi0G,MsPi0)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSectionEtaG(G4double e)
{
complex<G4double> xf(cos(PhPhi),sin(PhPhi));
G4double s = e*e;
complex<G4double> drho = DpRho(e);
complex<G4double> dom = DpOm(e);
complex<G4double> dphi = DpPhi(e);
complex<G4double> amp =
sqrt(WidthPg(s,MsRho,GRho,BrRhoEtaG,MsEta)*MsRho3*BrRhoEe*GRho)/drho
+ sqrt(WidthPg(s,MsOm,GOm,BrOmEtaG,MsEta)*MsOm3*BrOmEe*GOm)/dom
+ sqrt(WidthPg(s,MsPhi,GPhi,BrPhiEtaG,MsEta)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSection2Kcharged(G4double e)
{
G4double s = e*e;
complex<G4double> dphi = DpPhi(e);
complex<G4double> amp =
sqrt(Width2p(s,MsPhi,GPhi,BrPhi2Kc,MsKc)*MsPhi3*BrPhiEe*GPhi)/dphi;
G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::CrossSection2Kneutral(G4double e)
{
G4double s = e*e;
complex<G4double> dphi = DpPhi(e);
complex<G4double> amp =
sqrt(Width2p(s,MsPhi,GPhi,BrPhiKsKl,MsKs)*MsPhi3*BrPhiEe*GPhi)/dphi;
G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeCrossSections::Width2p(G4double s, G4double mres,
G4double g, G4double br, G4double m)
{
@@ -237,7 +328,10 @@ G4double G4eeCrossSections::Width3p(G4double s, G4double mres,
G4double G4eeCrossSections::PhaseSpace3p(G4double e)
{
// E.A.Kuraev, Z.K.Silagadze.
// Once more about the omega->3 pi contact term.
// Yadernaya Phisica, 1995, V58, N9, p.1678-1694.
// G4bool b;
// G4double x = ph3p->GetValue(e, b);
G4double x = 1.0;
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * 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: G4eeTo3PiModel.cc,v 1.1 2008/07/10 18:07:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4eeTo3PiModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 25.10.2003
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4eeTo3PiModel.hh"
#include "Randomize.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4DynamicParticle.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4eeCrossSections.hh"
#include "G4RandomDirection.hh"
#include <complex>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4eeTo3PiModel::G4eeTo3PiModel(G4eeCrossSections* cr):
cross(cr)
{
massPi = G4PionPlus::PionPlus()->GetPDGMass();
massPi0 = G4PionZero::PionZero()->GetPDGMass();
massOm = 782.62*MeV;
massPhi = 1019.46*MeV;
gcash = 0.0;
gmax = 1.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4eeTo3PiModel::~G4eeTo3PiModel()
{
G4cout << "### G4eeTo3PiModel::~G4eeTo3PiModel: gmax= "
<< gmax << " gcash= " << gcash << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4eeTo3PiModel::PhysicsVector(G4double emin,
G4double emax) const
{
G4double tmin = std::max(emin, ThresholdEnergy());
G4double tmax = std::max(tmin, emax);
G4int nbins = (G4int)((tmax - tmin)/(1.*MeV));
G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
v->SetSpline(true);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeTo3PiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4double e, const G4ThreeVector& direction)
{
if(e < ThresholdEnergy()) return;
G4double x0 = massPi0/e;
G4double x1 = massPi/e;
G4LorentzVector w0, w1, w2;
G4ThreeVector dir0, dir1, mom, mom1, mom2;
G4double e0, p0, e2, p, g, m01, m02, m12;
// max pi0 energy
G4double edel = 0.5*e*(1.0 + x0*x0 - 4.0*x1*x1) - massPi0;
do {
// pi0 sample
e0 = edel*G4UniformRand() + massPi0;
p0 = sqrt(e0 - massPi0*massPi0);
dir0 = G4RandomDirection();
w0 = G4LorentzVector(p0*dir0.x(),p0*dir0.y(),p0*dir0.z(),e0);
// pi+pi- pair
w1 = G4LorentzVector(-p0*dir0.x(),-p0*dir0.y(),-p0*dir0.z(),e-e0);
G4ThreeVector bst = w1.boostVector();
e2 = 0.25*w1.m2();
// pi+
p = sqrt(e2 - massPi*massPi);
dir1 = G4RandomDirection();
w2 = G4LorentzVector(p*dir1.x(),p*dir1.y(),p*dir1.z(),sqrt(e2));
w2.boost(bst);
mom2 = w2.vect();
// pi-
w1 -= w2;
mom1 = w2.vect();
m01 = w0*w1;
m02 = w0*w2;
m12 = w1*w2;
mom = mom1*mom2;
g = mom.mag2()*norm( 1.0/cross->DpRho(m01) + 1.0/cross->DpRho(m02)
+ 1.0/cross->DpRho(m12) );
if(g > gmax) {
G4cout << "G4eeTo3PiModel::SampleSecondaries WARNING matrix element g= "
<< g << " > " << gmax << " (majoranta)" << G4endl;
}
if(g > gcash) gcash = g;
} while( gmax*G4UniformRand() > g );
w0.rotateUz(direction);
w1.rotateUz(direction);
w2.rotateUz(direction);
// create G4DynamicParticle objects
G4DynamicParticle* dp0 =
new G4DynamicParticle(G4PionZero::PionZero(), w0);
G4DynamicParticle* dp1 =
new G4DynamicParticle(G4PionPlus::PionPlus(), w1);
G4DynamicParticle* dp2 =
new G4DynamicParticle(G4PionMinus::PionMinus(), w2);
newp->push_back(dp0);
newp->push_back(dp1);
newp->push_back(dp2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToHadrons.cc,v 1.7 2006/06/29 19:32:44 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToHadrons.cc,v 1.8 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -63,7 +63,8 @@ G4eeToHadrons::G4eeToHadrons(const G4String& name)
csFactor(1.0),
isInitialised(false)
{
SetVerboseLevel(1);
SetVerboseLevel(1);
SetProcessSubType(fAnnihilationToHadrons);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToHadronsModel.cc,v 1.8 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToHadronsModel.cc,v 1.9 2008/07/10 18:06:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -64,18 +64,17 @@
using namespace std;
G4eeToHadronsModel::G4eeToHadronsModel(const G4Vee2hadrons* m,
G4int ver,
G4eeToHadronsModel::G4eeToHadronsModel(G4Vee2hadrons* m, G4int ver,
const G4String& nam)
: G4VEmModel(nam),
model(m),
crossPerElectron(0),
crossBornPerElectron(0),
isInitialised(false),
nbins(100),
verbose(ver)
model(m),
crossPerElectron(0),
crossBornPerElectron(0),
isInitialised(false),
nbins(100),
verbose(ver)
{
theGamma = G4Gamma::Gamma();
theGamma = G4Gamma::Gamma();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -95,16 +94,39 @@ void G4eeToHadronsModel::Initialise(const G4ParticleDefinition*,
if(isInitialised) return;
isInitialised = true;
// Lab system
highKinEnergy = HighEnergyLimit();
lowKinEnergy = LowEnergyLimit();
emin = model->ThresholdEnergy();
emax = 2.0*electron_mass_c2*sqrt(1.0 + 0.5*highKinEnergy/electron_mass_c2);
if(emin > emax) emin = emax;
// CM system
emin = model->LowEnergy();
emax = model->HighEnergy();
lowKinEnergy = 0.5*emin*emin/electron_mass_c2 - 2.0*electron_mass_c2;
G4double emin0 =
2.0*electron_mass_c2*sqrt(1.0 + 0.5*lowKinEnergy/electron_mass_c2);
G4double emax0 =
2.0*electron_mass_c2*sqrt(1.0 + 0.5*highKinEnergy/electron_mass_c2);
epeak = min(model->PeakEnergy(), emax);
// recompute low energy
if(emin0 > emax) {
emin0 = emax;
model->SetLowEnergy(emin0);
}
if(emin > emin0) {
emin0 = emin;
lowKinEnergy = 0.5*emin*emin/electron_mass_c2 - 2.0*electron_mass_c2;
SetLowEnergyLimit(lowKinEnergy);
}
// recompute high energy
if(emax < emax0) {
emax0 = emax;
highKinEnergy = 0.5*emax*emax/electron_mass_c2 - 2.0*electron_mass_c2;
SetHighEnergyLimit(highKinEnergy);
}
// peak energy
epeak = std::min(model->PeakEnergy(), emax);
peakKinEnergy = 0.5*epeak*epeak/electron_mass_c2 - 2.0*electron_mass_c2;
if(verbose>0) {
@@ -151,6 +173,29 @@ void G4eeToHadronsModel::Initialise(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeToHadronsModel::CrossSectionPerVolume(
const G4Material* mat,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double, G4double)
{
return mat->GetElectronDensity()*
ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeToHadronsModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double, G4double)
{
return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeToHadronsModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition*,
G4double kineticEnergy,
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToHadronsMultiModel.cc,v 1.4 2007/05/23 08:50:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToHadronsMultiModel.cc,v 1.6 2008/07/11 17:49:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -33,7 +33,7 @@
//
// File name: G4eeToHadronsMultiModel
//
// Author: Vladimir Ivanchenko on base of Michel Maire code
// Author: Vladimir Ivanchenko
//
// Creation date: 02.08.2004
//
@@ -50,7 +50,12 @@
#include "G4eeToHadronsMultiModel.hh"
#include "G4eeToTwoPiModel.hh"
#include "G4eeTo3PiModel.hh"
#include "G4eeToPGammaModel.hh"
#include "G4ee2KNeutralModel.hh"
#include "G4ee2KChargedModel.hh"
#include "G4eeCrossSections.hh"
#include "G4Vee2hadrons.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -79,33 +84,116 @@ G4eeToHadronsMultiModel::~G4eeToHadronsMultiModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToHadronsMultiModel::Initialise(const G4ParticleDefinition* p, const G4DataVector& v)
void G4eeToHadronsMultiModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{
if(!isInitialised) {
isInitialised = true;
thKineticEnergy = DBL_MAX;
maxKineticEnergy = HighEnergyLimit();
thKineticEnergy = DBL_MAX;
maxKineticEnergy = 1.2*GeV;
cross = new G4eeCrossSections();
G4eeToHadronsModel* model =
new G4eeToHadronsModel(new G4eeToTwoPiModel(cross), verbose);
models.push_back(model);
model->SetHighEnergyLimit(maxKineticEnergy);
model->Initialise(p, v);
G4double emin = model->LowEnergyLimit();
if(emin < thKineticEnergy) thKineticEnergy = emin;
ekinMin.push_back(emin);
ekinMax.push_back(model->HighEnergyLimit());
ekinPeak.push_back(model->PeakEnergy());
cumSum.push_back(0.0);
nModels = 1;
if(pParticleChange)
G4eeToTwoPiModel* m2pi = new G4eeToTwoPiModel(cross);
m2pi->SetHighEnergy(maxKineticEnergy);
AddEEModel(m2pi);
G4eeTo3PiModel* m3pi1 = new G4eeTo3PiModel(cross);
m3pi1->SetHighEnergy(0.95*GeV);
AddEEModel(m3pi1);
G4eeTo3PiModel* m3pi2 = new G4eeTo3PiModel(cross);
m3pi2->SetLowEnergy(0.95*GeV);
m3pi2->SetHighEnergy(maxKineticEnergy);
AddEEModel(m3pi2);
G4ee2KChargedModel* m2kc = new G4ee2KChargedModel(cross);
m2kc->SetHighEnergy(maxKineticEnergy);
AddEEModel(m2kc);
G4ee2KNeutralModel* m2kn = new G4ee2KNeutralModel(cross);
m2kn->SetHighEnergy(maxKineticEnergy);
AddEEModel(m2kn);
G4eeToPGammaModel* mpg1 = new G4eeToPGammaModel(cross,"pi0");
mpg1->SetLowEnergy(0.7*GeV);
mpg1->SetHighEnergy(maxKineticEnergy);
AddEEModel(mpg1);
G4eeToPGammaModel* mpg2 = new G4eeToPGammaModel(cross,"eta");
mpg2->SetLowEnergy(0.7*GeV);
mpg2->SetHighEnergy(maxKineticEnergy);
AddEEModel(mpg2);
nModels = models.size();
if(pParticleChange) {
fParticleChange =
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
else
} else {
fParticleChange = new G4ParticleChangeForGamma();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToHadronsMultiModel::AddEEModel(G4Vee2hadrons* mod)
{
G4eeToHadronsModel* model = new G4eeToHadronsModel(mod, verbose);
model->SetLowEnergyLimit(LowEnergyLimit());
model->SetHighEnergyLimit(HighEnergyLimit());
models.push_back(model);
G4double elow = mod->ThresholdEnergy();
ekinMin.push_back(elow);
if(thKineticEnergy > elow) thKineticEnergy = elow;
ekinMax.push_back(mod->HighEnergy());
ekinPeak.push_back(mod->PeakEnergy());
cumSum.push_back(0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeToHadronsMultiModel::CrossSectionPerVolume(
const G4Material* mat,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double, G4double)
{
return mat->GetElectronDensity()*
ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double, G4double)
{
return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToHadronsMultiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double, G4double)
{
G4double kinEnergy = dp->GetKineticEnergy();
if (kinEnergy > thKineticEnergy) {
G4double q = cumSum[nModels-1]*G4UniformRand();
for(G4int i=0; i<nModels; i++) {
if(q <= cumSum[i]) {
(models[i])->SampleSecondaries(newp, couple,dp);
if(newp->size() > 0) fParticleChange->ProposeTrackStatus(fStopAndKill);
break;
}
}
}
}
@@ -114,8 +202,12 @@ void G4eeToHadronsMultiModel::Initialise(const G4ParticleDefinition* p, const G4
void G4eeToHadronsMultiModel::PrintInfo()
{
if(verbose > 0) {
G4cout << " e+ annihilation into hadrons active above "
<< thKineticEnergy/GeV << " GeV"
G4double e1 = 0.5*thKineticEnergy*thKineticEnergy/electron_mass_c2
- 2.0*electron_mass_c2;
G4double e2 = 0.5*maxKineticEnergy*maxKineticEnergy/electron_mass_c2
- 2.0*electron_mass_c2;
G4cout << " e+ annihilation into hadrons active from "
<< e1/GeV << " GeV to " << e2/GeV << " GeV"
<< G4endl;
}
}
@@ -127,8 +219,8 @@ void G4eeToHadronsMultiModel::SetCrossSecFactor(G4double fac)
if(fac > 1.0) {
csFactor = fac;
if(verbose > 0)
G4cout << "### G4eeToHadronsMultiModel: The cross section for G4eeToHadronsMultiModel is "
<< "increased by the Factor= " << csFactor << G4endl;
G4cout << "### G4eeToHadronsMultiModel: The cross section for G4eeToHadronsMultiModel "
<< " is increased by the Factor= " << csFactor << G4endl;
}
}
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * 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: G4eeToPGammaModel.cc,v 1.1 2008/07/10 18:07:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4eeToPGammaModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 25.10.2003
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4eeToPGammaModel.hh"
#include "Randomize.hh"
#include "G4PionZero.hh"
#include "G4Eta.hh"
#include "G4Gamma.hh"
#include "G4DynamicParticle.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4eeCrossSections.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4eeToPGammaModel::G4eeToPGammaModel(G4eeCrossSections* cr, const G4String& npart):
cross(cr)
{
pi0 = G4PionZero::PionZero();
if(npart == "pi0") {
massR = 782.62*MeV;
particle = pi0;
} else {
massR = 1019.46*MeV;
particle = G4Eta::Eta();
}
massP = particle->GetPDGMass();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4eeToPGammaModel::~G4eeToPGammaModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4eeToPGammaModel::PhysicsVector(G4double emin,
G4double emax) const
{
G4double tmin = std::max(emin, ThresholdEnergy());
G4double tmax = std::max(tmin, emax);
G4int nbins = (G4int)((tmax - tmin)/(5.*MeV));
G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
v->SetSpline(true);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToPGammaModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4double e, const G4ThreeVector& direction)
{
G4double egam = 0.5*e*(1.0 - massP*massP/(massR*massR));
G4double tkin = e - egam - massP;
if(tkin < 0.0) tkin = 0.0;
G4double cost;
do {
cost = 2.0*G4UniformRand() - 1.0;
} while( 2.0*G4UniformRand() > 1.0 + cost*cost );
G4double sint = sqrt(1.0 - cost*cost);
G4double phi = twopi * G4UniformRand();
G4ThreeVector dir(sint*cos(phi),sint*sin(phi), cost);
dir.rotateUz(direction);
// create G4DynamicParticle objects
G4DynamicParticle* p1 =
new G4DynamicParticle(particle,dir,tkin);
G4DynamicParticle* p2 =
new G4DynamicParticle(G4Gamma::Gamma(),-dir,egam);
newp->push_back(p1);
newp->push_back(p2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToTwoPiModel.cc,v 1.5 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4eeToTwoPiModel.cc,v 1.6 2008/07/10 18:06:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -63,7 +63,8 @@ using namespace std;
G4eeToTwoPiModel::G4eeToTwoPiModel(G4eeCrossSections* cr):
cross(cr)
{
Initialise();
massPi = G4PionPlus::PionPlus()->GetPDGMass();
massRho = 775.5*MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,30 +74,21 @@ G4eeToTwoPiModel::~G4eeToTwoPiModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToTwoPiModel::Initialise()
{
massPi = G4PionPlus::PionPlus()->GetPDGMass();
massRho = 770.*MeV;
highEnergy = 1.*GeV;
cross = new G4eeCrossSections();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4eeToTwoPiModel::PhysicsVector(G4double emin,
G4double emax) const
{
G4double tmin = max(emin, 2.0*massPi);
G4double tmax = max(tmin, emax);
G4double tmin = std::max(emin, 2.0*massPi);
G4double tmax = std::max(tmin, emax);
G4int nbins = (G4int)((tmax - tmin)/(5.*MeV));
G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
v->SetSpline(true);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eeToTwoPiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4double e, const G4ThreeVector& direction) const
G4double e, const G4ThreeVector& direction)
{
G4double tkin = 0.5*e - massPi;
@@ -112,7 +104,7 @@ void G4eeToTwoPiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
G4ThreeVector dir(sint*cos(phi),sint*sin(phi), cost);
dir.rotateUz(direction);
// create G4DynamicParticle object for delta ray
// create G4DynamicParticle objects
G4DynamicParticle* pip =
new G4DynamicParticle(G4PionPlus::PionPlus(),dir,tkin);
G4DynamicParticle* pin =
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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: G4hBremsstrahlung.cc,v 1.3 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4hBremsstrahlung
//
// Author: Vladimir Ivanchenko on base of model for muons
//
// Creation date: 01.03.2008
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4hBremsstrahlung.hh"
#include "G4Gamma.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4UniversalFluctuation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hBremsstrahlung::G4hBremsstrahlung(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(0),
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{
SetProcessSubType(fBremsstrahlung);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4hBremsstrahlung::~G4hBremsstrahlung()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hBremsstrahlung::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
{
if(!isInitialised) {
isInitialised = true;
theParticle = part;
SetSecondaryParticle(G4Gamma::Gamma());
SetIonisation(false);
G4hBremsstrahlungModel* em = new G4hBremsstrahlungModel();
em->SetLowestKineticEnergy(lowestKinEnergy);
G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
AddEmModel(1, em, fm);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hBremsstrahlung::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * 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: G4hBremsstrahlungModel.cc,v 1.3 2008/07/22 16:15:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4hBremsstrahlungModel
//
// Author: Vladimir Ivanchenko on base of G4MuBremsstrahlungModel
//
// Creation date: 28.02.2008
//
// Modifications:
//
//
// Class Description:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4hBremsstrahlungModel.hh"
using namespace std;
G4hBremsstrahlungModel::G4hBremsstrahlungModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4MuBremsstrahlungModel(p, nam)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4hBremsstrahlungModel::~G4hBremsstrahlungModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4hBremsstrahlungModel::ComputeDMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double gammaEnergy)
// differential cross section
{
G4double dxsection = 0.;
if( gammaEnergy > tkin) return dxsection ;
// G4cout << "G4hBremsstrahlungModel m= " << mass
// << " " << particle->GetParticleName() << G4endl;
G4double E = tkin + mass ;
G4double v = gammaEnergy/E ;
G4double delta = 0.5*mass*mass*v/(E-gammaEnergy) ;
G4double rab0=delta*sqrte ;
G4int iz = G4int(Z);
if(iz < 1) iz = 1;
G4double z13 = 1.0/nist->GetZ13(iz);
G4double dn = mass*nist->GetA27(iz)/(70.*MeV);
G4double b = btf;
if(1 == iz) b = bh;
// nucleus contribution logarithm
G4double rab1=b*z13;
G4double fn=log(rab1/(dn*(electron_mass_c2+rab0*rab1))*
(mass+delta*(dn*sqrte-2.))) ;
if(fn <0.) fn = 0. ;
G4double x = 1.0 - v;
if(particle->GetPDGSpin() != 0) x += 0.75*v*v;
dxsection = coeff*x*Z*Z*fn/gammaEnergy;
return dxsection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -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: G4hPairProduction.cc,v 1.3 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4hPairProduction
//
// Author: Vladimir Ivanchenko on base of model for muons
//
// Creation date: 01.03.2008
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4hPairProduction.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4hPairProductionModel.hh"
#include "G4UniversalFluctuation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hPairProduction::G4hPairProduction(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(0),
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{
SetProcessSubType(fPairProdByCharged);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4hPairProduction::~G4hPairProduction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hPairProduction::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
{
if (!isInitialised) {
isInitialised = true;
theParticle = part;
SetSecondaryParticle(G4Positron::Positron());
SetIonisation(false);
G4hPairProductionModel* em = new G4hPairProductionModel();
em->SetLowestKineticEnergy(lowestKinEnergy);
G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
AddEmModel(1, em, fm);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hPairProduction::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,175 @@
//
// ********************************************************************
// * 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: G4hPairProductionModel.cc,v 1.1 2008/03/06 11:47:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4hPairProductionModel
//
// Author: Vladimir Ivanchenko on base of G4MuPairProductionModel
//
// Creation date: 28.02.2008
//
// Modifications:
//
//
// Class Description:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4hPairProductionModel.hh"
using namespace std;
G4hPairProductionModel::G4hPairProductionModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4MuPairProductionModel(p, nam)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4hPairProductionModel::~G4hPairProductionModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double pairEnergy)
// differential cross section
{
G4double bbbtf= 183. ;
G4double bbbh = 202.4 ;
G4double g1tf = 1.95e-5 ;
G4double g2tf = 5.3e-5 ;
G4double g1h = 4.4e-5 ;
G4double g2h = 4.8e-5 ;
G4double totalEnergy = tkin + particleMass;
G4double residEnergy = totalEnergy - pairEnergy;
G4double massratio = particleMass/electron_mass_c2 ;
G4double massratio2 = massratio*massratio ;
G4double cross = 0.;
SetCurrentElement(Z);
G4double c3 = 0.75*sqrte*particleMass;
if (residEnergy <= c3*z13) return cross;
G4double c7 = 4.*electron_mass_c2;
G4double c8 = 6.*particleMass*particleMass;
G4double alf = c7/pairEnergy;
G4double a3 = 1. - alf;
if (a3 <= 0.) return cross;
// zeta calculation
G4double bbb,g1,g2;
if( Z < 1.5 ) { bbb = bbbh ; g1 = g1h ; g2 = g2h ; }
else { bbb = bbbtf; g1 = g1tf; g2 = g2tf; }
G4double zeta = 0;
G4double zeta1 = 0.073*log(totalEnergy/(particleMass+g1*z23*totalEnergy))-0.26;
if ( zeta1 > 0.)
{
G4double zeta2 = 0.058*log(totalEnergy/(particleMass+g2*z13*totalEnergy))-0.14;
zeta = zeta1/zeta2 ;
}
G4double z2 = Z*(Z+zeta);
G4double screen0 = 2.*electron_mass_c2*sqrte*bbb/(z13*pairEnergy);
G4double a0 = totalEnergy*residEnergy;
G4double a1 = pairEnergy*pairEnergy/a0;
G4double bet = 0.5*a1;
G4double xi0 = 0.25*massratio2*a1;
G4double del = c8/a0;
G4double rta3 = sqrt(a3);
G4double tmnexp = alf/(1. + rta3) + del*rta3;
if(tmnexp >= 1.0) return cross;
G4double tmn = log(tmnexp);
G4double sum = 0.;
// Gaussian integration in ln(1-ro) ( with 8 points)
for (G4int i=0; i<8; i++)
{
G4double a4 = exp(tmn*xgi[i]); // a4 = (1.-asymmetry)
G4double a5 = a4*(2.-a4) ;
G4double a6 = 1.-a5 ;
G4double a7 = 1.+a6 ;
G4double a9 = 3.+a6 ;
G4double xi = xi0*a5 ;
G4double xii = 1./xi ;
G4double xi1 = 1.+xi ;
G4double screen = screen0*xi1/a5 ;
G4double yeu = 5.-a6+4.*bet*a7 ;
G4double yed = 2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6) ;
G4double ye1 = 1.+yeu/yed ;
G4double ale=log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1)) ;
G4double cre = 0.5*log(1.+2.25*z23*xi1*ye1/massratio2) ;
G4double be;
if (xi <= 1.e3) be = ((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
else be = (3.-a6+a1*a7)/(2.*xi);
G4double fe = (ale-cre)*be;
if ( fe < 0.) fe = 0. ;
G4double ymu = 4.+a6 +3.*bet*a7 ;
G4double ymd = a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6 ;
G4double ym1 = 1.+ymu/ymd ;
G4double alm_crm = log(bbb*massratio/(1.5*z23*(1.+screen*ym1)));
G4double a10,bm;
if ( xi >= 1.e-3)
{
a10 = (1.+a1)*a5 ;
bm = (a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
} else {
bm = (5.-a6+bet*a9)*(xi/2.);
}
G4double fm = alm_crm*bm;
if ( fm < 0.) fm = 0. ;
sum += wgi[i]*a4*(fe+fm/massratio2);
}
cross = -tmn*sum*factorForCross*z2*residEnergy/(totalEnergy*pairEnergy);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hhIonisation.cc,v 1.6 2007/05/22 17:37:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4hhIonisation.cc,v 1.8 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -63,13 +63,9 @@ G4hhIonisation::G4hhIonisation(const G4String& name)
theBaseParticle(0),
isInitialised(false)
{
minKinEnergy = 0.1*keV;
maxKinEnergy = 100.*TeV;
SetDEDXBinning(120);
SetMinKinEnergy(minKinEnergy);
SetMaxKinEnergy(maxKinEnergy);
SetStepFunction(0.1, 0.1*mm);
SetVerboseLevel(1);
SetProcessSubType(fIonisation);
mass = 0.0;
ratio = 0.0;
}
@@ -100,6 +96,8 @@ void G4hhIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
G4int nm = 1;
minKinEnergy = MinKinEnergy();
if(eth > minKinEnergy) {
G4VEmModel* em = new G4BraggNoDeltaModel();
em->SetLowEnergyLimit(minKinEnergy);
@@ -108,16 +106,16 @@ void G4hhIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
nm++;
}
if(eth < maxKinEnergy) {
if(eth < MaxKinEnergy()) {
G4VEmModel* em1 = new G4BetheBlochNoDeltaModel();
em1->SetLowEnergyLimit(std::max(eth,minKinEnergy));
em1->SetHighEnergyLimit(maxKinEnergy);
em1->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(nm, em1, flucModel);
}
if(verboseLevel>0)
if(verboseLevel>1) {
G4cout << "G4hhIonisation is initialised: Nmodels= " << nm << G4endl;
}
isInitialised = true;
}
@@ -126,11 +124,7 @@ void G4hhIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
void G4hhIonisation::PrintInfo()
{
G4cout << " Delta-ray will not be produced; "
<< "Bether-Bloch model for E > " << std::max(eth,minKinEnergy)
<< G4endl;
if(eth > minKinEnergy) G4cout
<< " ICRU49 parametrisation scaled from protons below.";
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4mplIonisation.cc,v 1.5 2007/05/31 11:13:31 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4mplIonisation.cc,v 1.7 2008/10/16 14:29:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -63,6 +63,8 @@ G4mplIonisation::G4mplIonisation(G4double mCharge, const G4String& name)
if(magneticCharge == 0.0) magneticCharge = eplus*0.5/fine_structure_const;
SetVerboseLevel(0);
SetProcessSubType(fIonisation);
SetStepFunction(0.2, 1*mm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -81,12 +83,10 @@ void G4mplIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition*,
SetSecondaryParticle(G4Electron::Electron());
G4mplIonisationModel* ion = new G4mplIonisationModel(magneticCharge,"PAI");
ion->SetLowEnergyLimit(0.1*keV);
ion->SetHighEnergyLimit(100.*TeV);
ion->SetLowEnergyLimit(MinKinEnergy());
ion->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(0,ion,ion);
SetStepFunction(0.2, 1*mm);
isInitialised = true;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4mplIonisationModel.cc,v 1.5 2007/11/13 18:36:29 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.5 2003/09/20 14:41:31 vnivanch Exp $
# $Id: GNUmakefile,v 1.7 2008/11/20 12:06:28 alechner Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
@@ -13,12 +13,14 @@ include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
@@ -1,4 +1,4 @@
$Id: History,v 1.284 2007/11/26 17:27:09 pia Exp $
$Id: History,v 1.329 2008/12/12 08:50:59 sincerti Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,255 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
12.12.2008 S. Incerti, tag emlowen-V09-01-45
Upgrade to G4LogLogInterpolation_revision1c.cc
009.12.2008 S. Incerti, tag emlowen-V09-01-44
Added protection to G4FinalStateElasticChampion.cc for angular treatment of XS at 180*deg
09.12.2008 S. Incerti, tag emlowen-V09-01-43
Contains G4PenelopeBremsstrahlungContinuous.hh/.cc from Luciano
Contains G4LogLogInterpolation_revision1b.cc
09.12.2008 S. Incerti, tag emlowen-V09-01-42
Upgrade to G4LogLogInterpolation_revision1b.cc
09.12.2008 S. Incerti, tag emlowen-V09-01-41
Return to original G4LogLogInterpolation.cc/.hh class
from tag emlowen-V09-01-20
08.12.2008 S. Incerti, tag emlowen-V09-01-40
Added protection in G4LogLogInterpolation.cc class
against null energy and cross section values
06.12.2008 S. Incerti, tag emlowen-V09-01-39
Added vector initialization and EOF protection in G4FinalStateElasticChampion.cc
Added EOF protection in G4FinalStateIonisationBorn.cc
06.12.2008 S. Incerti, tag emlowen-V09-01-38
Updated G4LogLogInterpolation class (hh and cc) provided by
Nicolas Karakatsanis (updated revision 1)
05.12.2008 S. Incerti, tag emlowen-V09-01-37
Updated G4LogLogInterpolation class (hh and cc) provided by
Nicolas Karakatsanis (revision 1)
05.12.2008 S. Incerti, tag emlowen-V09-01-36
Updated low energy limits of Geant4-DNA e- models (Brenner-Zaider and Champion's
elastic scattering and Emfietzoglou's excitation)
05.12.2008 S. Incerti, tag emlowen-V09-01-35
Added protection in G4FinalStateIonisationBorn.cc causing run-time error (valgrind with test20)
04.12.2008 L. Pandola, tag emlowen-V09-01-34
Correction for G4PenelopeComptonModel: now the cross section table
calculated by the model corresponds to the original FORTRAN-Penelope.
The difference was only for compounds materials and below 1 keV, so
irrelevant for virtually all applications.
First inclusion of G4PenelopeIonisationModel.
24.11.2008 G. Cosmo, tag emlowen-V09-01-33
Fixed compilation errors on gcc-4.3.2:
o added required names for struct types (and using G4 prefix);
o correctly initialise cached iterators (cannot be an integer!).
21.11.2008 A. Lechner, tag emlowen-V09-01-32
added and tagged new stopping power model for ions, which by default
uses ICRU 73 data tables. Following files are concerned:
G4IonParametrisedLossModel.hh
G4IonParametrisedLossModel.icc
G4IonParametrisedLossModel.cc
G4IonParametrisedLossTable.hh
G4IonParametrisedLossTable.icc
06.11.2008 S. Incerti, tag emlowen-V09-01-31
corrected bug in computation of diff cross section maximum in
G4FinalStateElasticBrennerZaider.cc
30.10.2008 S. Incerti, tag emlowen-V09-01-30
added & tagged new photon models compatible with standard EM design :
-- Penelope models are provided by L. Pandola :
G4PenelopeComptonModel.hh and .cc
G4PenelopeGammaConversionModel.hh and .cc
G4PenelopePhotoElectricModel.hh and .cc
G4PenelopeRayleighModel.hh and .cc
-- Livermore models are provided by S. Incerti :
G4LivermoreComptonModel.hh and .cc
G4LivermoreGammaConversionModel.hh and .cc
G4LivermorePhotoElectricModel.hh and .cc
G4LivermorePolarizedComptonModel.hh and .cc
G4LivermorePolarizedRayleighModel.hh and .cc
G4LivermoreRayleighModel.hh and .cc
29.10.2008 S. Incerti, tag emlowen-V09-01-29
- improved generation of scattering angle in G4FinalStateElasticChampion.cc
30.09.2008 S. Incerti, tag emlowen-V09-01-28
- removed G4cout in G4LowEnergyCompton.cc (bug report #1026)
20.08.2008 S. Incerti, tag emlowen-V09-01-27
- added KillParticle in G4FinalStateElasticChampion.cc below low energy limit
- modified condition on low energy limit in G4CrossSectionElasticChampion.cc and G4FinalStateElasticChampion.cc
20.08.2008 S. Incerti, tag emlowen-V09-01-26
- removed AddEnergyDeposit below low energy limit in G4FinalStateElasticBrennerZaider.cc (bug, thanks to Marion Bug)
- removed AddEnergyDeposit below low energy limit in G4FinalStateExcitationEmfietzoglou.cc (idem)
- removed AddEnergyDeposit below low energy limit in G4FinalStateIonisationRudd.cc (idem)
- decreased low energy limit for e- to 12.61 eV in G4CrossSectionIonisationBorn.cc (from sigma_ionisation_e_born.dat table in $G4LEDATA/dna) instead of 25 eV
- decreased low energy limit for e- to 12.61 eV in G4FinalStateIonisationBorn.cc (from sigma_ionisation_e_born.dat table in $G4LEDATA/dna) instead of 25 eV
16.07.2008 S. Incerti, tag emlowen-V09-01-25
added preliminary process for positronium production
from C. Champion's model
G4CrossSectionPsCreationChampion.hh and .cc
G4CrossSectionPsCreationChampionPartial.hh and .cc
G4FinalStatePsCreationChampion.hh and .cc
and updated G4DNAGenericIonsManager.cc
*** Will work only from version 6.2 of G4EMLOW data
15.07.2008 S. Incerti, tag emlowen-V09-01-24
added new elastic scattering process for electrons
(Geant4 DNA) from C. Champion's model
G4CrossSectionElasticChampion.hh and .cc
G4FinalStateElasticChampion.hh and .cc
*** Will work only from version 6.2 of G4EMLOW data
14.07.2008 S. Incerti, tag emlowen-V09-01-23
cleaned and updated energy limits of the following
25 files (Geant4 DNA)
-G4CrossSectionChargeDecrease.hh and .cc
-G4CrossSectionChargeDecreasePartial.hh and .cc
-G4CrossSectionChargeIncrease.hh and .cc
-G4CrossSectionChargeIncreasePartial.hh and .cc
-G4CrossSectionElasticScreenedRutherfordHE.hh and .cc
-G4CrossSectionElasticScreenedRutherfordLE.hh and .cc
-G4CrossSectionExcitationBorn.hh and .cc
-G4CrossSectionExcitationBornPartial.hh and .cc
-G4CrossSectionExcitationEmfietzoglou.hh and .cc
-G4CrossSectionExcitationEmfietzoglouPartial.hh and .cc
-G4CrossSectionExcitationMillerGreen.hh and .cc
-G4CrossSectionExcitationMillerGreenPartial.hh and .cc
-G4CrossSectionIonisationBorn.hh and .cc
-G4CrossSectionIonisationBornPartial.hh and .cc
-G4CrossSectionIonisationRudd.hh and .cc
-G4CrossSectionIonisationRuddPartial.hh and .cc
-G4FinalStateChargeDecrease.hh and .cc
-G4FinalStateChargeIncrease.hh and .cc
-G4FinalStateElasticBrennerZaider.hh and .cc
-G4FinalStateElasticScreenedRutherford.hh and .cc
-G4FinalStateExcitationBorn.hh and .cc
-G4FinalStateExcitationEmfietzoglou.hh and .cc
-G4FinalStateExcitationMillerGreen.hh and .cc
-G4FinalStateIonisationBorn.hh and .cc
-G4FinalStateIonisationRudd.hh and .cc
30.06.2008 S. Incerti, tag emlowen-V09-01-22
corrected wrong upper energy limit for :
- hydrogen in G4CrossSectionIonisationRudd
- proton in G4ChargeDecrease
27.06.2008 S. Incerti, tag emlowen-V09-01-21
- added two new classes for electron elastic scattering
G4CrossSectionElasticScreenedRutherfordLE.cc and .hh below 200 eV
G4CrossSectionElasticScreenedRutherfordHE.cc and .hh above 200 eV
that should replace the G4CrossSectionElasticScreenedRutherfordHE class
- raised lower energy limit of G4CrossSectionExcitationEmfietzoglou.cc up to 10 eV
27.06.2008 S. Incerti, tag emlowen-VO9-01-20
- added protection against negative log argument in G4LogLogInterpolation.cc
- added protection against energies above 200 eV in G4FinalStateElasticBrennerZaider.cc
- removed verbose in G4CrossSectionChargeTransferExp.cc and in G4CrossSectionExcitationBorn.cc
26.06.2208 S. Incerti, tag emlowen-V09-01-19
Added protection against FPE in G4hShellCrossSectionDoubleExp.cc
20.06.2008 S. Incerti, tag emlowen-V09-01-18
Added 4 protections against FPE in G4hLowEnergyLoss.cc
11.06.2008 S. Incerti, tag emlowen-V09-01-17
- added missing & for cosTheta and phi variables in G4FinalStateIonisationRudd.hh and .cc
which were causing wrong angular distributions (bug fix)
- removed annoying PrintData in G4CrossSectionExcitationBornPartial.cc
02.06.2008 S. Incerti, tag emlowen-V09-01-16
Removed while(1) statement in G4FinalStateIonisationBorn.cc
fixing compilation warning.
Restored headers for G4PaulKCrossSection, G4OrlicLCrossSection
and G4ecpssrCrossSection which were lost.
01.06.2008 F.Lei, tag emlowen-V09-01-15
Correction to the corrupted G4Augerdata.cc, and this tag is on top
of emlowen-V09-01-12! as emlowen-V09-01-13 is internal and incomplete.
22.05.2008 F.Lei, tag emlowen-V09-01-14
Load the the complete Auger dataset on initialization
06.05.2008 H.Ben Abdelouahed, tag emlowen-V09-01-12, emlowen-V09-01-13
Semi-Empirical model implementation for L-SubShells-Cross-Section
with protons projectiles
02.05.2008 MGP, tag emlowen-V09-01-11
Added Doppler broadening in G4LowEnergyComptonPolarized
(Francesco Longo), same model as in G4LowEnergyCompton
Added PIXE cross section, L shells, for protons in
G4OrlicLCrossSection (Haifa Ben Abdelwahed)
Corrected compilation warnings as in message by
G. Cosmo on 29/4/2008
24.04.2008 MGP, tag emlowen-V09-01-10
Fix in Doppler broadening of G4LowEnergyCompton
Attempts to fix floating point exceptions in
G4FinalStateElasticBrennerZaider and G4hLowEnergyLoss
22.04.2008 H.Ben Abdelouahed, tag emlowen-V09-01-09
ECPSSR model implementation for K-Shell-Cross-Section
with protons and alpha projectiles
18.03.2008 G.Cosmo, tag emlowen-V09-01-08
Fixed compilation error in G4CrossSectionChargeTransferExp.cc
for missing inclusion of <sstream>, detected on SUN-CC.
25.03.2008 MGP, tag emlowen-V09-01-07
New charge transfer process by incident protons
(two cross section and one final state policy classes)
17.03.2008 MGP, tag emlowen-V09-01-06
Doppler broadening added to G4LowEnergyCompton
based on Y. Namito, S. Ban and H. Hirayama,
NIM A 349, pp. 489-494, 1994
10.03.2008 MGP, tag emlowen-V09-01-05
Developments for Doppler broadening concerning data management
10.03.2008 MGP, tag emlowen-V09-01-04
Fixes to *DataSet files for better readability of the code
Extensions to G4ShellData to deal with shell data relevant to
Doppler broadening simulation
07.03.2008 MGP, tag emlowen-V09-01-03
Reverted to G4hLowEnergyIonisation.cc and G4hLowEnergyLoss.cc
as in emlowen-V09-01-01
07.03.2008 MGP, tag emlowen-V09-01-02
Operation for convenience of configuration management:
updated G4hLowEnergyIonisation.cc and G4hLowEnergyLoss.cc
to the head; the modifications to these two classes
were an attempt to address a PRS report by A. Howard,
but they proved ineffective and caused other problems;
a tag including them is made to facilitate later retrieve
06.03.2008 MGP, tag emlowen-V09-01-01
Restored readability of *DataSet* classes regards the
indentation of the code
21.02.2008 MGP, tag emlowen-V09-01-00
Bug fix in G4AtomicTransitionManager concerning
total radiative and non radiative probabilities
(fix provided by A. Mantero)
26.11.2007 MGP, tag emlowen-V09-00-28
Cleaned up std:: in G4FinalStateIonisationBorn/Rudd
@@ -25,7 +25,7 @@
//
//
// $Id: G4AtomicTransitionManager.hh,v 1.2 ????
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
// Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
@@ -25,7 +25,7 @@
//
//
// $Id: G4AtomicShell.hh,v 1.2 ????
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
// Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
@@ -25,7 +25,7 @@
//
//
// $Id: G4AtomicTransitionManager.hh,v 1.2 ????
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
// Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4AugerData.hh
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4BremsstrahlungParameters.hh,v 1.10 2006/06/29 19:33:06 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
// V. Ivanchenko (Vladimir.Ivantchenko@cern.ch)
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4CompositeEMDataSet.hh,v 1.8 2006/06/29 19:33:08 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4CompositeEMDataSet.hh,v 1.12 2008/03/17 13:45:25 pia Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -43,54 +43,63 @@
// -------------------------------------------------------------------
#ifndef G4COMPOSITEEMDATASET_HH
#define G4COMPOSITEEMDATASET_HH 1
#ifndef G4COMPOSITEEMDATASET_HH
#define G4COMPOSITEEMDATASET_HH 1
#include "globals.hh"
#include "G4VEMDataSet.hh"
#include <vector>
#include "globals.hh"
#include "G4VEMDataSet.hh"
#include <vector>
class G4VDataSetAlgorithm;
class G4VDataSetAlgorithm;
class G4CompositeEMDataSet : public G4VEMDataSet
{
public:
G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, G4double argUnitEnergies=MeV, G4double argUnitData=barn, G4int argMinZ=1, G4int argMaxZ=99);
virtual ~G4CompositeEMDataSet();
class G4CompositeEMDataSet : public G4VEMDataSet
{
public:
G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm,
G4double eUnit=MeV,
G4double dataUnit=barn,
G4int zMin=1,
G4int zMax=99);
virtual ~G4CompositeEMDataSet();
virtual G4double FindValue(G4double argEnergy, G4int argComponentId=0) const;
virtual G4double FindValue(G4double x, G4int componentId=0) const;
virtual void PrintData(void) const;
virtual void PrintData(void) const;
virtual const G4VEMDataSet * GetComponent(G4int argComponentId) const { return components[argComponentId]; }
virtual void AddComponent(G4VEMDataSet * argDataSet) { components.push_back(argDataSet); }
virtual size_t NumberOfComponents(void) const { return components.size(); }
virtual const G4VEMDataSet* GetComponent(G4int componentId) const { return components[componentId]; }
virtual void AddComponent(G4VEMDataSet* dataSet) { components.push_back(dataSet); }
virtual size_t NumberOfComponents() const { return components.size(); }
virtual const G4DataVector & GetEnergies(G4int argComponentId) const { return GetComponent(argComponentId)->GetEnergies(0); }
virtual const G4DataVector & GetData(G4int argComponentId) const { return GetComponent(argComponentId)->GetData(0); }
virtual void SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId);
virtual const G4DataVector& GetEnergies(G4int componentId) const { return GetComponent(componentId)->GetEnergies(0); }
virtual const G4DataVector& GetData(G4int componentId) const { return GetComponent(componentId)->GetData(0); }
virtual void SetEnergiesData(G4DataVector* x, G4DataVector* data, G4int componentId);
virtual G4bool LoadData(const G4String& fileName);
virtual G4bool SaveData(const G4String& fileName) const;
virtual G4double RandomSelect(G4int componentId) const;
virtual G4bool LoadData(const G4String & argFileName);
virtual G4bool SaveData(const G4String & argFileName) const;
private:
void CleanUpComponents(void);
private:
void CleanUpComponents(void);
// Hide copy constructor and assignment operator
G4CompositeEMDataSet();
G4CompositeEMDataSet(const G4CompositeEMDataSet & copy);
G4CompositeEMDataSet & operator=(const G4CompositeEMDataSet & right);
// Hide copy constructor and assignment operator
G4CompositeEMDataSet();
G4CompositeEMDataSet(const G4CompositeEMDataSet& copy);
G4CompositeEMDataSet& operator=(const G4CompositeEMDataSet& right);
std::vector<G4VEMDataSet *> components; // Owned pointers
std::vector<G4VEMDataSet*> components; // Owned pointers
G4VDataSetAlgorithm * algorithm; // Owned pointer
G4VDataSetAlgorithm* algorithm; // Owned pointer
G4double unitEnergies;
G4double unitData;
G4double unitEnergies;
G4double unitData;
G4int minZ;
G4int maxZ;
};
G4int minZ;
G4int maxZ;
};
#endif /* G4COMPOSITEEMDATASET_HH */
@@ -23,40 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionChargeDecrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionChargeDecrease.hh,v 1.2 2008/07/14 20:47:32 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONCHARGEDECREASE_HH
#define G4CROSSSECTIONCHARGEDECREASE_HH 1
#include "globals.hh"
#include <map>
#include "G4CrossSectionChargeDecreasePartial.hh"
#include "G4Track.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
class G4Track;
class G4CrossSectionChargeDecrease
{
public:
@@ -67,11 +44,8 @@ public:
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimitDefault;
G4double highEnergyLimitDefault;
@@ -23,36 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionChargeDecreasePartial.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
// 08 Nov 2007 MGP Got code from S.I.; lowercase data member
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionChargeDecreasePartial.hh,v 1.2 2008/07/14 20:47:32 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONCHARGEDECREASEPARTIAL_HH
#define G4CROSSSECTIONCHARGEDECREASEPARTIAL_HH 1
#include "globals.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "Randomize.hh"
class G4ParticleDefinition;
@@ -70,8 +49,6 @@ public:
G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
// Copy constructor and assignment operator to be added here
private:
G4int numberOfPartialCrossSections[3]; // 3 is the particle type index
@@ -23,40 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionChargeIncrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionChargeIncrease.hh,v 1.2 2008/07/14 20:47:33 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONCHARGEIncrease_HH
#define G4CROSSSECTIONCHARGEIncrease_HH 1
#include "globals.hh"
#include <map>
#include "G4CrossSectionChargeIncreasePartial.hh"
#include "G4Track.hh"
#include "G4DNAGenericIonsManager.hh"
class G4Track;
class G4CrossSectionChargeIncrease
{
public:
@@ -67,11 +43,8 @@ public:
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimitDefault;
G4double highEnergyLimitDefault;
@@ -23,37 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionChargeIncreasePartial.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionChargeIncreasePartial.hh,v 1.2 2008/07/14 20:47:33 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONCHARGEIncreasePARTIAL_HH
#define G4CROSSSECTIONCHARGEIncreasePARTIAL_HH 1
#include "globals.hh"
class G4ParticleDefinition;
#include "G4DNAGenericIonsManager.hh"
#include "Randomize.hh"
class G4CrossSectionChargeIncreasePartial
{
@@ -69,8 +46,6 @@ public:
G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
// Copy constructor and assignment operator to be added here
private:
G4int numberOfPartialCrossSections[2]; // 2 is the particle type index
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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: G4CrossSectionChargeTransferCH.hh,v 1.3 2008/03/25 16:00:20 pia Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Dec 2007 M.G. Pia Created
//
// -------------------------------------------------------------------
// Class description:
// Total cross section for charge transfer in hydrocarbons
// Reference: K. Janev, J. G. Wang and T. Kato, NIFS-DATA (2001)
// http://www-cfadc.phy.ornl.gov/astro/ps/data/
// http://www-pub.iaea.org/MTCD/publications/PDF/APID-VOL10.pdf
// Further documentation available from http://www.ge.infn.it/geant4/
// -------------------------------------------------------------------
#ifndef G4CROSSSECTIONCHARGETRANSFERCH_HH
#define G4CROSSSECTIONCHARGETRANSFERCH_HH 1
#include "globals.hh"
#include <vector>
#include <map>
class G4Track;
class G4CrossSectionChargeTransferCH
{
public:
G4CrossSectionChargeTransferCH();
virtual ~G4CrossSectionChargeTransferCH();
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimit;
G4double highEnergyLimit;
std::map<G4String,std::vector<G4double>,std::less<G4String> > crossMap;
};
#endif
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * 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: G4CrossSectionChargeTransferExp.hh,v 1.2 2008/03/25 16:00:20 pia Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Dec 2007 M.G. Pia Created
//
// -------------------------------------------------------------------
// Class description:
// Total cross section for charge transfer from experimental data interpolation
// http://www-cfadc.phy.ornl.gov/astro/ps/data/
// Further documentation available from http://www.ge.infn.it/geant4/
// -------------------------------------------------------------------
#ifndef G4CROSSSECTIONCHARGETRANSFEREXP_HH
#define G4CROSSSECTIONCHARGETRANSFEREXP_HH 1
#include "globals.hh"
#include <map>
class G4Track;
class G4VEMDataSet;
class G4CrossSectionChargeTransferExp
{
public:
G4CrossSectionChargeTransferExp();
virtual ~G4CrossSectionChargeTransferExp();
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4double unit1;
G4double unit2;
std::map<G4String,G4VEMDataSet*,std::less<G4String> > crossMap;
G4VEMDataSet* LoadData(const G4String& dataFile);
};
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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: G4CrossSectionElasticChampion.hh,v 1.1 2008/07/15 19:56:50 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
// -------------------------------------------------------------------
#ifndef G4CROSSSECTIONELASTICCHAMPION_HH
#define G4CROSSSECTIONELASTICCHAMPION_HH 1
#include <map>
#include "G4DNACrossSectionDataSet.hh"
#include "G4Electron.hh"
#include "G4Track.hh"
#include "G4LogLogInterpolation.hh"
class G4CrossSectionElasticChampion
{
public:
G4CrossSectionElasticChampion();
~G4CrossSectionElasticChampion();
G4double CrossSection(const G4Track& track);
private:
G4double lowEnergyLimit;
G4double highEnergyLimit;
typedef std::map<G4String,G4String,std::less<G4String> > MapFile;
MapFile tableFile;
typedef std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > MapData;
MapData tableData;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4CrossSectionElasticScreenedRutherford.hh,v 1.1 2007/10/12 23:07:10 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: G4CrossSectionElasticScreenedRutherfordHE.hh,v 1.1 2008/06/27 20:09:54 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONELASTICSCREENEDRUTHERFORDHE_HH
#define G4CROSSSECTIONELASTICSCREENEDRUTHERFORDHE_HH 1
#include "G4Track.hh"
class G4CrossSectionElasticScreenedRutherfordHE
{
public:
G4CrossSectionElasticScreenedRutherfordHE();
virtual ~G4CrossSectionElasticScreenedRutherfordHE();
G4double CrossSection(const G4Track&);
private:
G4double RutherfordCrossSection(G4double energy, G4double z);
G4double ScreeningFactor(G4double energy, G4double z);
G4double lowEnergyLimit;
G4double highEnergyLimit;
};
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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: G4CrossSectionElasticScreenedRutherfordLE.hh,v 1.2 2008/07/14 20:47:33 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONELASTICSCREENEDRUTHERFORDLE_HH
#define G4CROSSSECTIONELASTICSCREENEDRUTHERFORDLE_HH 1
#include "G4Track.hh"
class G4CrossSectionElasticScreenedRutherfordLE
{
public:
G4CrossSectionElasticScreenedRutherfordLE();
virtual ~G4CrossSectionElasticScreenedRutherfordLE();
G4double CrossSection(const G4Track&);
private:
G4double RutherfordCrossSection(G4double energy, G4double z);
G4double ScreeningFactor(G4double energy, G4double z);
G4double lowEnergyLimit;
G4double highEnergyLimit;
};
#endif
@@ -23,41 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationBorn.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationBorn.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONEXCITATIONBORN_HH
#define G4CROSSSECTIONEXCITATIONBORN_HH 1
#include "globals.hh"
#include <vector>
#include "G4WaterExcitationStructure.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4Track.hh"
#include "G4LogLogInterpolation.hh"
class G4Track;
class G4CrossSectionExcitationBorn
{
public:
@@ -68,11 +43,8 @@ public:
G4double CrossSection(const G4Track& track);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimit;
G4double highEnergyLimit;
@@ -23,37 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationBornPartial.hh,v 1.1 2007/10/15 08:34:12 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationBornPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONEXCITATIONBORNPARTIAL_HH
#define G4CROSSSECTIONEXCITATIONBORNPARTIAL_HH 1
#include "globals.hh"
#include <vector>
#include "G4DNACrossSectionDataSet.hh"
#include "G4LogLogInterpolation.hh"
#include "Randomize.hh"
#include <deque>
class G4CrossSectionExcitationBornPartial
{
@@ -63,11 +42,8 @@ public:
virtual ~G4CrossSectionExcitationBornPartial();
// Select an excitation level according to the partial cross sections
G4int RandomSelect(G4double energy);
// Copy constructor and assignment operator to be added here
private:
G4DNACrossSectionDataSet* table;
@@ -23,39 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationEmfietzoglou.hh,v 1.2 2007/10/15 08:31:49 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationEmfietzoglou.hh,v 1.3 2008/07/14 20:47:34 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONEXCITATIONEMFIETZOGLOU_HH
#define G4CROSSSECTIONEXCITATIONEMFIETZOGLOU_HH 1
#include "globals.hh"
#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
#include "G4Track.hh"
class G4Track;
class G4CrossSectionExcitationEmfietzoglou
{
public:
@@ -66,11 +42,8 @@ public:
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimit;
G4double highEnergyLimit;
@@ -23,37 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationEmfietzoglouPartial.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationEmfietzoglouPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONEXCITATIONEMFIETZOGLOUPARTIAL_HH
#define G4CROSSSECTIONEXCITATIONEMFIETZOGLOUPARTIAL_HH 1
#include "globals.hh"
#include <vector>
#include "G4WaterExcitationStructure.hh"
#include <deque>
#include "Randomize.hh"
class G4Track;
@@ -71,11 +49,8 @@ public:
G4int RandomSelect(G4double energy);
// Copy constructor and assignment operator to be added here
private:
// Number of excitation levels of the water molecule
G4int nLevels;
G4WaterExcitationStructure waterExcitation;
@@ -23,39 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationMillerGreen.hh,v 1.2 2007/11/08 19:56:02 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationMillerGreen.hh,v 1.3 2008/07/14 20:47:34 sincerti Exp $
#ifndef G4CROSSSECTIONEXCITATIONMILLERGREEN_HH
#define G4CROSSSECTIONEXCITATIONMILLERGREEN_HH 1
#include "globals.hh"
#include <map>
#include "G4CrossSectionExcitationMillerGreenPartial.hh"
class G4Track;
#include "G4Track.hh"
#include "G4Proton.hh"
#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
#include "G4DNAGenericIonsManager.hh"
class G4CrossSectionExcitationMillerGreen
{
@@ -67,11 +44,8 @@ public:
G4double CrossSection(const G4Track&);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimitDefault;
G4double highEnergyLimitDefault;
@@ -79,7 +53,6 @@ private:
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
G4CrossSectionExcitationMillerGreenPartial partialCrossSection;
};
#endif
@@ -23,41 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4CrossSectionExcitationMillerGreenPartial.hh,v 1.1 2007/11/08 19:56:02 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for electron elastic scattering in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionExcitationMillerGreenPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONEXCITATIONMILLERGREENPARTIAL_HH
#define G4CROSSSECTIONEXCITATIONMILLERGREENPARTIAL_HH 1
#include "globals.hh"
#include <vector>
#include "G4WaterExcitationStructure.hh"
#include "G4ParticleDefinition.hh"
#include "G4Track.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
#include "Randomize.hh"
class G4Track;
class G4CrossSectionExcitationMillerGreenPartial
{
public:
@@ -72,11 +50,8 @@ public:
G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
// Copy constructor and assignment operator to be added here
private:
// Number of excitation levels of the water molecule
G4int nLevels;
G4WaterExcitationStructure waterExcitation;
@@ -25,7 +25,7 @@
//
//
// $Id: G4CrossSectionHandler.hh,v 1.9 2006/06/29 19:33:10 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -24,39 +24,19 @@
// ********************************************************************
//
//
// $Id: G4CrossSectionIonisationBorn.hh,v 1.1 2007/10/22 09:12:58 pia Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
// History:
// -----------
// Date Name Modification
// 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper
//
// -------------------------------------------------------------------
// Class description:
// Geant4-DNA Cross total cross section for ionisation cross section in water
// Reference: TNS Geant4-DNA paper
// S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
// design foundation and implementation of the first set of models,
// IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
// Reference for implementation model: NIM. 155, pp. 145-156, 1978
// Further documentation available from http://www.ge.infn.it/geant4/dna
// -------------------------------------------------------------------
// $Id: G4CrossSectionIonisationBorn.hh,v 1.3 2008/12/18 13:01:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
#ifndef G4CROSSSECTIONIONISATIONBORN_HH
#define G4CROSSSECTIONIONISATIONBORN_HH 1
#include "globals.hh"
#include <map>
#include "G4DNACrossSectionDataSet.hh"
#include "G4ParticleDefinition.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4Track.hh"
#include "G4LogLogInterpolation.hh"
class G4Track;
class G4CrossSectionIonisationBorn
{
public:
@@ -67,11 +47,8 @@ public:
G4double CrossSection(const G4Track& track);
// Copy constructor and assignment operator to be added here
private:
G4String name;
G4double lowEnergyLimitDefault;
G4double highEnergyLimitDefault;

Some files were not shown because too many files have changed in this diff Show More