Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.3 2000/10/25 00:00:48 kurasige Exp $
$Id: History,v 1.6 2001/02/28 06:20:07 kurasige Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,15 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- Feb 29, 01 H.Kurashige(decay-V03-00-03)
- Fix minor bug in G4VExtDecayer
- Feb 22, 01 H.Kurashige(decay-V03-00-02)
- Add G4VExtDecayer and modify G4Decay
- Jan 18, 01 H.Kurashige(decay-V03-00-01)
- Use PreAssignedDecayTime in G4DynamicParticle if necessary
- Oct 24, 00 H.Kurashige(decay-V02-00-01)
- Bug fix in G4Decay::DecayIt (no decay if the particle is stable)
+66 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Decay.hh,v 1.4 2000/10/20 11:28:23 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4Decay.hh,v 1.6 2001/02/22 13:29:26 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
@@ -24,7 +24,9 @@
// remove BuildPhysicsTable() 27 Nov. 1997 H.Kurashige
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
// added aPhysicsTable 2 Aug. 1998 H.Kurashige
// PreAssignedDecayTime 18 Jan. 2001 H.Kurashige
// Add External Decayer 23 Feb. 2001 H.Kurashige
//
#ifndef G4Decay_h
#define G4Decay_h 1
@@ -32,6 +34,7 @@
#include "globals.hh"
#include "G4VRestDiscreteProcess.hh"
#include "G4ParticleChangeForDecay.hh"
class G4VExtDecayer;
class G4Decay : public G4VRestDiscreteProcess
{
@@ -93,6 +96,13 @@ class G4Decay : public G4VRestDiscreteProcess
G4ForceCondition* condition
);
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
protected: // With Description
// GetMeanFreePath returns ctau*beta*gamma for decay in flight
// GetMeanLifeTime returns ctau for decay at rest
@@ -105,6 +115,11 @@ class G4Decay : public G4VRestDiscreteProcess
G4ForceCondition* condition
);
public: //With Description
void SetExtDecayer(G4VExtDecayer*);
const G4VExtDecayer* GetExtDecayer() const;
// Set/Get External Decayer
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
@@ -134,17 +149,51 @@ class G4Decay : public G4VRestDiscreteProcess
// ParticleChange for decay process
G4ParticleChangeForDecay fParticleChangeForDecay;
// External Decayer
G4VExtDecayer* pExtDecayer;
};
inline G4double G4Decay::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
{
// pre-assigned Decay time
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
if (pTime < 0.) {
// normal case
return G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
}
// condition is set to "Not Forced"
*condition = NotForced;
// reminder proper time
fRemainderLifeTime = pTime - track.GetProperTime();
if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
// use pre-assigned Decay time to determine PIL
G4double tau = track.GetDefinition()->GetPDGLifeTime();
return (fRemainderLifeTime/tau)*GetMeanFreePath(track, previousStepSize, condition);
}
inline
G4double G4Decay::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
)
{
fRemainderLifeTime =
G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
track, condition );
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
if (pTime >= 0.) {
fRemainderLifeTime = pTime - track.GetProperTime();
if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
} else {
fRemainderLifeTime =
G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength(track, condition );
}
return fRemainderLifeTime;
}
@@ -172,6 +221,17 @@ inline
return DecayIt(aTrack, aStep);
}
inline
void G4Decay::SetExtDecayer(G4VExtDecayer* val)
{
pExtDecayer = val;
}
inline
const G4VExtDecayer* G4Decay::GetExtDecayer() const
{
return pExtDecayer;
}
#endif
@@ -0,0 +1,84 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VExtDecayer.hh,v 1.2 2001/02/28 06:18:36 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// New scheme 23 Feb. 2001 H.Kurahige
// ------------------------------------------------------------
//
#ifndef G4VExtDecayer_h
#define G4VExtDecayer_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4DecayProducts.hh"
class G4Track;
class G4VExtDecayer
{
// Class Description
// This class is a Abstract class for external decayer
// G4VExtDecayer has one pure virtual method of
// ImportDecayProducts which return decay products
public: //With Description
// Constructors
G4VExtDecayer(const G4String& name ="");
// Destructor
virtual ~G4VExtDecayer(){}
private:
// copy constructor
G4VExtDecayer(const G4VExtDecayer &){}
// Assignment Operation (generated)
G4VExtDecayer & operator=(const G4VExtDecayer&){return *this;};
public: //With Description
virtual G4DecayProducts* ImportDecayProducts(
const G4Track& aTrack
) = 0;
const G4String& GetName() const;
protected:
G4String decayerName;
};
inline
G4VExtDecayer::G4VExtDecayer(const G4String& name):
decayerName(name)
{
}
inline
const G4String& G4VExtDecayer::GetName() const
{
return decayerName;
}
#endif
+59 -48
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Decay.cc,v 1.7 2000/10/25 00:01:04 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4Decay.cc,v 1.8 2001/02/22 13:29:31 kurasige Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
@@ -27,13 +27,16 @@
// to resonances 12 Dec. 1998 H.Kurashige
// remove G4ParticleMomentum 6 Feb. 99 H.Kurashige
// modified IsApplicable to activate G4Decay for resonances 1 Mar. 00 H.Kurashige
// Add External Decayer 23 Feb. 2001 H.Kurashige
//
#include "G4Decay.hh"
#include "G4DynamicParticle.hh"
#include "G4DecayProducts.hh"
#include "G4DecayTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleChangeForDecay.hh"
#include "G4VExtDecayer.hh"
// constructor
G4Decay::G4Decay(const G4String& processName)
@@ -41,23 +44,27 @@ G4Decay::G4Decay(const G4String& processName)
HighestBinValue(10.0),
LowestBinValue(1.0e-3),
TotBin(200),
verboseLevel(1)
verboseLevel(1),
pExtDecayer(0),
aPhysicsTable(0)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay constructor " << " Name:" << processName << G4endl;
}
#endif
aPhysicsTable = NULL;
pParticleChange = &fParticleChangeForDecay;
}
G4Decay::~G4Decay()
{
if (aPhysicsTable != NULL) {
if (aPhysicsTable != 0) {
aPhysicsTable->clearAndDestroy();
delete aPhysicsTable;
}
if (pExtDecayer) {
delete pExtDecayer;
}
}
G4bool G4Decay::IsApplicable(const G4ParticleDefinition& aParticleType)
@@ -236,62 +243,65 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
//check if thePreAssignedDecayProducts exists
const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
G4bool isPreAssigned = (o_products != NULL);
G4DecayProducts* products = NULL;
G4bool isPreAssigned = (o_products != 0);
G4DecayProducts* products = 0;
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
// check if external decayer exists
G4bool isExtDecayer = (decaytable == 0) && (pExtDecayer !=0);
// Error due to NO Decay Table
if ( (decaytable == 0) && !isExtDecayer &&!isPreAssigned ){
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4Decay::DoIt : decay table not defined for ";
G4cerr << aParticle->GetDefinition()->GetParticleName()<< G4endl;
}
#endif
fParticleChangeForDecay.SetNumberOfSecondaries(0);
// Kill the parent particle
fParticleChangeForDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForDecay.SetLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
}
if (isPreAssigned) {
// copy decay products
products = new G4DecayProducts(*o_products);
} else if ( isExtDecayer ) {
// decay according to external decayer
products = pExtDecayer->ImportDecayProducts(aTrack);
} else {
// decay acoording to decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable == NULL){
// choose a decay channel
G4VDecayChannel *decaychannel = decaytable->SelectADecayChannel();
if (decaychannel == 0 ){
// decay channel not found
G4Exception("G4Decay::DoIt : can not determine decay channel ");
} else {
G4int temp;
// execute DecayIt()
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4Decay::DoIt : decay table not defined for ";
G4cerr << aParticle->GetDefinition()->GetParticleName()<< G4endl;
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl;
temp = decaychannel->GetVerboseLevel();
decaychannel->SetVerboseLevel(GetVerboseLevel());
}
#endif
fParticleChangeForDecay.SetNumberOfSecondaries(0);
// Kill the parent particle
fParticleChangeForDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForDecay.SetLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
} else {
// choose a decay channel
G4VDecayChannel *decaychannel = decaytable->SelectADecayChannel();
if (decaychannel == NULL){
// decay channel not found
products = decaychannel->DecayIt(aParticle->GetMass());
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4Decay::DoIt : can not determine decay channel " <<G4endl;
decaytable ->DumpInfo();
}
#endif
} else {
G4int temp;
// execute DecayIt()
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl;
temp = decaychannel->GetVerboseLevel();
decaychannel->SetVerboseLevel(GetVerboseLevel());
}
#endif
products = decaychannel->DecayIt(aParticle->GetMass());
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
decaychannel->SetVerboseLevel(temp);
}
if (GetVerboseLevel()>1) {
decaychannel->SetVerboseLevel(temp);
}
#endif
#ifdef G4VERBOSE
// for debug
//if (! products->IsChecked() ) products->DumpInfo();
#endif
}
}
}
@@ -306,9 +316,10 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// AtRest case
finalGlobalTime += fRemainderLifeTime;
energyDeposit += aParticle->GetKineticEnergy();
if (isPreAssigned) products->Boost( ParentEnergy, ParentDirection);
} else {
// PostStep case
products->Boost( ParentEnergy, ParentDirection);
if (!isExtDecayer) products->Boost( ParentEnergy, ParentDirection);
}
//add products in fParticleChangeForDecay
@@ -341,7 +352,7 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
}
if (!isPreAssigned) delete products;
delete products;
// Kill the parent particle
fParticleChangeForDecay.SetStatusChange( fStopAndKill ) ;