Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.16 2007/10/31 18:05:44 ahoward Exp $
|
||||
$Id: History,v 1.19 2008/04/22 09:29:35 ahoward Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,19 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
April 22nd, 2008 Alex Howard (procbiasing-V09-01-02)
|
||||
- Removed G4CellFinder and associated dependency in G4WeigthCutOffProcess and
|
||||
G4WeightCutOffConfigurator- was a hang-up from previous implementation
|
||||
which was erroneously left in the G4WeightCutOffProcess.
|
||||
This meant the WeightCutOff could only work in a MASS geometry
|
||||
(by coincidence between the ImportanceBiasing and the GeometryCells).
|
||||
|
||||
April 21st, 2008 Alex Howard (procbiasing-V09-01-01)
|
||||
- mis-tagged - please ignore
|
||||
|
||||
April 21st, 2008 Alex Howard (procbiasing-V09-01-00)
|
||||
- Tag of the HEAD which includes scoring for backwards compatibility
|
||||
|
||||
October 31st, 2007 Alex Howard (procbiasing-V09-00-00)
|
||||
- Fixed G4ProcessPlacer.cc to put biasing process second for AlongStep
|
||||
as well as PostStep - a bug which would feature for charged particles.
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometrySampler.hh,v 1.9 2007/06/01 09:52:23 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4GeometrySampler.hh,v 1.11 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4GeometrySampler
|
||||
@@ -49,7 +49,7 @@ class G4ImportanceConfigurator;
|
||||
class G4WeightWindowConfigurator;
|
||||
//class G4ScoreConfigurator;
|
||||
class G4WeightCutOffConfigurator;
|
||||
class G4VGCellFinder;
|
||||
//class G4VGCellFinder;
|
||||
|
||||
class G4GeometrySampler : public G4VSampler
|
||||
{
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
G4VPhysicalVolume* fWorld;
|
||||
G4ImportanceConfigurator *fImportanceConfigurator;
|
||||
// G4ScoreConfigurator *fScoreConfigurator;
|
||||
G4VGCellFinder *fGCellFinder;
|
||||
// G4VGCellFinder *fGCellFinder;
|
||||
G4WeightCutOffConfigurator *fWeightCutOffConfigurator;
|
||||
G4VIStore *fIStore;
|
||||
G4WeightWindowConfigurator *fWeightWindowConfigurator;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ImportanceConfigurator.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ImportanceConfigurator.hh,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4ImportanceConfigurator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ImportanceProcess.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ImportanceProcess.hh,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4ImportanceProcess
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PlaceOfAction.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4PlaceOfAction.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4PlaceOfAction
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ProcessPlacer.hh,v 1.3 2007/10/31 18:05:44 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ProcessPlacer.hh,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4ProcessPlacer
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SamplingPostStepAction.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4SamplingPostStepAction.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4SamplingPostStepAction
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackTerminator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4TrackTerminator.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4TrackTerminator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VProcessPlacer.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VProcessPlacer.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4VProcessPlacer
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSampler.hh,v 1.8 2007/06/25 06:57:22 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VSampler.hh,v 1.9 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4VSampler
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSamplerConfigurator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VSamplerConfigurator.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4VSamplerConfigurator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightCutOffConfigurator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightCutOffConfigurator.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4WeightCutOffConfigurator
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "G4ProcessPlacer.hh"
|
||||
|
||||
class G4WeightCutOffProcess;
|
||||
class G4VGCellFinder;
|
||||
//class G4VGCellFinder;
|
||||
class G4VIStore;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
@@ -60,7 +60,8 @@ public: // with description
|
||||
G4double wlimit,
|
||||
G4double isource,
|
||||
G4VIStore *istore,
|
||||
const G4VGCellFinder &aGCellFinder,G4bool paraflag);
|
||||
//const G4VGCellFinder &aGCellFinder,
|
||||
G4bool paraflag);
|
||||
|
||||
virtual ~G4WeightCutOffConfigurator();
|
||||
virtual void Configure(G4VSamplerConfigurator *preConf);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightCutOffProcess.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightCutOffProcess.hh,v 1.3 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4WeightCutOffProcess
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "G4VTrackTerminator.hh"
|
||||
#include "G4GeometryCell.hh"
|
||||
|
||||
class G4VGCellFinder;
|
||||
//class G4VGCellFinder;
|
||||
class G4VIStore;
|
||||
|
||||
class G4Step;
|
||||
@@ -66,7 +66,7 @@ public: // with description
|
||||
G4double wlimit,
|
||||
G4double isource,
|
||||
G4VIStore *istore,
|
||||
const G4VGCellFinder &aGCellFinder,
|
||||
// const G4VGCellFinder &aGCellFinder,
|
||||
const G4String &aName = "WeightCutOffProcess", G4bool para = false);
|
||||
// create a G4ParticleChange
|
||||
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
G4double fWeightLimit;
|
||||
G4double fSourceImportance;
|
||||
G4VIStore *fIStore;
|
||||
const G4VGCellFinder &fGCellFinder;
|
||||
// const G4VGCellFinder &fGCellFinder;
|
||||
|
||||
|
||||
G4TransportationManager* fTransportationManager;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightWindowConfigurator.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightWindowConfigurator.hh,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4WeightWindowConfigurator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightWindowProcess.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightWindowProcess.hh,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4MassWeioghtWindowProcess
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometrySampler.cc,v 1.8 2007/06/01 09:52:23 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4GeometrySampler.cc,v 1.10 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "G4ImportanceConfigurator.hh"
|
||||
#include "G4WeightWindowConfigurator.hh"
|
||||
#include "G4WeightCutOffConfigurator.hh"
|
||||
#include "G4GCellFinder.hh"
|
||||
//#include "G4GCellFinder.hh"
|
||||
|
||||
G4GeometrySampler::
|
||||
G4GeometrySampler(G4VPhysicalVolume *parallelworld, const G4String &particlename)
|
||||
@@ -53,7 +53,7 @@
|
||||
fWorld(parallelworld),
|
||||
fImportanceConfigurator(0),
|
||||
// fScoreConfigurator(0),
|
||||
fGCellFinder(0),
|
||||
// fGCellFinder(0),
|
||||
fWeightCutOffConfigurator(0),
|
||||
fIStore(0),
|
||||
fWeightWindowConfigurator(0),
|
||||
@@ -90,11 +90,11 @@ void G4GeometrySampler::ClearSampling()
|
||||
delete fWeightCutOffConfigurator;
|
||||
fWeightCutOffConfigurator = 0;
|
||||
}
|
||||
if (fGCellFinder)
|
||||
{
|
||||
delete fGCellFinder;
|
||||
fGCellFinder = 0;
|
||||
}
|
||||
// if (fGCellFinder)
|
||||
// {
|
||||
// delete fGCellFinder;
|
||||
// fGCellFinder = 0;
|
||||
// }
|
||||
fIStore = 0;
|
||||
fConfigurators.clear();
|
||||
fIsConfigured = false;
|
||||
@@ -161,13 +161,13 @@ G4GeometrySampler::PrepareWeightRoulett(G4double wsurvive,
|
||||
{
|
||||
// fGCellFinder = new G4GCellFinder(fWorld);
|
||||
G4cout << " preparing weight roulette" << G4endl;
|
||||
fGCellFinder = new G4GCellFinder();
|
||||
if (!fGCellFinder)
|
||||
{
|
||||
G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
|
||||
"FatalError", FatalException,
|
||||
"Failed allocation of G4GCellFinder !");
|
||||
}
|
||||
// fGCellFinder = new G4GCellFinder();
|
||||
// if (!fGCellFinder)
|
||||
// {
|
||||
// G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
|
||||
// "FatalError", FatalException,
|
||||
// "Failed allocation of G4GCellFinder !");
|
||||
// }
|
||||
|
||||
fWeightCutOffConfigurator =
|
||||
new G4WeightCutOffConfigurator(fWorld, fParticleName,
|
||||
@@ -175,7 +175,8 @@ G4GeometrySampler::PrepareWeightRoulett(G4double wsurvive,
|
||||
wlimit,
|
||||
isource,
|
||||
fIStore,
|
||||
*fGCellFinder, paraflag);
|
||||
paraflag);
|
||||
//*fGCellFinder, paraflag);
|
||||
if (!fWeightCutOffConfigurator)
|
||||
{
|
||||
G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ImportanceConfigurator.cc,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ImportanceConfigurator.cc,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4ImportanceConfigurator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ImportanceProcess.cc,v 1.3 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ImportanceProcess.cc,v 1.4 2008/04/21 09:10:28 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ProcessPlacer.cc,v 1.4 2007/10/31 18:05:44 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ProcessPlacer.cc,v 1.5 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SamplingPostStepAction.cc,v 1.2 2007/06/01 09:16:33 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4SamplingPostStepAction.cc,v 1.3 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VProcessPlacer.cc,v 1.1 2007/06/01 14:57:03 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VProcessPlacer.cc,v 1.2 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSampler.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VSampler.cc,v 1.3 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSamplerConfigurator.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VSamplerConfigurator.cc,v 1.3 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightCutOffConfigurator.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightCutOffConfigurator.cc,v 1.3 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4WeightCutOffConfigurator
|
||||
@@ -43,14 +43,16 @@ G4WeightCutOffConfigurator(G4VPhysicalVolume* worldvolume,
|
||||
G4double wlimit,
|
||||
G4double isource,
|
||||
G4VIStore *istore,
|
||||
const G4VGCellFinder &aGCellfinder, G4bool para)
|
||||
G4bool para)
|
||||
// const G4VGCellFinder &aGCellfinder, G4bool para)
|
||||
: fWorld(worldvolume),
|
||||
fPlacer(particlename),
|
||||
fPlaced(false),
|
||||
paraflag(para)
|
||||
{
|
||||
fWeightCutOffProcess =
|
||||
new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,aGCellfinder,"WeightCutOffProcess",paraflag);
|
||||
new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,"WeightCutOffProcess",paraflag);
|
||||
// new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,aGCellfinder,"WeightCutOffProcess",paraflag);
|
||||
if (!fWeightCutOffProcess)
|
||||
{
|
||||
G4Exception("G4WeightCutOffConfigurator::G4WeightCutOffConfigurator()",
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightCutOffProcess.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightCutOffProcess.cc,v 1.3 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "G4WeightCutOffProcess.hh"
|
||||
//#include "G4VScorer.hh"
|
||||
#include "G4GeometryCellStep.hh"
|
||||
#include "G4GCellFinder.hh"
|
||||
//#include "G4GCellFinder.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4VIStore.hh"
|
||||
|
||||
@@ -57,7 +57,7 @@ G4WeightCutOffProcess(G4double wsurvival,
|
||||
G4double wlimit,
|
||||
G4double isource,
|
||||
G4VIStore *istore,
|
||||
const G4VGCellFinder &aGCellFinder,
|
||||
// const G4VGCellFinder &aGCellFinder,
|
||||
const G4String &aName, G4bool para)
|
||||
: G4VProcess(aName),
|
||||
fParticleChange(new G4ParticleChange),
|
||||
@@ -65,7 +65,7 @@ G4WeightCutOffProcess(G4double wsurvival,
|
||||
fWeightLimit(wlimit),
|
||||
fSourceImportance(isource),
|
||||
fIStore(istore),
|
||||
fGCellFinder(aGCellFinder),
|
||||
// fGCellFinder(aGCellFinder),
|
||||
fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0')
|
||||
{
|
||||
if (!fParticleChange)
|
||||
@@ -224,32 +224,70 @@ G4WeightCutOffProcess::PostStepDoIt(const G4Track& aTrack,
|
||||
|
||||
}
|
||||
|
||||
G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
|
||||
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
|
||||
G4double R = fSourceImportance;
|
||||
if (fIStore)
|
||||
{
|
||||
G4double i = fIStore->GetImportance(postCell);
|
||||
if (i>0)
|
||||
{
|
||||
R/=i;
|
||||
}
|
||||
}
|
||||
G4double w = aTrack.GetWeight();
|
||||
if (w<R*fWeightLimit)
|
||||
{
|
||||
G4double ws = fWeightSurvival*R;
|
||||
G4double p = w/(ws);
|
||||
if (G4UniformRand()<p)
|
||||
{
|
||||
fParticleChange->ProposeTrackStatus(fStopAndKill);
|
||||
}
|
||||
else
|
||||
{
|
||||
fParticleChange->ProposeWeight(ws);
|
||||
}
|
||||
if(paraflag) {
|
||||
G4GeometryCell postCell(*(fGhostPostStepPoint->GetPhysicalVolume()),
|
||||
fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
|
||||
|
||||
|
||||
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
|
||||
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
|
||||
G4double R = fSourceImportance;
|
||||
if (fIStore)
|
||||
{
|
||||
G4double i = fIStore->GetImportance(postCell);
|
||||
if (i>0)
|
||||
{
|
||||
R/=i;
|
||||
}
|
||||
}
|
||||
G4double w = aTrack.GetWeight();
|
||||
if (w<R*fWeightLimit)
|
||||
{
|
||||
G4double ws = fWeightSurvival*R;
|
||||
G4double p = w/(ws);
|
||||
if (G4UniformRand()<p)
|
||||
{
|
||||
fParticleChange->ProposeTrackStatus(fStopAndKill);
|
||||
}
|
||||
else
|
||||
{
|
||||
fParticleChange->ProposeWeight(ws);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
G4GeometryCell postCell(*(aStep.GetPostStepPoint()->GetPhysicalVolume()),
|
||||
aStep.GetPostStepPoint()->GetTouchable()->GetReplicaNumber());
|
||||
|
||||
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
|
||||
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
|
||||
G4double R = fSourceImportance;
|
||||
if (fIStore)
|
||||
{
|
||||
G4double i = fIStore->GetImportance(postCell);
|
||||
if (i>0)
|
||||
{
|
||||
R/=i;
|
||||
}
|
||||
}
|
||||
G4double w = aTrack.GetWeight();
|
||||
if (w<R*fWeightLimit)
|
||||
{
|
||||
G4double ws = fWeightSurvival*R;
|
||||
G4double p = w/(ws);
|
||||
if (G4UniformRand()<p)
|
||||
{
|
||||
fParticleChange->ProposeTrackStatus(fStopAndKill);
|
||||
}
|
||||
else
|
||||
{
|
||||
fParticleChange->ProposeWeight(ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fParticleChange;
|
||||
|
||||
}
|
||||
|
||||
const G4String &G4WeightCutOffProcess::GetName() const
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightWindowConfigurator.cc,v 1.3 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightWindowConfigurator.cc,v 1.4 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4WeightWindowConfigurator
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4WeightWindowProcess.cc,v 1.3 2007/06/01 09:16:34 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4WeightWindowProcess.cc,v 1.4 2008/04/21 09:10:29 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.21 2007/06/06 14:50:38 gcosmo Exp $
|
||||
$Id: History,v 1.22 2008/03/02 10:52:55 kurasige Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -16,6 +16,9 @@ committal in the CVS repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
Mar. 2nd, 2008 - H.Kurashige (procuts-V09-01-00)
|
||||
- Add ProductionCutsMessenger
|
||||
- Suppress 'too big cut value' messsage for higher verbosity
|
||||
|
||||
June 6th, 2007 - L.Urban (procuts-V08-03-01)
|
||||
- Fix in G4VRangeToEnergyConverter::convert(), range-energu conversion,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MCCIndexConversionTable.hh,v 1.3 2006/06/29 19:29:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MaterialCutsCouple.hh,v 1.3 2006/06/29 19:29:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTableHelper.hh,v 1.3 2006/06/29 19:29:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ProductionCuts.hh,v 1.4 2006/06/29 19:29:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ProductionCutsTable.hh,v 1.8 2007/03/15 04:06:40 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ProductionCutsTable.hh,v 1.9 2008/03/02 10:52:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -45,7 +45,8 @@
|
||||
// Modified 20 Aug. 2004 H.Kurashige
|
||||
// Modify RetrieveCutsTable to allow materials and
|
||||
// couples can be different from one in file (i.e. at storing)
|
||||
//
|
||||
// Modified 2 Mar. 2008 H.Kurashige
|
||||
// add messenger
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProductionCutsTable_h
|
||||
@@ -57,6 +58,8 @@ class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4ProductionCuts;
|
||||
|
||||
class G4ProductionCutsTableMessenger;
|
||||
|
||||
#include "globals.hh"
|
||||
#include <cmath>
|
||||
#include "G4ios.hh"
|
||||
@@ -226,7 +229,8 @@ class G4ProductionCutsTable
|
||||
// 2: More
|
||||
|
||||
private:
|
||||
G4int verboseLevel;
|
||||
G4int verboseLevel;
|
||||
G4ProductionCutsTableMessenger* fMessenger;
|
||||
|
||||
};
|
||||
|
||||
@@ -338,12 +342,6 @@ G4int G4ProductionCutsTable:: GetCoupleIndex(const G4Material* aMat,
|
||||
return GetCoupleIndex(aCouple);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4ProductionCutsTable::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProductionCutsTable::GetVerboseLevel() const
|
||||
{
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ProductionCutsTableMessenger.hh,v 1.1 2008/03/02 10:52:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcductionCutsTableMessenger.hh
|
||||
//
|
||||
// Class Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ProductionCutsTable and UI.
|
||||
// --
|
||||
// the List of Directory and Commands
|
||||
// -
|
||||
// /run/particle/ Paricle control commands.
|
||||
// Commands :
|
||||
// SetCuts * Set default cut value
|
||||
// dumpList * Dump List of particles in G4VUserPhysicsList.
|
||||
// verbose * Set the Verbose level of G4VUserPhysicsList.
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 02 Mar. 2008 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcductionCutsTableMessenger_h
|
||||
#define G4ProcductionCutsTableMessenger_h 1
|
||||
|
||||
class G4ProductionCutsTable;
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcommand;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ProductionCutsTableMessenger: public G4UImessenger
|
||||
{
|
||||
private:
|
||||
// hide default constructor
|
||||
G4ProductionCutsTableMessenger(){}
|
||||
|
||||
public:
|
||||
G4ProductionCutsTableMessenger(G4ProductionCutsTable* pTable);
|
||||
virtual ~G4ProductionCutsTableMessenger();
|
||||
|
||||
public: // with description
|
||||
virtual void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
virtual G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
protected:
|
||||
G4ProductionCutsTable* theCutsTable;
|
||||
|
||||
private: //commands
|
||||
G4UIdirectory * theDirectory;
|
||||
G4UIcmdWithAnInteger * verboseCmd;
|
||||
G4UIcmdWithADoubleAndUnit * setLowEdgeCmd;
|
||||
G4UIcmdWithADoubleAndUnit * setHighEdgeCmd;
|
||||
G4UIcmdWithoutParameter * dumpCmd;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForAntiNeutron.hh,v 1.2 2006/06/29 19:29:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForAntiProton.hh,v 1.2 2006/06/29 19:29:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForElectron.hh,v 1.2 2006/06/29 19:29:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForGamma.hh,v 1.2 2006/06/29 19:29:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForNeutron.hh,v 1.2 2006/06/29 19:30:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForPositron.hh,v 1.2 2006/06/29 19:30:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForProton.hh,v 1.2 2006/06/29 19:30:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VRangeToEnergyConverter.hh,v 1.4 2006/06/29 19:30:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MCCIndexConversionTable.cc,v 1.3 2006/06/29 19:30:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MaterialCutsCouple.cc,v 1.3 2006/06/29 19:30:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PhysicsTableHelper.cc,v 1.5 2006/06/29 19:30:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ProductionCuts.cc,v 1.5 2006/06/29 19:30:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -24,18 +24,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ProductionCutsTable.cc,v 1.17 2007/05/30 08:22:20 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4ProductionCutsTable.cc,v 1.18 2008/03/02 10:52:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file/ History:
|
||||
// 06/Oct. 2002, M.Asai : First implementation
|
||||
// 02/Mar. 2008, H.Kurashige : Add messenger
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4MCCIndexConversionTable.hh"
|
||||
#include "G4ProductionCutsTableMessenger.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
@@ -65,7 +67,7 @@ G4ProductionCutsTable* G4ProductionCutsTable::GetProductionCutsTable()
|
||||
}
|
||||
|
||||
G4ProductionCutsTable::G4ProductionCutsTable()
|
||||
: firstUse(true),verboseLevel(1)
|
||||
: firstUse(true),verboseLevel(1),fMessenger(0)
|
||||
{
|
||||
for(size_t i=0;i< NumberOfG4CutIndex;i++)
|
||||
{
|
||||
@@ -77,6 +79,9 @@ G4ProductionCutsTable::G4ProductionCutsTable()
|
||||
}
|
||||
fG4RegionStore = G4RegionStore::GetInstance();
|
||||
defaultProductionCuts = new G4ProductionCuts();
|
||||
|
||||
// add messenger for UI
|
||||
fMessenger = new G4ProductionCutsTableMessenger(this);
|
||||
}
|
||||
|
||||
G4ProductionCutsTable::G4ProductionCutsTable(const G4ProductionCutsTable& )
|
||||
@@ -102,17 +107,26 @@ G4ProductionCutsTable::~G4ProductionCutsTable()
|
||||
if(energyDoubleVector[i]!=0) delete [] energyDoubleVector[i];
|
||||
}
|
||||
fG4ProductionCutsTable =0;
|
||||
|
||||
if (fMessenger !=0) delete fMessenger;
|
||||
fMessenger = 0;
|
||||
}
|
||||
|
||||
void G4ProductionCutsTable::UpdateCoupleTable(G4VPhysicalVolume* currentWorld)
|
||||
{
|
||||
if(firstUse){
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("gamma"))
|
||||
{ converters[0] = new G4RToEConvForGamma(); }
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("e-"))
|
||||
{ converters[1] = new G4RToEConvForElectron(); }
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("e+"))
|
||||
{ converters[2] = new G4RToEConvForPositron(); }
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("gamma")){
|
||||
converters[0] = new G4RToEConvForGamma();
|
||||
converters[0]->SetVerboseLevel(GetVerboseLevel());
|
||||
}
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("e-")){
|
||||
converters[1] = new G4RToEConvForElectron();
|
||||
converters[1]->SetVerboseLevel(GetVerboseLevel());
|
||||
}
|
||||
if(G4ParticleTable::GetParticleTable()->FindParticle("e+")){
|
||||
converters[2] = new G4RToEConvForPositron();
|
||||
converters[2]->SetVerboseLevel(GetVerboseLevel());
|
||||
}
|
||||
firstUse = false;
|
||||
}
|
||||
|
||||
@@ -375,7 +389,7 @@ G4bool G4ProductionCutsTable::StoreCutsTable(const G4String& dir,
|
||||
if (!StoreCutsInfo(dir, ascii)) return false;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >1) {
|
||||
if (verboseLevel >2) {
|
||||
G4cout << "G4ProductionCutsTable::StoreCutsTable " ;
|
||||
G4cout << " Material/Cuts information have been succesfully stored ";
|
||||
if (ascii) {
|
||||
@@ -395,7 +409,7 @@ G4bool G4ProductionCutsTable::RetrieveCutsTable(const G4String& dir,
|
||||
if (!CheckForRetrieveCutsTable(dir, ascii)) return false;
|
||||
if (!RetrieveCutsInfo(dir, ascii)) return false;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >1) {
|
||||
if (verboseLevel >2) {
|
||||
G4cout << "G4ProductionCutsTable::RetrieveCutsTable " ;
|
||||
G4cout << " Material/Cuts information have been succesfully retreived ";
|
||||
if (ascii) {
|
||||
@@ -419,11 +433,11 @@ G4bool
|
||||
G4cerr << "G4ProductionCutsTable::CheckForRetrieveCutsTable!!"<< G4endl;
|
||||
// isNeedForRestoreCoupleInfo = false;
|
||||
if (!CheckMaterialInfo(directory, ascii)) return false;
|
||||
if (verboseLevel >1) {
|
||||
if (verboseLevel >2) {
|
||||
G4cerr << "G4ProductionCutsTable::CheckMaterialInfo passed !!"<< G4endl;
|
||||
}
|
||||
if (!CheckMaterialCutsCoupleInfo(directory, ascii)) return false;
|
||||
if (verboseLevel >1) {
|
||||
if (verboseLevel >2) {
|
||||
G4cerr << "G4ProductionCutsTable::CheckMaterialCutsCoupleInfo passed !!"<< G4endl;
|
||||
}
|
||||
return true;
|
||||
@@ -1079,3 +1093,16 @@ G4bool G4ProductionCutsTable::RetrieveCutsInfo(const G4String& directory,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set Verbose Level
|
||||
// set same verbosity to all registered RangeToEnergyConverters
|
||||
void G4ProductionCutsTable::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
for (int ip=0; ip< NumberOfG4CutIndex; ip++) {
|
||||
if (converters[ip] !=0 ){
|
||||
converters[ip]->SetVerboseLevel(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ProductionCutsTableMessenger.cc,v 1.1 2008/03/02 10:52:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProductionCutsTableMessenger.cc
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 02 Mar. 2008 by H.Kurashige
|
||||
//
|
||||
|
||||
#include "G4ProductionCutsTableMessenger.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Tokenizer.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger( G4ProductionCutsTable* pTable)
|
||||
:theCutsTable(pTable)
|
||||
{
|
||||
// /cuts/ directory
|
||||
theDirectory = new G4UIdirectory("/cuts/");
|
||||
theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
|
||||
|
||||
// /cuts/verbose command
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
|
||||
verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
|
||||
verboseCmd->SetGuidance(" 0 : Silent (default)");
|
||||
verboseCmd->SetGuidance(" 1 : Display warning messages");
|
||||
verboseCmd->SetGuidance(" 2 : Display more info");
|
||||
verboseCmd->SetGuidance(" 2 : Display debug info");
|
||||
verboseCmd->SetParameterName("level",true);
|
||||
verboseCmd->SetDefaultValue(0);
|
||||
verboseCmd->SetRange("level >=0 && level <=3");
|
||||
|
||||
// /cuts/setLowEdge command
|
||||
setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
|
||||
setLowEdgeCmd->SetGuidance("Set low edge energy value ");
|
||||
setLowEdgeCmd->SetParameterName("edge",false);
|
||||
setLowEdgeCmd->SetDefaultValue(0.99);
|
||||
setLowEdgeCmd->SetRange("edge >0.0");
|
||||
setLowEdgeCmd->SetDefaultUnit("keV");
|
||||
setLowEdgeCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
// /cuts/setHighEdge command
|
||||
setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
|
||||
setHighEdgeCmd->SetGuidance("Set high edge energy value ");
|
||||
setHighEdgeCmd->SetParameterName("edge",false);
|
||||
setHighEdgeCmd->SetDefaultValue(100.0);
|
||||
setHighEdgeCmd->SetRange("edge >0.0");
|
||||
setHighEdgeCmd->SetDefaultUnit("TeV");
|
||||
setHighEdgeCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
// /cuts/dump command
|
||||
dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
|
||||
dumpCmd->SetGuidance("Dump cuplues in ProductuinCutsTable. ");
|
||||
|
||||
}
|
||||
|
||||
G4ProductionCutsTableMessenger::~G4ProductionCutsTableMessenger()
|
||||
{
|
||||
delete dumpCmd;
|
||||
delete setHighEdgeCmd;
|
||||
delete setLowEdgeCmd;
|
||||
delete verboseCmd;
|
||||
delete theDirectory;
|
||||
}
|
||||
|
||||
void G4ProductionCutsTableMessenger::SetNewValue(G4UIcommand * command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command==verboseCmd ) {
|
||||
theCutsTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
|
||||
|
||||
} else if( command==dumpCmd ){
|
||||
theCutsTable-> DumpCouples();
|
||||
|
||||
} else if( command==setLowEdgeCmd ){
|
||||
G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
|
||||
G4double highEdge = theCutsTable->GetHighEdgeEnergy();
|
||||
theCutsTable->SetEnergyRange(lowEdge, highEdge);
|
||||
|
||||
} else if( command==setHighEdgeCmd ){
|
||||
G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
|
||||
G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
|
||||
theCutsTable->SetEnergyRange(lowEdge, highEdge);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
G4String G4ProductionCutsTableMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if( command==verboseCmd ){
|
||||
cv = verboseCmd->ConvertToString(theCutsTable->GetVerboseLevel());
|
||||
|
||||
} else if( command==setLowEdgeCmd ){
|
||||
G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
|
||||
cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
|
||||
|
||||
} else if( command==setHighEdgeCmd ){
|
||||
G4double highEdge = theCutsTable->GetHighEdgeEnergy();
|
||||
cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
|
||||
}
|
||||
|
||||
return cv;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForAntiNeutron.cc,v 1.3 2006/06/29 19:30:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForAntiProton.cc,v 1.3 2006/06/29 19:30:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForElectron.cc,v 1.5 2006/06/29 19:30:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForGamma.cc,v 1.4 2006/06/29 19:30:24 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForNeutron.cc,v 1.3 2006/06/29 19:30:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForPositron.cc,v 1.5 2006/06/29 19:30:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RToEConvForProton.cc,v 1.3 2006/06/29 19:30:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VRangeToEnergyConverter.cc,v 1.8 2007/06/06 05:13:34 urban Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VRangeToEnergyConverter.cc,v 1.9 2008/03/02 10:52:56 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -273,7 +273,7 @@ void G4VRangeToEnergyConverter::BuildLossTable()
|
||||
theLossTable = new G4LossTable();
|
||||
theLossTable->reserve(G4Element::GetNumberOfElements());
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>2) {
|
||||
if (GetVerboseLevel()>3) {
|
||||
G4cout << "G4VRangeToEnergyConverter::BuildLossTable() ";
|
||||
G4cout << "Create theLossTable[" << theLossTable << "]";
|
||||
G4cout << " NumberOfElements=" << NumberOfElements <<G4endl;
|
||||
@@ -446,7 +446,7 @@ G4double G4VRangeToEnergyConverter::ConvertCutToKineticEnergy(
|
||||
// check cut in length is smaller than range max
|
||||
if ( theCutInLength >= rmax ) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
if (GetVerboseLevel()>2) {
|
||||
G4cout << "G4VRangeToEnergyConverter::ConvertCutToKineticEnergy ";
|
||||
G4cout << " for " << theParticle->GetParticleName() << G4endl;
|
||||
G4cout << "The cut in range [" << theCutInLength/mm << " (mm)] ";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.28 2007/10/30 03:14:18 gum Exp $
|
||||
$Id: History,v 1.34 2008/11/14 15:55:47 kurasige Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -16,6 +16,27 @@ committal in the CVS repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
-Sep. 19 2008 H.Kurashige (decay-V09-01-04)
|
||||
- modify process sub type enumeration
|
||||
|
||||
- Aug. 22, 08 P.Gumplinger (decay-V09-01-03)
|
||||
- fix a bug in G4DecayWithSpin.cc: there is a memory overwrite when the
|
||||
GetFieldValue being called initializes a fieldValue array of size 6
|
||||
when the array is only defined of size 3 in the calling program.
|
||||
Thanks to Kamil Sedlak (PSI) for pointing this out and suggesting this
|
||||
fix.
|
||||
|
||||
- Apr. 16, 08 H.Kurashige (decay-V09-01-02)
|
||||
- fix a bug when shortlived particles has finite pre-assigned proper time
|
||||
|
||||
- Apr. 11, 08 P.Gumplinger (decay-V09-01-01)
|
||||
- modify G4DecayWithSpin::DecayIt to allow spin precession also for EM Fields;
|
||||
e.g. fields that do "DoesFieldChangeEnergy()" but only if the B-field
|
||||
component is > 0. (thanks to Kamil Sedlak, Toni Shiroka from PSI)
|
||||
|
||||
- Dec. 15, 07 H.Kurashige (decay-V09-01-00)
|
||||
- add G4DecayProcessType
|
||||
- define process sub type
|
||||
|
||||
- Oct. 29, 07 P.Gumplinger (decay-V09-00-02)
|
||||
- add G4PionDecayMakeSpin class
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Decay.hh,v 1.18 2007/07/23 23:13:04 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4Decay.hh,v 1.20 2008/09/19 03:19:53 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -57,6 +57,8 @@
|
||||
#include "globals.hh"
|
||||
#include "G4VRestDiscreteProcess.hh"
|
||||
#include "G4ParticleChangeForDecay.hh"
|
||||
#include "G4DecayProcessType.hh"
|
||||
|
||||
class G4VExtDecayer;
|
||||
|
||||
class G4Decay : public G4VRestDiscreteProcess
|
||||
@@ -204,12 +206,6 @@ inline
|
||||
return DecayIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Decay::SetExtDecayer(G4VExtDecayer* val)
|
||||
{
|
||||
pExtDecayer = val;
|
||||
}
|
||||
|
||||
inline
|
||||
const G4VExtDecayer* G4Decay::GetExtDecayer() const
|
||||
{
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4DecayProcessType.hh,v 1.2 2008/09/19 03:19:53 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4DecayProcessType.hh
|
||||
//
|
||||
// Class Description:
|
||||
// This is an enumerator to define process sub type for decay
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#ifndef G4DecayProcessType_h
|
||||
#define G4DecayProcessType_h 1
|
||||
|
||||
enum G4DecayProcessType
|
||||
{
|
||||
DECAY = 201 ,
|
||||
DECAY_WithSpin ,
|
||||
DECAY_PionMakeSpin ,
|
||||
DECAY_Unknown = 211,
|
||||
DECAY_External = 231
|
||||
};
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UnknownDecay.hh,v 1.3 2006/06/29 19:30:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VExtDecayer.hh,v 1.4 2006/06/29 19:31:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Decay.cc,v 1.27 2007/10/06 07:01:09 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4Decay.cc,v 1.30 2008/09/19 03:19:53 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -63,11 +63,15 @@ G4Decay::G4Decay(const G4String& processName)
|
||||
HighestValue(20.0),
|
||||
pExtDecayer(0)
|
||||
{
|
||||
// set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(DECAY));
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>1) {
|
||||
G4cout << "G4Decay constructor " << " Name:" << processName << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
pParticleChange = &fParticleChangeForDecay;
|
||||
}
|
||||
|
||||
@@ -403,9 +407,20 @@ G4double G4Decay::PostStepGetPhysicalInteractionLength(
|
||||
// reminder proper time
|
||||
fRemainderLifeTime = pTime - track.GetProperTime();
|
||||
if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
|
||||
|
||||
|
||||
G4double rvalue=0.0;
|
||||
// use pre-assigned Decay time to determine PIL
|
||||
return (fRemainderLifeTime/aLife)*GetMeanFreePath(track, previousStepSize, condition);
|
||||
if (aLife>0.0) {
|
||||
// ordinary particle
|
||||
rvalue = (fRemainderLifeTime/aLife)*GetMeanFreePath(track, previousStepSize, condition);
|
||||
} else {
|
||||
// shortlived particle
|
||||
rvalue = c_light * fRemainderLifeTime;
|
||||
// by using normalized kinetic energy (= Ekin/mass)
|
||||
G4double aMass = track.GetDynamicParticle()->GetMass();
|
||||
rvalue *= track.GetDynamicParticle()->GetTotalMomentum()/aMass;
|
||||
}
|
||||
return rvalue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,3 +442,14 @@ G4double G4Decay::AtRestGetPhysicalInteractionLength(
|
||||
}
|
||||
return fRemainderLifeTime;
|
||||
}
|
||||
|
||||
|
||||
void G4Decay::SetExtDecayer(G4VExtDecayer* val)
|
||||
{
|
||||
pExtDecayer = val;
|
||||
|
||||
// set Process Sub Type
|
||||
if ( pExtDecayer !=0 ) {
|
||||
SetProcessSubType(static_cast<int>(DECAY_External));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
//
|
||||
// History:
|
||||
// 17 August 2004 P. Gumplinger, T. MacPhail
|
||||
// 11 April 2008 Kamil Sedlak (PSI), Toni Shiroka (PSI)
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
#include "G4DecayWithSpin.hh"
|
||||
@@ -46,7 +47,12 @@
|
||||
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processName){}
|
||||
G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processName)
|
||||
{
|
||||
// set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(DECAY_WithSpin));
|
||||
|
||||
}
|
||||
|
||||
G4DecayWithSpin::~G4DecayWithSpin(){}
|
||||
|
||||
@@ -96,7 +102,7 @@ G4VParticleChange* G4DecayWithSpin::DecayIt(const G4Track& aTrack, const G4Step&
|
||||
const G4Field* field = NULL;
|
||||
if(fieldMgr)field = fieldMgr->GetDetectorField();
|
||||
|
||||
if (field && !(fieldMgr->DoesFieldChangeEnergy())) {
|
||||
if (field) {
|
||||
|
||||
G4double point[4];
|
||||
point[0] = (aStep.GetPostStepPoint()->GetPosition())[0];
|
||||
@@ -104,12 +110,14 @@ G4VParticleChange* G4DecayWithSpin::DecayIt(const G4Track& aTrack, const G4Step&
|
||||
point[2] = (aStep.GetPostStepPoint()->GetPosition())[2];
|
||||
point[3] = aTrack.GetGlobalTime();
|
||||
|
||||
G4double fieldValue[3];
|
||||
G4double fieldValue[6];
|
||||
field -> GetFieldValue(point,fieldValue);
|
||||
|
||||
G4ThreeVector B(fieldValue[0],fieldValue[1],fieldValue[2]);
|
||||
|
||||
parent_polarization = Spin_Precession(aStep,B,fRemainderLifeTime);
|
||||
// Call the spin precession only for non-zero mag. field
|
||||
if (B.mag2() > 0.) parent_polarization =
|
||||
Spin_Precession(aStep,B,fRemainderLifeTime);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,12 @@
|
||||
// constructor
|
||||
|
||||
G4PionDecayMakeSpin::G4PionDecayMakeSpin(const G4String& processName)
|
||||
: G4Decay(processName) { }
|
||||
: G4Decay(processName)
|
||||
{
|
||||
// set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(DECAY_PionMakeSpin));
|
||||
|
||||
}
|
||||
|
||||
G4PionDecayMakeSpin::~G4PionDecayMakeSpin() { }
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnknownDecay.cc,v 1.5 2007/10/06 07:01:09 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4UnknownDecay.cc,v 1.6 2007/12/15 12:29:16 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "G4DecayProducts.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4ParticleChangeForDecay.hh"
|
||||
#include "G4DecayProcessType.hh"
|
||||
|
||||
|
||||
// constructor
|
||||
G4UnknownDecay::G4UnknownDecay(const G4String& processName)
|
||||
@@ -46,6 +48,9 @@ G4UnknownDecay::G4UnknownDecay(const G4String& processName)
|
||||
verboseLevel(1),
|
||||
HighestValue(20.0)
|
||||
{
|
||||
// set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(DECAY_Unknown));
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>1) {
|
||||
G4cout << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
|
||||
|
||||
@@ -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.
|
||||
|
||||
+138
@@ -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 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user