Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:10:59 gunter Exp $
# $Id: GNUmakefile,v 1.2 2004/09/21 21:46:08 gum Exp $
# --------------------------------------------------------------
# GNUmakefile for processes/decay library. G.Folger 9/12/97
# --------------------------------------------------------------
@@ -15,6 +15,7 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/geometry/magneticfield/include \
+23 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.13 2004/05/08 15:30:19 kurasige Exp $
$Id: History,v 1.21 2004/12/10 18:23:55 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,28 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- Dec. 10, 04 G.Cosmo (decay-V06-02-05)
- replaced M_PI with CLHEP's pi.
- Dec. 2, 04 H.Kurashige (decay-V06-02-04)
- migration to cmath
- Oct 19, 04 H.Kurashige (decay-V06-02-03)
- Modify G4UnknownDecay for migration of ParticleChange
- Sep 17, 04 P. Gumplinger (decay-V06-02-02)
- Add G4DecayWithSpin class and allow for dependency to
/geometry/navigation in GNUmakefile
- Fixed the problem of determination of particle's decay time
for the case the particle stops due to energy loss.
- Aug. 10, 04 H.Kurashige(decay-V06-02-01)
- Add G4Decay::GetRemainderLifeTime method
- Jul. 07, 04 M.Asai (decay-V06-02-00)
- Introducing G4UnknownDecay
- May. 08, 04 H.Kurashige(decay-V06-01-00)
- Change method name for ParticleChange
+24 -58
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Decay.hh,v 1.9 2004/03/12 04:46:31 kurasige Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4Decay.hh,v 1.13 2004/12/02 07:06:30 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// ------------------------------------------------------------
@@ -43,7 +43,8 @@
// Remove PhysicsTable 12 Feb. 2002 H.Kurashige
// Fixed bug in PostStepGPIL
// in case of stopping during AlongStepDoIt 12 Mar. 2004 H.Kurashige
//
// Add GetRemainderLifeTime 10 Aug/2004 H.Kurashige
#ifndef G4Decay_h
#define G4Decay_h 1
@@ -90,7 +91,7 @@ class G4Decay : public G4VRestDiscreteProcess
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// In G4Decay, thePhysicsTable stores values of
// beta * sqrt( 1 - beta*beta)
// beta * std::sqrt( 1 - beta*beta)
// as a function of normalized kinetic enregy (=Ekin/mass),
// becasuse this table is universal for all particle types,
@@ -119,7 +120,6 @@ class G4Decay : public G4VRestDiscreteProcess
G4ForceCondition* condition
);
protected: // With Description
// GetMeanFreePath returns ctau*beta*gamma for decay in flight
// GetMeanLifeTime returns ctau for decay at rest
@@ -132,29 +132,37 @@ class G4Decay : public G4VRestDiscreteProcess
G4ForceCondition* condition
);
public: //With Description
public: //With Description
virtual void StartTracking();
virtual void EndTracking();
// inform Start/End of tracking for each track to the physics process
public: //With Description
void SetExtDecayer(G4VExtDecayer*);
const G4VExtDecayer* GetExtDecayer() const;
// Set/Get External Decayer
G4double GetRemainderLifeTime() const;
//Get Remainder of life time at rest decay
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
private:
protected:
G4int verboseLevel;
// controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
private:
protected:
// HighestValue.
const G4double HighestValue;
// Remainder of life time at rest
G4double fRemainderLifeTime;
// ParticleChange for decay process
G4ParticleChangeForDecay fParticleChangeForDecay;
@@ -162,54 +170,6 @@ class G4Decay : public G4VRestDiscreteProcess
G4VExtDecayer* pExtDecayer;
};
inline
G4double G4Decay::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
{
// reset fRemainderLifeTime
fRemainderLifeTime = 0.0;
// pre-assigned Decay time
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
if (pTime < 0.) {
// normal case
fRemainderLifeTime = 0.0;
return G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
}
// condition is set to "Not Forced"
*condition = NotForced;
// reminder proper time
G4double remainder = pTime - track.GetProperTime();
if (remainder <= 0.0) remainder = DBL_MIN;
// use pre-assigned Decay time to determine PIL
G4double tau = track.GetDefinition()->GetPDGLifeTime();
return (remainder/tau)*GetMeanFreePath(track, previousStepSize, condition);
}
inline
G4double G4Decay::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* 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;
}
inline
void G4Decay::SetVerboseLevel(G4int value){ verboseLevel = value; }
@@ -246,6 +206,12 @@ inline
return pExtDecayer;
}
inline
G4double G4Decay::GetRemainderLifeTime() const
{
return fRemainderLifeTime;
}
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History:
// 17 August 2004 P. Gumplinger, T. MacPhail
// ------------------------------------------------------------
//
#ifndef G4DecayWithSpin_h
#define G4DecayWithSpin_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4VRestDiscreteProcess.hh"
#include "G4ParticleChangeForDecay.hh"
#include "G4Decay.hh"
class G4VExtDecayer;
class G4DecayWithSpin : public G4Decay
{
public:
// Constructors
G4DecayWithSpin(const G4String& processName ="DecayWithSpin");
// Destructor
virtual ~G4DecayWithSpin();
protected: // With Description
virtual G4VParticleChange* DecayIt(
const G4Track& aTrack,
const G4Step& aStep
);
// The DecayIt() method returns by pointer a particle-change object,
// which has information of daughter particles.
private:
G4ThreeVector Spin_Precession(const G4Step& aStep,
G4ThreeVector B, G4double deltatime );
};
#endif
@@ -0,0 +1,171 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4UnknownDecay.hh,v 1.2 2004/12/02 07:06:30 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
#ifndef G4UnknownDecay_h
#define G4UnknownDecay_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4ParticleChangeForDecay.hh"
class G4UnknownDecay : public G4VDiscreteProcess
{
// Class Description
// This class is a decay process for "unknown" particle.
public:
// Constructors
G4UnknownDecay(const G4String& processName ="UnknownDecay");
// Destructor
virtual ~G4UnknownDecay();
private:
// copy constructor
G4UnknownDecay(const G4UnknownDecay &right);
// Assignment Operation (generated)
G4UnknownDecay & operator=(const G4UnknownDecay &right);
public: //With Description
virtual G4VParticleChange *PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// In G4UnknownDecay, thePhysicsTable stores values of
// beta * std::sqrt( 1 - beta*beta)
// as a function of normalized kinetic enregy (=Ekin/mass),
// becasuse this table is universal for all particle types,
virtual G4bool IsApplicable(const G4ParticleDefinition&);
// returns "true" if the decay process can be applied to
// the particle type.
protected: // With Description
virtual G4VParticleChange* DecayIt(
const G4Track& aTrack,
const G4Step& aStep
);
// The DecayIt() method returns by pointer a particle-change object,
// which has information of daughter particles.
public:
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
protected: // With Description
// GetMeanFreePath returns ctau*beta*gamma for decay in flight
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
);
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
private:
G4int verboseLevel;
// controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
private:
// HighestValue.
const G4double HighestValue;
// ParticleChange for decay process
G4ParticleChangeForDecay fParticleChangeForDecay;
};
inline
G4double G4UnknownDecay::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double /*previousStepSize*/,
G4ForceCondition* condition
)
{
// pre-assigned UnknownDecay time
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
if (pTime < 0.) pTime = DBL_MIN;
// condition is set to "Not Forced"
*condition = NotForced;
// reminder proper time
G4double remainder = pTime - track.GetProperTime();
if (remainder <= 0.0) remainder = DBL_MIN;
// use pre-assigned Decay time to determine PIL
//return GetMeanFreePath(track, previousStepSize, condition);
return remainder*c_light;
}
inline
void G4UnknownDecay::SetVerboseLevel(G4int value){ verboseLevel = value; }
inline
G4int G4UnknownDecay::GetVerboseLevel() const { return verboseLevel; }
inline
G4VParticleChange* G4UnknownDecay::PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
)
{
return DecayIt(aTrack, aStep);
}
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4VExtDecayer.hh,v 1.3 2001/07/11 10:02:27 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// ------------------------------------------------------------
+97 -21
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Decay.cc,v 1.18 2004/05/08 15:30:19 kurasige Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4Decay.cc,v 1.19 2004/08/13 08:17:00 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------
@@ -87,14 +87,14 @@ G4bool G4Decay::IsApplicable(const G4ParticleDefinition& aParticleType)
}
}
G4double G4Decay::GetMeanLifeTime(const G4Track& aTrack,
G4double G4Decay::GetMeanLifeTime(const G4Track& aTrack ,
G4ForceCondition*)
{
// get particle type
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
// returns the mean free path in GEANT4 internal units
G4double meanlife;
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
G4double aLife = aParticleDef->GetPDGLifeTime();
@@ -102,9 +102,6 @@ G4double G4Decay::GetMeanLifeTime(const G4Track& aTrack,
if (aParticleDef->GetPDGStable()) {
meanlife = DBL_MAX;
} else if (aLife < 0.0) {
meanlife = DBL_MAX;
} else {
meanlife = aLife;
}
@@ -122,28 +119,23 @@ G4double G4Decay::GetMeanFreePath(const G4Track& aTrack,G4double, G4ForceConditi
{
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
// returns the mean free path in GEANT4 internal units
G4double pathlength;
G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
G4double aCtau = c_light * aParticleDef->GetPDGLifeTime();
G4double aMass = aParticle->GetMass();
G4double aLife = aParticleDef->GetPDGLifeTime();
// returns the mean free path in GEANT4 internal units
G4double pathlength;
G4double aCtau = c_light * aLife;
// check if the particle is stable?
if (aParticleDef->GetPDGStable()) {
pathlength = DBL_MAX;
} else if (aCtau < 0.0) {
pathlength = DBL_MAX;
//check if the particle has very short life time ?
} else if (aCtau < DBL_MIN) {
pathlength = DBL_MIN;
//check if zero mass
} else if (aMass < DBL_MIN) {
pathlength = DBL_MAX;
} else {
//calculate the mean free path
// by using normalized kinetic energy (= Ekin/mass)
@@ -310,14 +302,98 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit);
fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
// reset NumberOfInteractionLengthLeft
// Clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
}
void G4Decay::StartTracking()
{
currentInteractionLength = -1.0;
ResetNumberOfInteractionLengthLeft();
fRemainderLifeTime = -1.0;
}
void G4Decay::EndTracking()
{
// Clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
currentInteractionLength = -1.0;
}
G4double G4Decay::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
// pre-assigned Decay time
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
G4double aLife = track.GetDynamicParticle()->GetDefinition()->GetPDGLifeTime();
if (pTime < 0.) {
// normal case
if ( previousStepSize > 0.0){
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft<0.){
theNumberOfInteractionLengthLeft=perMillion;
}
fRemainderLifeTime = theNumberOfInteractionLengthLeft*aLife;
}
// get mean free path
currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
#ifdef G4VERBOSE
if ((currentInteractionLength <=0.0) || (verboseLevel>2)){
G4cout << "G4Decay::PostStepGetPhysicalInteractionLength " << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<G4endl;
}
#endif
G4double value;
if (currentInteractionLength <DBL_MAX) {
value = theNumberOfInteractionLengthLeft * currentInteractionLength;
} else {
value = DBL_MAX;
}
return value;
} else {
//pre-assigned Decay time case
// reminder proper time
fRemainderLifeTime = pTime - track.GetProperTime();
if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
// use pre-assigned Decay time to determine PIL
return (fRemainderLifeTime/aLife)*GetMeanFreePath(track, previousStepSize, condition);
}
}
G4double G4Decay::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
)
{
G4double pTime = track.GetDynamicParticle()->GetPreAssignedDecayProperTime();
if (pTime >= 0.) {
fRemainderLifeTime = pTime - track.GetProperTime();
if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
} else {
fRemainderLifeTime =
theNumberOfInteractionLengthLeft * GetMeanLifeTime(track, condition);
}
return fRemainderLifeTime;
}
@@ -0,0 +1,171 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History:
// 17 August 2004 P. Gumplinger, T. MacPhail
// ------------------------------------------------------------
//
#include "G4DecayWithSpin.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4DecayTable.hh"
#include "G4MuonDecayChannelWithSpin.hh"
#include "G4Vector3D.hh"
#include "G4TransportationManager.hh"
#include "G4PropagatorInField.hh"
#include "G4FieldManager.hh"
#include "G4Field.hh"
#include "G4Transform3D.hh"
G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processName){}
G4DecayWithSpin::~G4DecayWithSpin(){}
G4VParticleChange* G4DecayWithSpin::DecayIt(const G4Track& aTrack, const G4Step& aStep)
{
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
// get parent_polarization
G4ThreeVector parent_polarization = aParticle->GetPolarization();
if(parent_polarization == G4ThreeVector(0,0,0))
{
// Generate random polarization direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
G4double phi = twopi*G4UniformRand();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4double px = sint*cosp;
G4double py = sint*sinp;
G4double pz = cost;
parent_polarization.setX(px);
parent_polarization.setY(py);
parent_polarization.setZ(pz);
}else{
G4FieldManager* fieldMgr = aStep.GetTrack()->GetVolume()->
GetLogicalVolume()->GetFieldManager();
if (!fieldMgr) {
G4TransportationManager *transportMgr =
G4TransportationManager::GetTransportationManager();
G4PropagatorInField* fFieldPropagator =
transportMgr->GetPropagatorInField();
if (fFieldPropagator) fieldMgr =
fFieldPropagator->GetCurrentFieldManager();
}
const G4Field* field = NULL;
if(fieldMgr)field = fieldMgr->GetDetectorField();
if (field && !(fieldMgr->DoesFieldChangeEnergy())) {
G4double point[4];
point[0] = (aStep.GetPostStepPoint()->GetPosition())[0];
point[1] = (aStep.GetPostStepPoint()->GetPosition())[1];
point[2] = (aStep.GetPostStepPoint()->GetPosition())[2];
point[3] = aTrack.GetGlobalTime();
G4double fieldValue[3];
field -> GetFieldValue(point,fieldValue);
G4ThreeVector B(fieldValue[0],fieldValue[1],fieldValue[2]);
parent_polarization = Spin_Precession(aStep,B,fRemainderLifeTime);
}
}
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable) {
G4MuonDecayChannelWithSpin *decaychannel;
decaychannel = (G4MuonDecayChannelWithSpin*)decaytable->SelectADecayChannel();
if (decaychannel) decaychannel->SetPolarization(parent_polarization);
}
G4ParticleChangeForDecay* pParticleChangeForDecay;
pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
pParticleChangeForDecay->ProposePolarization(parent_polarization);
return pParticleChangeForDecay;
}
G4ThreeVector G4DecayWithSpin::Spin_Precession( const G4Step& aStep,
G4ThreeVector B, G4double deltatime )
{
G4double Bnorm = std::sqrt(sqr(B[0]) + sqr(B[1]) +sqr(B[2]) );
G4double q = aStep.GetTrack()->GetDefinition()->GetPDGCharge();
G4double a = 1.165922e-3;
G4double s_omega = 8.5062e+7*rad/(s*kilogauss);
G4double omega = -(q*s_omega)*(1.+a) * Bnorm;
G4double rotationangle = deltatime * omega;
G4Transform3D SpinRotation = G4Rotate3D(rotationangle,B.unit());
G4Vector3D Spin = aStep.GetTrack() -> GetPolarization();
G4Vector3D newSpin = SpinRotation * Spin;
#ifdef G4VERBOSE
// G4double normspin = std::sqrt(Spin*Spin);
// G4double normnewspin = std::sqrt(newSpin*newSpin);
// G4double cosalpha = Spin*newSpin/normspin/normnewspin;
// G4double alpha = std::acos(cosalpha);
// G4cout<< "AT REST::: PARAMETERS\n"
// << "Initial spin : " << Spin <<"\n"
// << "Delta time : " << deltatime <<"\n"
// << "Rotation angle: " << rotationangle/rad <<"\n"
// << "New spin : " << newSpin <<"\n"
// << "Checked norms : " << normspin <<" " << normnewspin <<" \n"
// << G4endl;
#endif
return newSpin;
}
@@ -0,0 +1,186 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4UnknownDecay.cc,v 1.2 2004/10/19 00:56:34 kurasige Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// ------------------------------------------------------------
//
#include "G4UnknownDecay.hh"
#include "G4DynamicParticle.hh"
#include "G4DecayProducts.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleChangeForDecay.hh"
// constructor
G4UnknownDecay::G4UnknownDecay(const G4String& processName)
:G4VDiscreteProcess(processName, fDecay),
verboseLevel(1),
HighestValue(20.0)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
}
#endif
pParticleChange = &fParticleChangeForDecay;
}
G4UnknownDecay::~G4UnknownDecay()
{
}
G4bool G4UnknownDecay::IsApplicable(const G4ParticleDefinition& aParticleType)
{
if(aParticleType.GetParticleName()=="unknown") return true;
return false;
}
G4double G4UnknownDecay::GetMeanFreePath(const G4Track& /*aTrack*/,G4double, G4ForceCondition*)
{
// // get particle
// const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
//
// // returns the mean free path in GEANT4 internal units
// G4double pathlength;
// G4double pTime = aParticle->GetPreAssignedDecayProperTime();
// if(pTime<0.) pTime = DBL_MIN;
// G4double aCtau = c_light * pTime;
// G4double aMass = aParticle->GetMass();
//
// G4double rKineticEnergy = aParticle->GetKineticEnergy()/aMass;
// if ( rKineticEnergy > HighestValue) {
// // gamma >> 1
// pathlength = ( rKineticEnergy + 1.0)* aCtau;
// } else if ( rKineticEnergy < DBL_MIN ) {
// // too slow particle
// pathlength = DBL_MIN;
// } else {
// pathlength = (aParticle->GetTotalMomentum())/aMass*aCtau ;
// }
// return pathlength;
return DBL_MIN;
}
void G4UnknownDecay::BuildPhysicsTable(const G4ParticleDefinition&)
{
return;
}
G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step& )
{
// The DecayIt() method returns by pointer a particle-change object.
// Units are expressed in GEANT4 internal units.
// Initialize ParticleChange
// all members of G4VParticleChange are set to equal to
// corresponding member in G4Track
fParticleChangeForDecay.Initialize(aTrack);
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
//check if thePreAssignedDecayProducts exists
const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
G4bool isPreAssigned = (o_products != 0);
G4DecayProducts* products = 0;
if (!isPreAssigned ){
fParticleChangeForDecay.SetNumberOfSecondaries(0);
// Kill the parent particle
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
}
// copy decay products
products = new G4DecayProducts(*o_products);
// get parent particle information ...................................
G4double ParentEnergy = aParticle->GetTotalEnergy();
G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
G4double energyDeposit = 0.0;
G4double finalGlobalTime = aTrack.GetGlobalTime();
//boost all decay products to laboratory frame
//if the particle has traveled
if(aParticle->GetPreAssignedDecayProperTime()>0.) {
products->Boost( ParentEnergy, ParentDirection);
}
//add products in fParticleChangeForDecay
G4int numberOfSecondaries = products->entries();
fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4UnknownDecay::DoIt : Decay vertex :";
G4cerr << " Time: " << finalGlobalTime/ns << "[ns]";
G4cerr << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
G4cerr << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
G4cerr << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
G4cerr << G4endl;
G4cerr << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl;
products->DumpInfo();
}
#endif
G4int index;
G4ThreeVector currentPosition;
const G4TouchableHandle thand = aTrack.GetTouchableHandle();
for (index=0; index < numberOfSecondaries; index++)
{
// get current position of the track
currentPosition = aTrack.GetPosition();
// create a new track object
G4Track* secondary = new G4Track( products->PopProducts(),
finalGlobalTime ,
currentPosition );
// switch on good for tracking flag
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(thand);
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
}
delete products;
// Kill the parent particle
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit);
fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
// reset NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
}