Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# $Id: GNUmakefile,v 2.1 1998/08/22 01:33:47 gcosmo Exp $
# ----------------------------------------------------------
# GNUmakefile for track library. Gabriele Cosmo, 3/4/1997.
# ----------------------------------------------------------
name := G4track
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)/processes/management/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include
include $(G4INSTALL)/config/common.gmk
.PHONY: global
global: lib
+121
View File
@@ -0,0 +1,121 @@
$Id: History,v 2.13 1998/12/15 13:45:31 kurasige 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 *
----------------------------------------------------------
December 15, 1998 H.Kurashige (track-00-04-05)
- G4ParticleChange::CheckIt is activated in VERBOSE mode (Hisaya)
December 12, 1998 H.Kurashige (track-00-04-04)
- Fixed bugs in G4Mars5GeVMechanism (Hisaya)
- Added SwOnAllEB/SwOffAllEB in G4ParticleChange (Hisaya)
- Added GetEBMechanis and IsEBActive in G4VParticleChange (Hisaya)
December 11, 1998 H.Kurashige (track-00-04-03)
- Fixed bugs in G4Mars5GeVMechanism (Hisaya)
December 9, 1998 L.Urban (track-00-04-02)
- Added G4ParticleChangeForLoss and G4ParticleChangeForMSC.
November 18, 98 H.Kurashige (track-00-04-01)A
- Added new member of weight in G4Track and removed G4BiasingTag
- Added Event Biasing based on MARS
- Modified argument type in G4Track
( this tag requires particles-00-04-01 tag)
November 9, 98 H.Kurashige (track-00-03-05)
- Added Event Biasing Mechanism in G4VParticleChange
November 8, 98 H.Kurashige (track-00-03-04)
- Added G4BiasingTag as a member of G4Track
- Modified G4Step, and G4StepPoint for managing G4BiasingTag
Octorber 17, 98 H.Kurashige (track-00-03-03)
- Fixed bugs in G4VParticleChange and G4ParticleChange
October 14 19 H.Kurashige (track-00-03-01)
- Modified G4ParticleChangeForTransportation for new relocation algorism.
(J.Apost.)
August 31, 98 G.Cosmo (track-00-02-01)
- Added "global" phony target to GNUmakefile.
- Added comment to G4StepPoint.hh (J.Apostolakis).
July 20,98 H.Kurashige (track-00-01-05)
- Modified G4ParticleChangeForDecay
July 10, 98 P.Urban (track-00-01-02)
- Optimised G4ParticleChangeForTransport. Much less data
is copied -> increased performance.
July 1, 98 H.Kurashige (track-00-07-02)
- Moved UpdateStepForAlongStep into G4ParticleChangeForTransport.cc file
June 30, 98 P. Urban (track-00-07-01)
- Some more tracking optimisation results.
June 22, 98 P. Urban (track-00-06-04)
- Preliminary results of tracking optimisation merged into HEAD.
June 11, 98 G.Cosmo (track-00-06-03)
- Tagged track-00-06-03.
June 11, 98 J.Allison
- Added a missing inline keyword to G4Track.hh:341.
June 8, 98 H.Kurashige
- Add GoodForTracking and BelowThreshold flags in G4Track
for new COHERENT scheme for the Cuts
May 12, 98 H.Kurashige
- Fix bugs in G4Step, G4ParticleChange
Add new class of G4ParticleChangeForTransport
April 12, 98 H.Kuraashige
Implement new scheme of 'Particle Change'. Please see
particle_change.asc in geant4alpha/documents/particles+matter/.
Following files are modified (or added)
G4ParticleChange.hh, .icc, .cc
G4VParticleChange.hh, .icc, .cc
G4ParticleChangeForDecay.hh, .cc
G4Step.hh, G4TrackFastVector.hh
April 9, 98 G.Cosmo
- Porting on DEC-cxx 6.0.
Removed meaningless usage of "const" qualifier from functions
return type for basic types by value. Modified files:
G4ParticleChange.hh, .icc,
G4Step.hh, G4StepPoint.hh, G4Track.hh
March 18, 1998 K. Amako
Add following information to G4Track:
1.Momentum direction at the start point (vertex position) of the track
2.Kinetic energy at the start point (vertex position) of the track
3.Pointer to the process which created the current track
Due to this, the following files have modififed and committed.
1.NewDesignDoc.txt
2.G4Track.hh, G4Track.cc
3.G4SteppingManager.cc
January 29, 97 K. Amako
Following changes have been done and committed/tagged to cvs.
Tag# is track-00-03-01.
- G4Step.cc: Output format has been changed in showStep().
December 19, 97 G. Cosmo - (alpha03)
- Created.
@@ -0,0 +1,64 @@
// This code implementation is the intellectual property of
// the RD44 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: G4EvtBiasMechanism.hh,v 2.2 1998/11/18 11:06:26 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// This is a simple example for Event Biasing
#ifndef G4EvtBiasMechanism_h
#define G4EvtBiasMechanism_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4VEvtBiasMechanism.hh"
class G4VParticleChange;
class G4EvtBiasMechanism :public G4VEvtBiasMechanism
{
public:
G4EvtBiasMechanism(const G4String& name = "EBSample", G4int mulFactor=10);
G4EvtBiasMechanism(const G4EvtBiasMechanism&);
~G4EvtBiasMechanism();
virtual G4VParticleChange* ApplyMath( G4VParticleChange*, const G4Step& );
void SetParticleBiased( G4ParticleDefinition* );
G4ParticleDefinition* GetParticleBiased( ) const;
virtual G4bool IsApplicable(G4ParticleDefinition*) const;
private:
G4ParticleDefinition* particleToBeBiased;
const G4int MultiplicationForSecondaries;
};
inline G4bool G4EvtBiasMechanism::IsApplicable(G4ParticleDefinition* particle) const
{
return (particle == particleToBeBiased);
}
inline void G4EvtBiasMechanism::SetParticleBiased(G4ParticleDefinition* particle)
{
particleToBeBiased = particle;
}
inline G4ParticleDefinition* G4EvtBiasMechanism::GetParticleBiased() const
{
return particleToBeBiased;
}
#endif
+48
View File
@@ -0,0 +1,48 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ForceCondition.hh,v 2.1 1998/07/12 03:08:43 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4ForceCondition
//
// Description:
// This enumaration specifies possible conditions the three
// types of DoIt can be assinged by physics processes.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4ForceCondition_h
#define G4ForceCondition_h 1
/////////////////////
enum G4ForceCondition
/////////////////////
{
Forced,
// This PostStepDoIt is forced to invoke.
NotForced,
// This PostStepDoIt is not forced to invoke.
Conditionally,
// This PostStepDoIt is forced to invoke only when corresponding
// AlongStepDoIt limits the Step.
ExclusivelyForced
// Only this PostStepDoIt (or AtRestDoIt) is exclusively forced
// to invoke - all other DoIt including AlongStepDoIts are ignored.
};
#endif
+47
View File
@@ -0,0 +1,47 @@
// This code implementation is the intellectual property of
// the RD44 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: G4GPILSelection.hh,v 2.1 1998/07/12 03:08:43 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4GPILSelection
//
// Description:
// This enumaration is used to control whether a AlongStepProcess
// can be a winner of the GPIL race or not.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4GPILSelection_h
#define G4GPILSelection_h 1
/////////////////////
enum G4GPILSelection
/////////////////////
{
CandidateForSelection,
// This AlongStep process partecipates in the process selection
// mechanism, i.e. it can be the winner of the GPIL race.
// (this case is default)
NotCandidateForSelection
// This AlongStep process does not partecipate in the
// process selection mechanism even when it limits the Step.
};
#endif
+295
View File
@@ -0,0 +1,295 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Mars5GeVMechanism.hh,v 2.3 1998/12/11 20:52:56 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// First Implemention 17 Nov. 1998 M.Asai, H.Kurahige
//
// ------------------------------------------------------------
// This is a Event Biasing mechanism based on MARS code
// This model is applicable to
// proton/neutron/pi+-/K+-/gamma/anti_proton
// with energy < 5.0GeV
//
// Original code is MARS13 written by Nikolai Mokhov (FNAL)
//**************************************************************
//* MARS13: 9. hA EVENT GENERATOR:
//* Copyright Nikolai Mokhov (Fermilab)
//*
//* LAST CHANGE: 14-NOV-1998
//**************************************************************
//* Copyright Nikolai Mokhov (Fermilab)
//*
//* MARS13(98)
//*
//* INCLUSIVE HADRON(photon)-NUCLEUS VERTEX AT E < 5 GEV !!!
//* THREE WEIGHTED HADRONS IN FINAL STATE: !!!
//* IP+A -> N/P(CASC)+ PI+/PI-(K+/K-) + PI0
//
#ifndef G4Mars5GeVMechanism_h
#define G4Mars5GeVMechanism_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4VEvtBiasMechanism.hh"
class G4Material;
class G4DynamicParticle;
class G4VParticleChange;
class G4ParticleTable;
class G4ParticleDefinition;
#include "G4ThreeVector.hh"
#include "G4FastVector.hh"
class G4Mars5GeVMechanism :public G4VEvtBiasMechanism
{
public:
G4Mars5GeVMechanism(const G4String& name = "MARS5GeV");
G4Mars5GeVMechanism(const G4Mars5GeVMechanism&);
~G4Mars5GeVMechanism();
virtual G4VParticleChange* ApplyMath( G4VParticleChange*, const G4Step& );
virtual G4bool IsApplicable(G4ParticleDefinition*) const;
private:
void Treem5();
// This is the mothod which invoke MARS
// secondary information will be filled up
G4bool CoulombBarrier(G4int pType, G4double pE);
// Check if coulomb barrier exists
void CreateNucleon(G4int ib, G4int pType, G4double pE);
void CreatePion(G4int ib, G4int pType, G4double pE);
void CreatePionZero(G4int ib, G4int pType, G4double pE);
// Create secondary particles and add them into the list
void AddSecondary();
// Add a secondary particle into the list
G4double SelBS(G4int pType, G4double aNucl, G4double zNucl);
// Calculate weight of secondary
G4double D2N2(G4int pType, G4double incidentE,
G4double prodE, G4double tin,
G4int reacType, G4int proType,
G4double ai, G4double z);
// Calculate Hadron Inclusive Yield
G4double Rkaon(G4int ib, G4int jp, G4double eRaw);
// Calculate energy dependent K/pi ratio
void Trans(G4ThreeVector* d1, G4ThreeVector* d2);
// Direction cosine transformation using selec2(cs,ss,ch,sh)
public:
enum {FastVectorSize = 16};
typedef G4FastVector<G4DynamicParticle ,FastVectorSize> G4MarsSecondaryVector;
private:
// information of secondary
G4int numberOfSecondaries;
G4double weightOfSecondaries[FastVectorSize];
G4MarsSecondaryVector secondaries;
private:
const G4double EthForIncident;
G4bool IsApplicable(G4int marsEncoding) const;
private:
// Particle Table
G4ParticleTable* theParticleTable;
// particle encoding for MARS
enum { MarsUndefined =0,
MarsP, MarsN, MarsPIplus, MarsPIminus, MarsKplus, MarsKminus,
MarsMUplus, MarsMUminus, MarsGAM, MarsEminus, MarsEplus, MarsAP,
MarsPI0, MarsD, MarsT, MarsHe3, MarsHe4 };
G4int GetMarsEncoding(G4ParticleDefinition* )const;
const G4String& GetParticleName(G4int marsEncoding) const;
G4ParticleDefinition* GetParticleDefinition(G4int marsEncoding) const;
G4double ProtonMass;
private:
// incident information
G4double incidentWeight;
const G4DynamicParticle* incidentParticle;
G4int incidentMarsEncoding;
void GetTargetNuclei(const G4Material*); //fill up fANucle and fZnucl
G4double fANucl, fZNucl; // target nucleus
private:
// these class is to define common blocks in original code
class Selec1
{
public:
G4double Einc, EN, V, V10;
G4int Treac, Tprod;
} selec1;
class Selec2
{
public:
G4double Cs, Ss, Ch, Sh;
} selec2;
class Selec3
{
public:
G4double Eth, Emax, Sqs, X, Pt2, Pt, P;
} selec3;
};
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
inline
G4int G4Mars5GeVMechanism::GetMarsEncoding(G4ParticleDefinition* particle) const{
const G4String& name = particle->GetParticleName();
G4int encoding = MarsUndefined;
if (name == "proton") {
encoding = MarsP;
} else if (name == "neutron") {
encoding = MarsN;
} else if (name == "pi+") {
encoding = MarsPIplus;
} else if (name == "pi-") {
encoding = MarsPIminus;
} else if (name == "kaon+") {
encoding = MarsKplus;
} else if (name == "kaon-") {
encoding = MarsKminus;
} else if (name == "mu+") {
encoding = MarsMUplus;
} else if (name == "mu-") {
encoding = MarsMUminus;
} else if (name == "gamma") {
encoding = MarsGAM;
} else if (name == "e+") {
encoding = MarsEplus;
} else if (name == "e-") {
encoding = MarsEminus;
} else if (name == "anti_proton") {
encoding = MarsAP;
} else if (name == "pi0") {
encoding = MarsPI0;
} else if (name == "deuteron") {
encoding = MarsD;
} else if (name == "triton") {
encoding = MarsT;
} else if (name == "He3") {
encoding = MarsHe3;
} else if (name == "alpha") {
encoding = MarsHe4;
}
return encoding;
}
inline
const G4String& G4Mars5GeVMechanism::GetParticleName(G4int encoding) const
{
static G4String name;
name = "None";
switch (encoding)
{
case MarsP:
name = "proton";
break;
case MarsN:
name = "neutron";
break;
case MarsPIplus:
name = "pi+";
break;
case MarsPIminus:
name = "pi-";
break;
case MarsKplus:
name = "kaon+";
break;
case MarsKminus:
name = "kaon-";
break;
case MarsMUplus:
name = "mu+";
break;
case MarsMUminus:
name = "mu-";
break;
case MarsGAM:
name = "gamma";
break;
case MarsEplus:
name = "e+";
break;
case MarsEminus:
name = "e-";
break;
case MarsAP:
name = "anti_proton";
break;
case MarsPI0:
name = "pi0";
break;
case MarsD:
name = "deuteron";
break;
case MarsT:
name = "triton";
break;
case MarsHe3:
name = "He3";
break;
case MarsHe4:
name = "alpha";
break;
default:
break;
}
return name;
}
inline
G4ParticleDefinition* G4Mars5GeVMechanism::GetParticleDefinition(G4int encoding) const
{
G4String name = GetParticleName(encoding);
G4ParticleDefinition* particle = NULL;
if (name != "None") {
particle = theParticleTable->FindParticle(name);
}
return particle;
}
inline
G4bool G4Mars5GeVMechanism::IsApplicable(G4int marsEncoding) const
{
return ( ((marsEncoding!=MarsUndefined) && (marsEncoding<=MarsKminus) )||
(marsEncoding==MarsGAM) ||
(marsEncoding==MarsAP) );
}
inline
G4bool G4Mars5GeVMechanism::IsApplicable(G4ParticleDefinition* particle) const
{
return IsApplicable(GetMarsEncoding(particle));
}
#endif
+238
View File
@@ -0,0 +1,238 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChange.hh,v 2.6 1998/12/11 22:18:58 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
//
// This class is a concrete class for ParticleChange which
// has all functionality in old scheme.
//
// This class contains the results after invocation of a physics process.
// This includes final states of parent particle (momentum, energy,
// etc) and secondary particles generated by the interaction.
// The tracking assumes that all the values of energy and
// momentum are in global reference system, therefore all the
// needed Lorentz transformations must have been already Done
// when filling the data-members of this class.
//
// ---------------------------------------------------------------
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, Momentum, etc.
// ------------------------------------------------------------
// modify AddSecondary methods for "GoodForTracking" flag
// 8 June 1998 H.Kurashige
// Add Track weight 12 Nov. 1998 H.Kurashige
// -------------------------------------------------------------
#ifndef G4ParticleChange_h
#define G4ParticleChange_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
class G4ParticleChange: public G4VParticleChange
{
public:
// default constructor
G4ParticleChange();
G4ParticleChange(G4bool useEB);
// destructor
virtual ~G4ParticleChange();
protected:
// hide copy constructor and assignment operaor as protected
G4ParticleChange(const G4ParticleChange &right);
G4ParticleChange & operator=(const G4ParticleChange &right);
public:
// equal/unequal operator
G4bool operator==(const G4ParticleChange &right) const;
G4bool operator!=(const G4ParticleChange &right) const;
public:
// ----------------------------------------------------
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a physics
// process
virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
// A physics process gives the final state of the particle
// relative to the initial state at the beginning of the Step,
// i.e., based on information of G4Track (or equivalently
// the PreStepPoint)
// In this method, the differences (delta) between these two states
// are calculated, and are accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMometum. Also it is a normalized
// momentum vector.
virtual G4Step* UpdateStepForAtRest(G4Step* Step);
virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// A physics process gives the final state of the particle
// based on information of G4Track (or equivalently the PreStepPoint)
virtual void Initialize(const G4Track&);
// Initialize all propoerties by using G4Track information
protected:
G4Step* UpdateStepInfo(G4Step* Step);
// Update the G4Step specific attributes
// (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength)
public:
// ----------------------------------------------------
//--- methods to keep information of the final state--
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, Momentum, etc.
const G4ParticleMomentum* GetMomentumChange() const;
void SetMomentumChange(G4double Px, G4double Py, G4double Pz);
void SetMomentumChange(const G4ThreeVector& Pfinal);
// Get/Set theMomentumChange vector: it is the final momentum direction.
const G4ThreeVector* GetPolarizationChange() const;
void SetPolarizationChange(G4double Px, G4double Py, G4double Pz);
void SetPolarizationChange(const G4ThreeVector& finalPoralization);
// Get/Set thePolarizationChange vector.
G4double GetEnergyChange() const;
void SetEnergyChange(G4double theEnergyChange);
// Get/Set the final kinetic energy of the current particle.
G4double GetProperTimeChange() const;
void SetProperTimeChange(G4double t);
// Get/Set theProperTimeChange vector
const G4ThreeVector* GetPositionChange() const;
void SetPositionChange(G4double x, G4double y, G4double z);
void SetPositionChange(const G4ThreeVector& finalPosition);
// Get/Set the final position of the current particle.
G4double GetTimeChange() const;
void SetTimeChange(G4double t);
// Get/Set theTimeChange vector.
G4double GetWeightChange() const;
void SetWeightChange(G4double w);
// Get/Set theWeightChange
// these methods are valid if fUseEB is true;
// -- Utility functions --
G4ThreeVector GetGlobalPosition(const G4ThreeVector& displacement) const;
// Convert the position displacement to the global position.
G4double GetGlobalTime(G4double timeDelay) const;
// Convert the time delay to the global time.
G4ThreeVector CalcMomentum(G4double energy,
G4ParticleMomentum direction,
G4double mass ) const;
// Calculate momentum by using Energy, Momentum Direction, and Mass
// ----------------------------------------------------
// ----------------------------------------------------
// --- methods for adding secondaries
void AddSecondary(G4Track* aSecondary);
// Add a secondary particle to theListOfSecondaries.
void AddSecondary(G4DynamicParticle* aSecondary,
G4bool IsGoodForTracking = false );
// Add a secondary particle to theListOfSecondaries.
// position and time are same as thePositionChange and theTimeChange
void AddSecondary(G4DynamicParticle* aSecondary,
G4ThreeVector position,
G4bool IsGoodForTracking = false );
// Add a secondary particle to theListOfSecondaries.
// global time are same as theTimeChange and theTimeChange
void AddSecondary(G4DynamicParticle* aSecondary,
G4double time,
G4bool IsGoodForTracking = false );
// Add a secondary particle to theListOfSecondaries.
// position and are same as thePositionChange
// ----------------------------------------------------
public:
virtual void DumpInfo() const;
protected:
G4ParticleMomentum theMomentumChange;
// It is the vector containing the final momentum direction
// after the invoked process. The application of the change
// of the momentum direction of the particle is not Done here.
// The responsibility to apply the change is up the entity
// which invoked the process.
G4ThreeVector thePolarizationChange;
// The changed (final) polarization of a given track
G4double theEnergyChange;
// The final kinetic energy of the current track
G4ThreeVector thePositionChange;
// The changed (final) position of a given track
G4double theTimeChange;
// The changed (final) global time of a given track
G4double theProperTimeChange;
// The changed (final) proper time of a given track
G4double theWeightChange;
// The Chnanged (final) weight of a given track
public:
// these methods is used for switch on/off EB in all ParticleChange objects
static void SwOnAllEB();
static void SwOffAllEB();
private:
static G4bool fUseEBForAll;
public:
// for Debug
G4bool debugFlag;
G4bool CheckIt(const G4Track&);
};
#include "G4ParticleChange.icc"
#endif
+168
View File
@@ -0,0 +1,168 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChange.icc,v 2.2 1998/12/11 20:52:59 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
inline
G4Step* G4ParticleChange::UpdateStepInfo(G4Step* pStep)
{
// use fUseEBForAll instead of fUseEB
fUseEB = fUseEBForAll;
return G4VParticleChange::UpdateStepInfo(pStep);
}
inline
G4double G4ParticleChange::GetEnergyChange() const
{
return theEnergyChange;
}
inline
void G4ParticleChange::SetEnergyChange(G4double Energy)
{
theEnergyChange = Energy;
}
inline
const G4ParticleMomentum* G4ParticleChange::GetMomentumChange() const
{
return &theMomentumChange;
}
inline
void G4ParticleChange::SetMomentumChange(
G4double Px,
G4double Py,
G4double Pz )
{
theMomentumChange.setX(Px);
theMomentumChange.setY(Py);
theMomentumChange.setZ(Pz);
}
inline
void G4ParticleChange::SetMomentumChange(const G4ThreeVector& P)
{
theMomentumChange = P;
}
inline
const G4ThreeVector* G4ParticleChange::GetPolarizationChange() const
{
return &thePolarizationChange;
}
inline
void G4ParticleChange::SetPolarizationChange( const G4ThreeVector& finalPoralization)
{
thePolarizationChange = finalPoralization;
}
inline
void G4ParticleChange::SetPolarizationChange(
G4double Px,
G4double Py,
G4double Pz )
{
thePolarizationChange.setX(Px);
thePolarizationChange.setY(Py);
thePolarizationChange.setZ(Pz);
}
inline
const G4ThreeVector* G4ParticleChange::GetPositionChange() const
{
return &thePositionChange;
}
inline
G4double G4ParticleChange::GetProperTimeChange() const
{
return theProperTimeChange;
}
inline
void G4ParticleChange::SetProperTimeChange(G4double tau)
{
theProperTimeChange = tau;
}
inline
void G4ParticleChange::SetPositionChange(const G4ThreeVector& finalPosition)
{
thePositionChange= finalPosition;
}
inline
void G4ParticleChange::SetPositionChange(G4double x,G4double y, G4double z)
{
thePositionChange.setX(x);
thePositionChange.setY(y);
thePositionChange.setZ(z);
}
inline
G4ThreeVector G4ParticleChange::GetGlobalPosition(const G4ThreeVector& displacement) const
{
return thePositionChange + displacement;
}
inline
G4double G4ParticleChange::GetGlobalTime(G4double timeDelay) const
{
// Convert the time delay to the global time.
return theTimeChange + timeDelay;
}
inline
G4double G4ParticleChange::GetTimeChange() const
{
return theTimeChange;
}
inline
void G4ParticleChange::SetTimeChange(G4double t)
{
theTimeChange = t;
}
inline
G4double G4ParticleChange::GetWeightChange() const
{
return theWeightChange;
}
inline
void G4ParticleChange::SetWeightChange(G4double w)
{
if(fUseEB) theWeightChange = w;
}
inline
G4ThreeVector G4ParticleChange::CalcMomentum(G4double energy,
G4ParticleMomentum direction,
G4double mass
) const
{
G4double tMomentum = sqrt(energy*energy + 2*energy*mass);
return direction*tMomentum;
}
inline
void G4ParticleChange::SwOnAllEB()
{
fUseEBForAll = true;
}
inline void G4ParticleChange::SwOffAllEB()
{
fUseEBForAll = false;
}
@@ -0,0 +1,114 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForDecay.hh,v 2.2 1998/07/13 17:28:32 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
//
// This class is a concrete class for ParticleChange which
// has functionality for G4Decay.
//
// This class contains the results after invocation of the decay process.
// This includes secondary particles generated by the interaction.
// ------------------------------------------------------------
#ifndef G4ParticleChangeForDecay_h
#define G4ParticleChangeForDecay_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
class G4ParticleChangeForDecay: public G4VParticleChange
{
public:
// default constructor
G4ParticleChangeForDecay();
// destructor
virtual ~G4ParticleChangeForDecay();
protected:
// hide copy constructor and assignment operaor as protected
G4ParticleChangeForDecay(const G4ParticleChangeForDecay &right);
G4ParticleChangeForDecay & operator=(const G4ParticleChangeForDecay &right);
public:
// equal/unequal operator
G4bool operator==(const G4ParticleChangeForDecay &right) const;
G4bool operator!=(const G4ParticleChangeForDecay &right) const;
public:
// ----------------------------------------------------
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a physics
// process
// !!! No effect for AlongStep
// virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
virtual G4Step* UpdateStepForAtRest(G4Step* Step);
virtual G4Step* UpdateStepForPostStep(G4Step* Step);
virtual void Initialize(const G4Track&);
// Initialize all propoerties by using G4Track information
G4double GetTimeChange() const;
void SetTimeChange(G4double t);
// Get/Set theTimeChange vector.
public:
virtual void DumpInfo() const;
protected:
G4double theTimeChange;
// The change of global time of a given particle.
};
inline
G4double G4ParticleChangeForDecay::GetTimeChange() const
{
return theTimeChange;
}
inline
void G4ParticleChangeForDecay::SetTimeChange(G4double t)
{
theTimeChange = t;
}
#endif
@@ -0,0 +1,105 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForLoss.hh,v 2.1 1998/12/02 17:19:26 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
//
// This class is a concrete class for ParticleChange for EnergyLoss
//
#ifndef G4ParticleChangeForLoss_h
#define G4ParticleChangeForLoss_h 1
#include "globals.hh"
#include "G4ios.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
class G4ParticleChangeForLoss: public G4VParticleChange
{
public:
// default constructor
G4ParticleChangeForLoss();
// destructor
virtual ~G4ParticleChangeForLoss();
protected:
// hide copy constructor and assignment operaor as protected
G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right);
G4ParticleChangeForLoss & operator=(const G4ParticleChangeForLoss &right);
public:
// equal/unequal operator
G4bool operator==(const G4ParticleChangeForLoss &right) const;
G4bool operator!=(const G4ParticleChangeForLoss &right) const;
public:
// ----------------------------------------------------
// --- the following methods are for updating G4Step -----
virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
virtual void Initialize(const G4Track&);
// Initialize all propoerties by using G4Track information
G4double GetEnergyChange() const;
void SetEnergyChange(G4double theEnergyChange);
// Get/Set the final kinetic energy of the current particle.
public:
virtual void DumpInfo() const;
protected:
G4double theEnergyChange;
// The final kinetic energy of the current particle.
public:
// for Debug
G4bool debugFlag;
G4bool CheckIt(const G4Track&);
};
inline
G4double G4ParticleChangeForLoss::GetEnergyChange() const
{
return theEnergyChange;
}
inline
void G4ParticleChangeForLoss::SetEnergyChange(G4double Energy)
{
theEnergyChange = Energy;
}
#endif
@@ -0,0 +1,99 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForMSC.hh,v 2.1 1998/12/02 17:19:24 urban Exp $
// GEANT4 tag $ $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
//
// -------------------------------------------------------------
#ifndef G4ParticleChangeForMSC_h
#define G4ParticleChangeForMSC_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
class G4ParticleChangeForMSC: public G4VParticleChange
{
public:
// default constructor
G4ParticleChangeForMSC();
// destructor
virtual ~G4ParticleChangeForMSC();
protected:
// hide copy constructor and assignment operaor as protected
G4ParticleChangeForMSC(const G4ParticleChangeForMSC &right);
G4ParticleChangeForMSC & operator=(const G4ParticleChangeForMSC &right);
public:
// ----------------------------------------------------
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a physics
// process
virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
virtual G4Step* UpdateStepForAtRest(G4Step* Step);
virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// A physics process gives the final state of the particle
// based on information of G4Track (or equivalently the PreStepPoint)
virtual void Initialize(const G4Track&);
// Initialize all propoerties by using G4Track information
// ----------------------------------------------------
//--- methods to keep information of the final state--
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, Momentum, etc.
const G4ParticleMomentum* GetMomentumChange() const;
void SetMomentumChange(G4double Px, G4double Py, G4double Pz);
void SetMomentumChange(const G4ThreeVector& Pfinal);
// Get/Set theMomentumChange vector: it is the final momentum direction.
const G4ThreeVector* GetPositionChange() const;
void SetPositionChange(G4double x, G4double y, G4double z);
void SetPositionChange(const G4ThreeVector& finalPosition);
// Get/Set the final position of the current particle.
public:
virtual void DumpInfo() const;
protected:
G4ParticleMomentum theMomentumChange;
// It is the vector containing the final momentum direction
// after the invoked process. The application of the change
// of the momentum direction of the particle is not Done here.
// The responsibility to apply the change is up the entity
// which invoked the process.
G4ThreeVector thePositionChange;
// The changed (final) position of a given particle.
};
#include "G4ParticleChangeForMSC.icc"
#endif
@@ -0,0 +1,55 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForMSC.icc,v 2.1 1998/12/02 17:19:25 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
inline
const G4ParticleMomentum* G4ParticleChangeForMSC::GetMomentumChange() const
{
return &theMomentumChange;
}
inline
void G4ParticleChangeForMSC::SetMomentumChange(
G4double Px,
G4double Py,
G4double Pz )
{
theMomentumChange.setX(Px);
theMomentumChange.setY(Py);
theMomentumChange.setZ(Pz);
}
inline
void G4ParticleChangeForMSC::SetMomentumChange(const G4ThreeVector& P)
{
theMomentumChange = P;
}
inline
const G4ThreeVector* G4ParticleChangeForMSC::GetPositionChange() const
{
return &thePositionChange;
}
inline
void G4ParticleChangeForMSC::SetPositionChange(const G4ThreeVector& finalPosition)
{
thePositionChange= finalPosition;
}
inline
void G4ParticleChangeForMSC::SetPositionChange(G4double x,G4double y, G4double z)
{
thePositionChange.setX(x);
thePositionChange.setY(y);
thePositionChange.setZ(z);
}
@@ -0,0 +1,104 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForTransport.hh,v 2.3 1998/07/13 17:28:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 10 May. 1998 H.Kurahige
//
// This class is a concrete class for ParticleChange for transportation
//
#ifndef G4ParticleChangeForTransport_h
#define G4ParticleChangeForTransport_h 1
#include "globals.hh"
#include "G4ios.hh"
class G4VTouchable;
#include "G4ParticleChange.hh"
class G4ParticleChangeForTransport: public G4ParticleChange
{
public:
// default constructor
G4ParticleChangeForTransport();
// destructor
virtual ~G4ParticleChangeForTransport();
protected:
// hide copy constructor and assignment operaor as protected
G4ParticleChangeForTransport(const G4ParticleChangeForTransport &right);
G4ParticleChangeForTransport & operator=(const G4ParticleChangeForTransport &right);
public:
// ----------------------------------------------------
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a physics
// process
virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
virtual G4Step* UpdateStepForAtRest(G4Step* Step);
virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// A physics process gives the final state of the particle
// based on information of G4Track (or equivalently the PreStepPoint)
virtual void Initialize(const G4Track&);
// Initialize all propoerties by using G4Track information
// ----------------------------------------------------
//--- methods to keep information of the final state--
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, Momentum, etc.
G4VTouchable* GetTouchableChange() const;
void SetTouchableChange(G4VTouchable* fTouchable);
// Get/Set the touchable of the current particle.
// Note: Touchable in PostStepPoint will be updated only after PostStepDoIt
G4bool GetMomentumChanged() const;
void SetMomentumChanged(G4bool b);
public:
virtual void DumpInfo() const;
protected:
G4VTouchable* theTouchableChange;
// The changed touchable of a given particle.
private:
G4bool isMomentumChanged;
};
#include "G4ParticleChangeForTransport.icc"
#endif
@@ -0,0 +1,73 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForTransport.icc,v 2.1 1998/07/10 11:11:51 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
inline
void G4ParticleChangeForTransport::SetTouchableChange(G4VTouchable* fTouchable)
{
theTouchableChange = fTouchable;
}
inline
G4VTouchable* G4ParticleChangeForTransport::GetTouchableChange() const
{
return theTouchableChange;
}
inline
G4bool G4ParticleChangeForTransport::GetMomentumChanged() const
{
return isMomentumChanged;
}
inline
void G4ParticleChangeForTransport::SetMomentumChanged(G4bool b)
{
isMomentumChanged= b;
}
//----------------------------------------------------------------
// functions for Initialization
//
inline void G4ParticleChangeForTransport::Initialize(const G4Track& track)
{
// use base class's method at first
InitializeStatusChange(track);
// InitializeLocalEnergyDeposit(track);
InitializeSteppingControl(track);
// InitializeTrueStepLength(track);
// InitializeSecondaries(track);
// set Energy/Momentum etc. equal to those of the parent particle
// const G4DynamicParticle* pParticle = track.GetDynamicParticle();
// theEnergyChange = pParticle->GetKineticEnergy();
// theMomentumChange = pParticle->GetMomentumDirection();
// thePolarizationChange = pParticle->GetPolarization();
// theProperTimeChange = pParticle->GetProperTime();
// set Position/Time etc. equal to those of the parent track
// thePositionChange = track.GetPosition();
// theTimeChange = track.GetGlobalTime();
// set touchable equal to the next touchable of the parent track
// not set as for now
//theTouchableChange = track.GetNextTouchable();
// So almost nothing is initialized here.
// theMomentumChange, theProperTimeChange, thePositionChange and theTimeChange
// are set by G4Transportation::AlongStepDoIt;
// the others are not needed.
// Take care when implementing the PostStep related things!
// (P. Urban)
}
+265
View File
@@ -0,0 +1,265 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Step.hh,v 2.4 1998/11/18 11:06:30 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4Step.hh
//
// Description:
// This class represents the Step of a particle tracked.
// It includes information of
// 1) List of Step points which compose the Step,
// 2) static information of particle which generated the
// Step,
// 3) trackID and parent particle ID of the Step,
// 4) termination condition of the Step,
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
// Modified for the new G4ParticleChange 12 Mar. 1998 H.Kurahige
// Correct treatment of touchable in G4Step::UpdateTrack
// 12 May. 1998 H.Kurashige
// ---------------------------------------------------------------
//
#ifndef G4Step_h
#define G4Step_h 1
#include <stdlib.h> // Include from 'system'
#include "G4ios.hh" // Include from 'system'
#include <iomanip.h> // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'global'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
#include "G4StepPoint.hh" // Include from 'track'
#include "G4StepStatus.hh" // Include from 'track'
class G4Polyline; // Forward declaration.
class G4Track; // Forward declaration.
////////////
class G4Step
////////////
{
//--------
public:
//--------
// Constructor/Destrcutor
G4Step();
~G4Step();
// Get/Set functions
G4StepPoint* GetPreStepPoint() const;
void SetPreStepPoint(G4StepPoint* value);
G4StepPoint* GetPostStepPoint() const;
void SetPostStepPoint(G4StepPoint* value);
G4double GetStepLength() const;
void SetStepLength(G4double value);
G4Track* GetTrack() const;
void SetTrack(G4Track* value);
G4ThreeVector GetDeltaPosition() const;
G4double GetDeltaTime() const;
G4ThreeVector GetDeltaMomentum() const;
G4double GetDeltaEnergy() const;
G4double GetTotalEnergyDeposit() const;
void SetTotalEnergyDeposit(G4double value);
void AddTotalEnergyDeposit(G4double value);
void ResetTotalEnergyDeposit();
G4SteppingControl GetControlFlag() const;
void SetControlFlag(G4SteppingControl StepControlFlag);
// Other member functions
void InitializeStep( G4Track* aValue );
void UpdateTrack( );
void CopyPostToPreStepPoint( );
void ShowStep() const ;
// Print all information of the Step to stdout
G4Polyline* CreatePolyline () const;
//-----------
protected:
//-----------
// Member data
G4double fTotalEnergyDeposit;
// Accummulated total energy desposit in the current Step
//---------
private:
//---------
// Member data
G4StepPoint* fpPreStepPoint;
G4StepPoint* fpPostStepPoint;
G4double fStepLength;
// Step length which may be updated at each invocation of
// AlongStepDoIt and PostStepDoIt
G4Track* fpTrack;
//
G4SteppingControl fpSteppingControlFlag;
// A flag to control SteppingManager behavier from process
};
//-----------------------------------------------------------------
// In-line definitions
//-----------------------------------------------------------------
// Get/Set functions
inline G4StepPoint* G4Step::GetPreStepPoint() const
{ return fpPreStepPoint; }
inline void G4Step::SetPreStepPoint(G4StepPoint* value)
{ fpPreStepPoint = value; }
inline G4StepPoint* G4Step::GetPostStepPoint() const
{ return fpPostStepPoint; }
inline void G4Step::SetPostStepPoint(G4StepPoint* value)
{ fpPostStepPoint = value; }
inline G4double G4Step::GetStepLength() const
{ return fStepLength; }
inline void G4Step::SetStepLength(G4double value)
{ fStepLength = value; }
inline G4ThreeVector G4Step::GetDeltaPosition() const
{ return fpPostStepPoint->GetPosition()
- fpPreStepPoint->GetPosition(); }
inline G4double G4Step::GetDeltaTime() const
{ return fpPostStepPoint->GetLocalTime()
- fpPreStepPoint->GetLocalTime(); }
inline G4ThreeVector G4Step::GetDeltaMomentum() const
{ return fpPostStepPoint->GetMomentum()
- fpPreStepPoint->GetMomentum(); }
inline G4double G4Step::GetDeltaEnergy() const
{ return fpPostStepPoint->GetKineticEnergy()
- fpPreStepPoint->GetKineticEnergy(); }
inline G4double G4Step::GetTotalEnergyDeposit() const
{ return fTotalEnergyDeposit; }
inline void G4Step::SetTotalEnergyDeposit(G4double value)
{ fTotalEnergyDeposit = value; }
inline void G4Step::AddTotalEnergyDeposit(G4double value)
{ fTotalEnergyDeposit += value; }
inline void G4Step::ResetTotalEnergyDeposit()
{ fTotalEnergyDeposit = 0.; }
inline void G4Step::SetControlFlag(G4SteppingControl value)
{
fpSteppingControlFlag = value;
}
inline G4SteppingControl G4Step::GetControlFlag() const
{
return fpSteppingControlFlag;
}
inline void G4Step::CopyPostToPreStepPoint( )
{
// Default equal operator is used for copy
*(fpPreStepPoint) = *(fpPostStepPoint);
}
//-------------------------------------------------------------
// To implement bi-directional association between G4Step and
// and G4Track, a combined usage of 'forward declaration' and
// 'include' is necessary.
//-------------------------------------------------------------
#include "G4Track.hh"
inline G4Track* G4Step::GetTrack() const
{ return fpTrack; }
inline void G4Step::SetTrack(G4Track* value)
{ fpTrack = value; }
// Other member functions
inline void G4Step::InitializeStep( G4Track* aValue )
{
// Initialize G4Step attributes
fStepLength = 0.;
fTotalEnergyDeposit = 0.;
fpTrack = aValue;
fpTrack->SetStepLength(0.);
// Initialize G4StepPoint attributes.
// To avoid the circular dependency between G4Track, G4Step
// and G4StepPoint, G4Step has to manage the copy actions.
fpPreStepPoint->SetPosition(fpTrack->GetPosition());
fpPreStepPoint->SetGlobalTime(fpTrack->GetGlobalTime());
fpPreStepPoint->SetLocalTime(fpTrack->GetLocalTime());
fpPreStepPoint->SetProperTime(fpTrack->GetProperTime());
fpPreStepPoint->SetMomentumDirection(fpTrack->GetMomentumDirection());
fpPreStepPoint->SetKineticEnergy(fpTrack->GetKineticEnergy());
fpPreStepPoint->SetTouchable(fpTrack->GetTouchable());
fpPreStepPoint->SetPolarization(fpTrack->GetPolarization());
fpPreStepPoint->SetSafety(0.);
fpPreStepPoint->SetStepStatus(fUndefined);
fpPreStepPoint->SetProcessDefinedStep(NULL);
fpPreStepPoint->SetMass(fpTrack->GetDynamicParticle()->GetMass());
fpPreStepPoint->SetWeight(fpTrack->GetWeight());
(*fpPostStepPoint) = (*fpPreStepPoint);
}
inline void G4Step::UpdateTrack( )
{
// To avoid the circular dependency between G4Track, G4Step
// and G4StepPoint, G4Step has to manage the update actions.
fpTrack->SetPosition(fpPostStepPoint->GetPosition());
fpTrack->SetGlobalTime(fpPostStepPoint->GetGlobalTime());
fpTrack->SetLocalTime(fpPostStepPoint->GetLocalTime());
fpTrack->SetProperTime(fpPostStepPoint->GetProperTime());
fpTrack->SetMomentumDirection(fpPostStepPoint->GetMomentumDirection());
fpTrack->SetKineticEnergy(fpPostStepPoint->GetKineticEnergy());
fpTrack->SetPolarization(fpPostStepPoint->GetPolarization());
fpTrack->SetStepLength(fStepLength);
// NextTouchable is updated
// (G4Track::Touchable points touchable of Pre-StepPoint)
fpTrack->SetNextTouchable(fpPostStepPoint->GetTouchable());
fpTrack->SetWeight(fpPostStepPoint->GetWeight());
}
#endif
+218
View File
@@ -0,0 +1,218 @@
// This code implementation is the intellectual property of
// the RD44 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: G4StepPoint.hh,v 2.4 1998/11/18 11:06:32 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4StepPoint.hh
//
// Description:
// This class represents information associated with the
// each end of a Step like the space/time data of the
// particle.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#ifndef G4StepPoint_h
#define G4StepPoint_h 1
#include "globals.hh" // Include from 'global'
#include "G4Allocator.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
class G4VProcess;
#include "G4SteppingControl.hh"
#include "G4StepStatus.hh" // Include from 'track'
#include "G4VTouchable.hh" // Include from 'geometry'
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
/////////////////
class G4StepPoint
/////////////////
{
//--------
public:
//--------
// Constructor/Destructor
G4StepPoint();
~G4StepPoint();
// Get/Set functions
inline const G4ThreeVector& GetPosition() const
{ return fPosition; }
inline void SetPosition(const G4ThreeVector& aValue)
{ fPosition = aValue; }
inline void AddPosition(const G4ThreeVector& aValue)
{ fPosition += aValue; }
inline G4double GetLocalTime() const
{ return fLocalTime; }
inline void SetLocalTime(const G4double aValue)
{ fLocalTime = aValue; }
inline void AddLocalTime(const G4double aValue)
{ fLocalTime += aValue; }
// Time since the track is created.
inline G4double GetGlobalTime() const
{ return fGlobalTime; }
inline void SetGlobalTime(const G4double aValue)
{ fGlobalTime = aValue; }
inline void AddGlobalTime(const G4double aValue)
{ fGlobalTime += aValue; }
// Time since the event in which the track belongs is created.
inline G4double GetProperTime() const
{ return fProperTime; }
inline void SetProperTime(const G4double aValue)
{ fProperTime = aValue; }
inline void AddProperTime(const G4double aValue)
{ fProperTime += aValue; }
// Proper time of the particle.
inline const G4ThreeVector& GetMomentumDirection() const
{ return fMomentumDirection; }
inline void SetMomentumDirection(const G4ThreeVector& aValue)
{ fMomentumDirection = aValue;
}
inline void AddMomentumDirection(const G4ThreeVector& aValue)
{ fMomentumDirection += aValue;
}
inline G4ThreeVector GetMomentum() const
{
G4double tMomentum = sqrt(fKineticEnergy*fKineticEnergy +
2*fKineticEnergy*fMass);
return G4ThreeVector(fMomentumDirection.x()*tMomentum,
fMomentumDirection.y()*tMomentum,
fMomentumDirection.z()*tMomentum);
}
inline G4double GetTotalEnergy() const
{
return fKineticEnergy + fMass;
}
inline G4double GetKineticEnergy() const
{ return fKineticEnergy; }
inline void SetKineticEnergy(const G4double aValue)
{ fKineticEnergy = aValue; }
inline void AddKineticEnergy(const G4double aValue)
{ fKineticEnergy += aValue; }
// This velocity is the velocity as if in vacuum.
// (So it is not corrected for the refraction index
// in the case of photons - optical or X-rays.)
// In order to get the velocity in the material, use
// GetVelocity of G4Track.
//
inline G4double GetVelocity() const
{
if(fMass==0.){
return c_light;
}
else{
G4double tMomentum = sqrt(fKineticEnergy*fKineticEnergy +
2.0*fKineticEnergy*fMass);
G4double tTotalEnergy = fKineticEnergy + fMass;
return tMomentum/tTotalEnergy*c_light;
}
}
inline G4VPhysicalVolume* GetPhysicalVolume()
{ return fpTouchable->GetVolume(); }
inline G4VTouchable* GetTouchable() const
{ return fpTouchable; }
inline void SetTouchable(G4VTouchable* apValue)
{ fpTouchable = apValue; }
inline G4double GetSafety() const
{ return fSafety; }
inline void SetSafety(const G4double aValue)
{ fSafety = aValue; }
inline const G4ThreeVector& GetPolarization() const
{ return fPolarization; }
inline void SetPolarization(const G4ThreeVector& aValue)
{ fPolarization = aValue; }
inline void AddPolarization(const G4ThreeVector& aValue)
{ fPolarization += aValue; }
inline G4StepStatus GetStepStatus() const
{ return fStepStatus; }
inline void SetStepStatus(const G4StepStatus aValue)
{ fStepStatus = aValue; }
inline const G4VProcess* GetProcessDefinedStep() const
{ return fpProcessDefinedStep; }
// If the pointer is NULL, this means the Step is defined
// by the user defined limit in the current volume.
inline void SetProcessDefinedStep(G4VProcess* aValue)
{ fpProcessDefinedStep = aValue; }
inline G4double GetGamma() const
{ return (fMass==0.) ? DBL_MAX : (fKineticEnergy+fMass)/fMass; }
inline G4double GetBeta() const
{ return (fMass==0.) ?
1.0 :
sqrt(fKineticEnergy*fKineticEnergy + 2.0*fKineticEnergy*fMass)
/(fKineticEnergy+fMass); }
inline G4double GetMass() const
{ return fMass; }
inline void SetMass(G4double value)
{ fMass = value; }
inline G4Material* GetMaterial()
{ return fpTouchable->GetVolume()->GetLogicalVolume()->GetMaterial(); }
inline void SetWeight(G4double aValue)
{ fWeight = aValue; }
inline G4double GetWeight() const
{ return fWeight; }
//---------
private:
//---------
// Member data
G4ThreeVector fPosition;
G4double fGlobalTime;
// Time since event is created
G4double fLocalTime;
// Time since track is created
G4double fProperTime;
// Time since track is created (in rest frame of particle)
G4ThreeVector fMomentumDirection;
G4double fKineticEnergy;
G4VTouchable* fpTouchable;
G4double fSafety;
G4ThreeVector fPolarization;
G4StepStatus fStepStatus;
// DoIt type which defined the current Step.
G4VProcess* fpProcessDefinedStep;
// Process which defined the current Step.
G4double fMass;
// Dynamical mass of the particle
G4double fWeight;
};
#endif
+54
View File
@@ -0,0 +1,54 @@
// This code implementation is the intellectual property of
// the RD44 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: G4StepStatus.hh,v 2.1 1998/07/12 03:08:48 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4StepStatus.hh
//
// Description:
// This is an enumerator to define possible sources which
// can define the Step length.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4StepStatus_h
#define G4StepStatus_h 1
//////////////////
enum G4StepStatus
//////////////////
{
fWorldBoundary,
// Step reached the world boundary
fGeomBoundary,
// Step defined by a geometry boundary
fAtRestDoItProc,
// Step defined by a PreStepDoItVector
fAlongStepDoItProc,
// Step defined by a AlongStepDoItVector
fPostStepDoItProc,
// Step defined by a PostStepDoItVector
fUserDefinedLimit,
// Step defined by the user Step limit in the logical volume
fExclusivelyForcedProc,
// Step defined by an exclusively forced PostStepDoIt process
fUndefined
// Step not defined yet
};
#endif
+42
View File
@@ -0,0 +1,42 @@
// This code implementation is the intellectual property of
// the RD44 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: G4SteppingControl.hh,v 2.1 1998/07/12 03:08:49 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingControl
//
// Description:
// This enumaration specifies possible conditions to control
// the stepping manager behavier.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4SteppingControl_h
#define G4SteppingControl_h 1
/////////////////////
enum G4SteppingControl
/////////////////////
{
NormalCondition,
AvoidHitInvocation,
// Hit will NOT be called
Debug
};
#endif
+449
View File
@@ -0,0 +1,449 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Track.hh,v 2.4 1998/11/18 11:06:34 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4Track.hh
//
// Description:
// This class represents the partilce under tracking.
// It includes information related to tracking for examples:
// 1) current position/time of the particle,
// 2) static particle information,
// 3) the pointer to the physical volume where currently
// the particle exists,
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4Track_h
#define G4Track_h 1
#include "globals.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4LogicalVolume.hh" // Include from 'geometry'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
#include "G4Allocator.hh" // Include from 'particle+matter'
#include "G4DynamicParticle.hh" // Include from 'particle+matter'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4VTouchable.hh" // Include from 'geometry'
#include "G4Material.hh"
class G4Step; // Forward declaration
//////////////
class G4Track
//////////////
{
//--------
public:
//--------
// Constructor/Destrcutor
G4Track();
G4Track(G4DynamicParticle* apValueDynamicParticle,
G4double aValueTime,
const G4ThreeVector& aValuePosition);
// aValueTime is a global time
~G4Track();
// Operators
inline void *operator new(size_t);
// Override "new" for "G4Allocator".
inline void operator delete(void *aTrack);
// Override "delete" for "G4Allocator".
int operator==( const G4Track& s);
// Define "==" operator because "G4TrackVector" uses
//"RWPtrOrderdVector" which requires this.
// Get/Set functions
const G4ThreeVector& GetPosition() const;
void SetPosition(const G4ThreeVector& aValue);
G4double GetGlobalTime() const;
void SetGlobalTime(const G4double aValue);
// Time since the event in which the track belongs is created.
G4double GetLocalTime() const;
void SetLocalTime(const G4double aValue);
// Time since the current track is created.
G4double GetProperTime() const;
void SetProperTime(const G4double aValue);
// Proper time of the current track
G4double GetTrackLength() const;
void AddTrackLength(const G4double aValue);
// Accumulated the track length
G4int GetParentID() const;
void SetParentID(const G4int aValue);
G4int GetTrackID() const;
void SetTrackID(const G4int aValue);
G4VPhysicalVolume* GetVolume() const;
G4VPhysicalVolume* GetNextVolume() const;
G4Material* GetMaterial() const;
G4Material* GetNextMaterial() const;
G4VTouchable* GetTouchable() const;
void SetTouchable(G4VTouchable* apValue);
G4VTouchable* GetNextTouchable() const;
void SetNextTouchable(G4VTouchable* apValue);
G4double GetKineticEnergy() const;
void SetKineticEnergy(const G4double aValue);
G4double GetVelocity() const;
const G4ThreeVector& GetMomentumDirection() const;
void SetMomentumDirection(const G4ThreeVector& aValue);
const G4ThreeVector& GetPolarization() const;
void SetPolarization(const G4ThreeVector& aValue);
G4TrackStatus GetTrackStatus() const;
void SetTrackStatus(const G4TrackStatus aTrackStatus);
G4bool IsBelowThreshold() const;
void SetBelowThresholdFlag(G4bool value = true);
G4bool IsGoodForTracking() const;
void SetGoodForTrackingFlag(G4bool value = true);
G4int GetCurrentStepNumber() const;
void IncrementCurrentStepNumber();
G4double GetTotalEnergy() const;
G4ThreeVector GetMomentum() const;
const G4DynamicParticle* GetDynamicParticle() const;
G4ParticleDefinition* GetDefinition() const;
G4double GetStepLength() const;
void SetStepLength(G4double value);
G4Step* GetStep() const;
void SetStep(G4Step* aValue);
const G4ThreeVector& GetVertexPosition() const;
void SetVertexPosition(const G4ThreeVector& aValue);
const G4ThreeVector& GetVertexMomentumDirection() const;
void SetVertexMomentumDirection(const G4ThreeVector& aValue);
G4double GetVertexKineticEnergy() const;
void SetVertexKineticEnergy(const G4double aValue);
G4LogicalVolume* GetLogicalVolumeAtVertex() const;
void SetLogicalVolumeAtVertex(G4LogicalVolume* );
const G4VProcess* GetCreatorProcess() const;
void SetCreatorProcess(G4VProcess* aValue);
G4double GetWeight() const;
void SetWeight(G4double aValue);
//---------
private:
//---------
// Member data
G4int fCurrentStepNumber; // Total steps number up to now
G4ThreeVector fPosition; // Current positon
G4double fGlobalTime; // Time since the event is created
G4double fLocalTime; // Time since the track is created
G4double fTrackLength; // Accumulated track length
G4int fParentID;
G4int fTrackID;
G4VTouchable* fpTouchable;
G4VTouchable* fpNextTouchable;
G4DynamicParticle* fpDynamicParticle;
G4TrackStatus fTrackStatus;
G4bool fBelowThreshold;
// This flag is set to true if this track energy is below
// threshold energy in this material determined by the range cut value
G4bool fGoodForTracking;
// This flag is set by processes if this track should be tracked
// even if the energy is below threshold
G4double fStepLength;
// Before the end of the AlongStepDoIt loop, this keeps the initial
// Step length which is determined by the shortest geometrical Step
// proposed by a physics process. After finishing the AlongStepDoIt,
// this will be set equal to 'StepLength' in G4Step.
G4double fWeight;
// This is a weight for this track used by G4VEvtBiasMechanism
// to execute inclusive simulation for hadronic/electomagnetic shower
// and neutron transportation etc.
G4Step* fpStep;
G4ThreeVector fVtxPosition; // (x,y,z) of the vertex
G4ThreeVector fVtxMomentumDirection; // Momentum direction at the vertex
G4double fVtxKineticEnergy; // Kinetic energy at the vertex
G4LogicalVolume* fpLVAtVertex; //Logical Volume at the vertex
G4VProcess* fpCreatorProcess; // Process which created the track
};
//-----------------------------------------------------------------
// Definitions of inline functions
//-----------------------------------------------------------------
// Operators
extern G4Allocator<G4Track> aTrackAllocator;
inline void* G4Track::operator new(size_t)
{ void *aTrack;
aTrack = (void *) aTrackAllocator.MallocSingle();
return aTrack;
}
// Override "new" for "G4Allocator".
inline void G4Track::operator delete(void *aTrack)
{ aTrackAllocator.FreeSingle((G4Track *) aTrack);}
// Override "delete" for "G4Allocator".
inline int G4Track::operator==( const G4Track& s)
{ return (this==&s) ? 1 : 0; }
// Define "==" operator because "G4TrackVector" uses
// "RWPtrOrderdVector" which requires this.
// Get/Set functions
inline const G4ThreeVector& G4Track::GetPosition() const
{ return fPosition; }
inline void G4Track::SetPosition(const G4ThreeVector& aValue)
{ fPosition = aValue; }
inline G4double G4Track::GetGlobalTime() const
{ return fGlobalTime; }
inline void G4Track::SetGlobalTime(const G4double aValue)
{ fGlobalTime = aValue; }
// Time since the event in which the track belongs is created.
inline G4double G4Track::GetLocalTime() const
{ return fLocalTime; }
inline void G4Track::SetLocalTime(const G4double aValue)
{ fLocalTime = aValue; }
// Time since the current track is created.
inline G4double G4Track::GetProperTime() const
{ return fpDynamicParticle->GetProperTime(); }
inline void G4Track::SetProperTime(const G4double aValue)
{ fpDynamicParticle->SetProperTime(aValue); }
// Proper time of the current track
inline G4double G4Track::GetTrackLength() const
{ return fTrackLength; }
inline void G4Track::AddTrackLength(const G4double aValue)
{ fTrackLength += aValue; }
// Accumulated track length
inline G4int G4Track::GetParentID() const
{ return fParentID; }
inline void G4Track::SetParentID(const G4int aValue)
{ fParentID = aValue; }
inline G4int G4Track::GetTrackID() const
{ return fTrackID; }
inline void G4Track::SetTrackID(const G4int aValue)
{ fTrackID = aValue; }
inline G4VPhysicalVolume* G4Track::GetVolume() const
{ return fpTouchable->GetVolume(); }
inline G4VPhysicalVolume* G4Track::GetNextVolume() const
{ return fpNextTouchable->GetVolume(); }
inline G4Material* G4Track::GetMaterial() const
{ return fpTouchable->GetVolume()->GetLogicalVolume()->GetMaterial(); }
inline G4Material* G4Track::GetNextMaterial() const
{ return fpNextTouchable->GetVolume()->GetLogicalVolume()->GetMaterial(); }
inline G4VTouchable* G4Track::GetTouchable() const
{ return fpTouchable; }
inline void G4Track::SetTouchable(G4VTouchable* apValue)
{ fpTouchable = apValue; }
inline G4VTouchable* G4Track::GetNextTouchable() const
{ return fpNextTouchable; }
inline void G4Track::SetNextTouchable(G4VTouchable* apValue)
{ fpNextTouchable = apValue; }
inline G4double G4Track::GetKineticEnergy() const
{ return fpDynamicParticle->GetKineticEnergy(); }
inline void G4Track::SetKineticEnergy(const G4double aValue)
{ fpDynamicParticle->SetKineticEnergy(aValue); }
inline G4double G4Track::GetVelocity() const
{
G4double velocity ;
G4double mass = fpDynamicParticle->GetMass();
if( mass == 0. )
{
velocity = c_light ;
if((fpDynamicParticle->GetDefinition()->GetParticleName() ==
"gamma")
||
(fpDynamicParticle->GetDefinition()->GetParticleName() ==
"opticalphoton"))
{
G4Material*
mat=fpTouchable->GetVolume()->GetLogicalVolume()->GetMaterial();
if(mat->GetMaterialPropertiesTable() != NULL)
{
if(mat->GetMaterialPropertiesTable()->GetProperty("RINDEX") != NULL )
velocity /=
mat->GetMaterialPropertiesTable()->GetProperty("RINDEX")->
GetMinProperty() ;
}
}
}
else
{
G4double T = fpDynamicParticle->GetKineticEnergy();
velocity = c_light*sqrt(T*(T+2.*mass))/(T+mass) ;
}
return velocity ;
}
inline const G4ThreeVector& G4Track::GetMomentumDirection() const
{ return fpDynamicParticle->GetMomentumDirection(); }
inline void G4Track::SetMomentumDirection(const G4ThreeVector& aValue)
{ fpDynamicParticle->SetMomentumDirection(aValue) ;}
inline const G4ThreeVector& G4Track::GetPolarization() const
{ return fpDynamicParticle->GetPolarization(); }
inline void G4Track::SetPolarization(const G4ThreeVector& aValue)
{ fpDynamicParticle->SetPolarization(aValue.x(),
aValue.y(),
aValue.z()); }
inline G4TrackStatus G4Track::GetTrackStatus() const
{ return fTrackStatus; }
inline void G4Track::SetTrackStatus(const G4TrackStatus aTrackStatus)
{ fTrackStatus = aTrackStatus; }
inline G4int G4Track::GetCurrentStepNumber() const
{ return fCurrentStepNumber; }
inline void G4Track::IncrementCurrentStepNumber()
{ fCurrentStepNumber++; }
inline G4double G4Track::GetTotalEnergy() const
{ return fpDynamicParticle->GetTotalEnergy(); }
inline G4ThreeVector G4Track::GetMomentum() const
{ return fpDynamicParticle->GetMomentum(); }
inline const G4DynamicParticle* G4Track::GetDynamicParticle() const
{ return fpDynamicParticle; }
inline G4ParticleDefinition* G4Track::GetDefinition() const
{ return fpDynamicParticle->GetDefinition(); }
inline G4double G4Track::GetStepLength() const
{ return fStepLength; }
inline void G4Track::SetStepLength(G4double value)
{ fStepLength = value; }
inline const G4ThreeVector& G4Track::GetVertexPosition() const
{ return fVtxPosition; }
inline void G4Track::SetVertexPosition(const G4ThreeVector& aValue)
{ fVtxPosition = aValue; }
inline const G4ThreeVector& G4Track::GetVertexMomentumDirection() const
{ return fVtxMomentumDirection; }
inline void G4Track::SetVertexMomentumDirection(const G4ThreeVector& aValue)
{ fVtxMomentumDirection = aValue ;}
inline G4double G4Track::GetVertexKineticEnergy() const
{ return fVtxKineticEnergy; }
inline void G4Track::SetVertexKineticEnergy(const G4double aValue)
{ fVtxKineticEnergy = aValue; }
inline G4LogicalVolume* G4Track::GetLogicalVolumeAtVertex() const
{ return fpLVAtVertex; }
inline void G4Track::SetLogicalVolumeAtVertex(G4LogicalVolume* aValue)
{ fpLVAtVertex = aValue; }
inline const G4VProcess* G4Track::GetCreatorProcess() const
{ return fpCreatorProcess; }
// If the pointer is NULL, this means the track is created
// by the event generator, i.e. the primary track.If it is not
// NULL, it points to the process which created this track.
inline void G4Track::SetCreatorProcess(G4VProcess* aValue)
{ fpCreatorProcess = aValue; }
inline G4bool G4Track::IsBelowThreshold() const
{ return fBelowThreshold; }
inline void G4Track::SetBelowThresholdFlag(G4bool value)
{ fBelowThreshold = value; }
inline G4bool G4Track::IsGoodForTracking() const
{ return fGoodForTracking; }
inline void G4Track::SetGoodForTrackingFlag(G4bool value)
{ fGoodForTracking = value; }
inline void G4Track::SetWeight(G4double aValue)
{ fWeight = aValue; }
inline G4double G4Track::GetWeight() const
{ return fWeight; }
//-------------------------------------------------------------
// To implement bi-directional association between G4Step and
// and G4Track, a combined usage of 'forward declaration' and
// 'include' is necessary.
//-------------------------------------------------------------
#include "G4Step.hh"
inline G4Step* G4Track::GetStep() const
{ return fpStep; }
inline void G4Track::SetStep(G4Step* aValue)
{ fpStep = aValue; }
#endif
+38
View File
@@ -0,0 +1,38 @@
// This code implementation is the intellectual property of
// the RD44 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: G4TrackFastVector.hh,v 2.1 1998/07/13 17:28:35 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 8 Mar 1997, H.Kurashige
// ------------------------------------------------------------
#ifndef G4TrackFastVector_h
#define G4TrackFastVector_h 1
#include "globals.hh"
#include "G4ios.hh"
class G4Track;
#include "G4FastVector.hh"
const G4int G4TrackFastVectorSize = 512;
class G4TrackFastVector:
public G4FastVector<G4Track,G4TrackFastVectorSize>
{};
// Contains pointers to G4Track objects which are
// generated by either primary or secondary interaction.
#endif
+52
View File
@@ -0,0 +1,52 @@
// This code implementation is the intellectual property of
// the RD44 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: G4TrackStatus.hh,v 2.0 1998/07/02 17:28:38 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackStatus.hh
//
// Description:
// This is an enumerator to define the current status
// of the track which is under the transportation.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4TrackStatus_h
#define G4TrackStatus_h 1
//////////////////
enum G4TrackStatus
//////////////////
{
fAlive, // Continue the tracking
fStopButAlive, // Invoke active rest physics processes and
// and kill the current track afterward
fStopAndKill, // Kill the current track
fKillTrackAndSecondaries,
// Kill the current track and also associated
// secondaries.
fSuspend, // Suspend the current track
fPostponeToNextEvent
// Postpones the tracking of thecurrent track
// to the next event.
};
#endif
@@ -0,0 +1,55 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VEvtBiasMechanism.hh,v 2.3 1998/11/18 11:06:35 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 17 Nov. 1998 H.Kurahige
//
#ifndef G4VEvtBiasMechanism_h
#define G4VEvtBiasMechanism_h 1
#include "globals.hh"
#include "G4ios.hh"
class G4Step;
class G4VParticleChange;
class G4ParticleDefinition;
class G4VEvtBiasMechanism
{
public:
G4VEvtBiasMechanism(const G4String& name = ""){ theEBName = name;}
G4VEvtBiasMechanism(const G4VEvtBiasMechanism& right){ theEBName = right.theEBName;}
virtual ~G4VEvtBiasMechanism(){};
virtual G4VParticleChange* ApplyMath( G4VParticleChange*, const G4Step& ) =0;
virtual G4bool IsApplicable(G4ParticleDefinition*) const = 0;
G4String GetName(){ return theEBName;}
G4int GetVerboseLevel() { return verboseLevel; }
void SetVerboseLevel(G4int value) { verboseLevel = value; }
private:
G4String theEBName;
private:
G4int verboseLevel;
};
#endif
+242
View File
@@ -0,0 +1,242 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VParticleChange.hh,v 2.5 1998/12/11 20:53:00 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
//
// This class is the abstract class for ParticleChange.
//
// The ParticleChange class ontains the results after invocation
// of a physics process. This includes final states of parent
// particle (momentum, energy, etc) and secondary particles generated
// by the interaction.
// The tracking assumes that all the values of energy and
// momentum are in global reference system, therefore all the
// needed Lorentz transformations must have been already Done
// when filling the data-members of this class.
//
//
// This abstract class has following four virtual methods
// virtual G4Step* UpdateStepForAtRest(G4Step* Step);
// virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
// virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// virtual void Initialize(const G4Track&);
// The UpdateStep methods return the pointer to the G4Step
// after updating the given Step information by using final state
// information of the track given by a physics process.
// User must add methods to keep the final state information
// in his derived class as well as implement UpdateStep methods
// which he want to use.
//
// The Initialize methods is provided to refresh the final
// state information and should be called by each process
// at the beginning of DoIt.
//
// ------------------------------------------------------------
// Implement Event Biasing Scheme 9 Nov.,98 H.Kurashige
#ifndef G4VParticleChange_h
#define G4VParticleChange_h 1
#include "globals.hh"
#include "G4ios.hh"
class G4Track;
class G4Step;
class G4VEvtBiasMechanism;
#include "G4TrackFastVector.hh"
#include "G4TrackStatus.hh"
#include "G4SteppingControl.hh"
class G4VParticleChange
{
public:
// default constructor
G4VParticleChange();
G4VParticleChange(G4bool useEvtBiasing);
// destructor
virtual ~G4VParticleChange();
// equal/unequal operator
G4bool operator==(const G4VParticleChange &right) const;
G4bool operator!=(const G4VParticleChange &right) const;
// "equal" means that teo objects have the same pointer.
public:
// --- the following methods are for updating G4Step -----
virtual G4Step* UpdateStepForAtRest(G4Step* Step);
virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a physics
// process
protected:
G4Step* UpdateStepInfo(G4Step* Step);
// Update the G4Step specific attributes
// (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength)
public:
virtual void Initialize(const G4Track&);
// This methods will be called by each process at the beginning of DoIt
// if necessary.
protected:
void InitializeTrueStepLength(const G4Track&);
void InitializeLocalEnergyDeposit(const G4Track&);
void InitializeSteppingControl(const G4Track&);
void InitializeParentWeight(const G4Track&);
void InitializeStatusChange(const G4Track&);
void InitializeSecondaries(const G4Track&);
// ------------------------------------------------------
public:
//---- the following methods are for TruePathLength ----
G4double GetTrueStepLength() const;
void SetTrueStepLength(G4double truePathLength);
// Get/Set theTrueStepLength
//---- the following methods are for LocalEnergyDeposit ----
G4double GetLocalEnergyDeposit() const;
void SetLocalEnergyDeposit(G4double anEnergyPart);
// Get/Set the locally deposited energy
//---- the following methods are for TrackStatus -----
G4TrackStatus GetStatusChange() const;
void SetStatusChange(G4TrackStatus status);
// Get/Set the final TrackStatus of the current particle.
// ------------------------------------------------------
//---- the following methods are for managements of SteppingControl --
G4SteppingControl GetSteppingControl() const;
void SetSteppingControl(G4SteppingControl StepControlFlag);
// Set/Get a flag to control stepping manager behavier
// ------------------------------------------------------
//---- the following methods are for managements of secondaries --
void Clear();
// Clear the contents of this objects
// This method should be called after the Tracking(Stepping)
// manager removes all secondaries in theListOfSecondaries
void SetNumberOfSecondaries(G4int totSecondaries);
// SetNumberOfSecondaries must be called just before AddSecondary()
// in order to secure memory space for theListOfSecondaries
// This method resets theNumberOfSecondaries to 0
// (that will be incremented at every AddSecondary() call).
G4int GetNumberOfSecondaries() const;
// Returns the number of secondaries current stored in
// G4TrackFastVector.
G4Track* GetSecondary(G4int anIndex) const;
// Returns the pointer to the generated secondary particle
// which is specified by an Index.
void AddSecondary(G4Track* aSecondary);
// Add a secondary particle to theListOfSecondaries.
// ------------------------------------------------------
G4double GetParentWeight() const ;
virtual void DumpInfo() const;
// Print out information
void SetVerboseLevel(G4int vLevel);
G4int GetVerboseLevel() const;
protected:
G4TrackFastVector* theListOfSecondaries;
// The vector of secondaries.
G4int theNumberOfSecondaries;
// The total number of secondaries produced by each process.
G4int theSizeOftheListOfSecondaries;
// TheSizeOftheListOfSecondaries;
G4TrackStatus theStatusChange;
// The changed (final) track status of a given particle.
G4SteppingControl theSteppingControlFlag;
// a flag to control stepping manager behavior
G4double theLocalEnergyDeposit;
// It represents the part of the energy lost for discrete
// or semi-continuous processes which is due to secondaries
// not generated because they would have been below their cut
// threshold.
// The sum of the locally deposited energy + the delta-energy
// coming from the continuous processes gives the
// total energy loss localized in the current Step.
G4double theTrueStepLength;
// The value of "True" Step Length
G4int verboseLevel;
// The Verbose level
protected:
// hide copy constructor and assignment operaor as protected
G4VParticleChange(const G4VParticleChange &right);
G4VParticleChange & operator=(const G4VParticleChange &right);
//---- following methods and members are used for Event Biasing
public:
virtual void RegisterEBMechanism(G4VEvtBiasMechanism* );
virtual void SwOnEB();
virtual void SwOffEB();
virtual G4bool IsEBActive() const;
virtual G4VEvtBiasMechanism* GetEBMechanism() const;
protected:
G4VEvtBiasMechanism* theEBMechanism;
G4bool fUseEB;
G4double theParentWeight;
};
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4VEvtBiasMechanism.hh"
#include "G4VParticleChange.icc"
#endif
+286
View File
@@ -0,0 +1,286 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VParticleChange.icc,v 2.6 1998/12/11 20:53:01 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//----------------------------------------------------------------
// Virtual methods for updating G4Step
//
inline G4Step* G4VParticleChange::UpdateStepInfo(G4Step* pStep)
{
// Apply math fomula if Event Biasing is active
if (fUseEB) theEBMechanism->ApplyMath( this, *pStep);
// Update the G4Step specific attributes
pStep->SetStepLength( theTrueStepLength );
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
pStep->SetControlFlag( theSteppingControlFlag );
return pStep;
}
inline
G4Step* G4VParticleChange::UpdateStepForAtRest(G4Step* Step)
{
return UpdateStepInfo(Step);
}
inline
G4Step* G4VParticleChange::UpdateStepForAlongStep(G4Step* Step)
{
return UpdateStepInfo(Step);
}
inline
G4Step* G4VParticleChange::UpdateStepForPostStep(G4Step* Step)
{
return UpdateStepInfo(Step);
}
//----------------------------------------------------------------
// Set/Get inline functions
//
inline
G4Track* G4VParticleChange::GetSecondary(G4int anIndex) const
{
return (*theListOfSecondaries)[anIndex];
}
inline
G4int G4VParticleChange::GetNumberOfSecondaries() const
{
return theNumberOfSecondaries;
}
inline
void G4VParticleChange::SetStatusChange(G4TrackStatus aStatus)
{
theStatusChange = aStatus;
}
inline
G4TrackStatus G4VParticleChange::GetStatusChange() const
{
return theStatusChange;
}
inline
G4SteppingControl G4VParticleChange::GetSteppingControl() const
{
return theSteppingControlFlag;
}
inline
void G4VParticleChange::SetSteppingControl(G4SteppingControl StepControlFlag)
{
theSteppingControlFlag = StepControlFlag;
}
//----------------------------------------------------------------
// Set/Get inline functions
//
inline
G4double G4VParticleChange::GetLocalEnergyDeposit() const
{
return theLocalEnergyDeposit;
}
inline
void G4VParticleChange::SetLocalEnergyDeposit(G4double anEnergyPart)
{
theLocalEnergyDeposit = anEnergyPart;
}
inline
G4double G4VParticleChange::GetTrueStepLength() const
{
return theTrueStepLength;
}
inline
void G4VParticleChange::SetTrueStepLength(G4double aLength)
{
theTrueStepLength = aLength;
}
inline
void G4VParticleChange::SetVerboseLevel(G4int vLevel)
{
verboseLevel = vLevel;
}
inline
G4int G4VParticleChange::GetVerboseLevel() const
{
return verboseLevel;
}
inline
G4double G4VParticleChange::GetParentWeight() const
{
return theParentWeight;
}
//----------------------------------------------------------------
// inline functions for Initialization
//
inline
void G4VParticleChange::InitializeLocalEnergyDeposit(const G4Track&)
{
// clear theLocalEnergyDeposited
theLocalEnergyDeposit = 0.0;
}
inline
void G4VParticleChange::InitializeSteppingControl(const G4Track& )
{
// SteppingControlFlag
theSteppingControlFlag = NormalCondition;
}
inline
void G4VParticleChange::Clear()
{
theNumberOfSecondaries = 0;
}
//----------------------------------------------------------------
// functions for Initialization
//
inline void G4VParticleChange::InitializeStatusChange(const G4Track& track)
{
// set TrackStatus equal to the parent track's one
theStatusChange = track.GetTrackStatus();
}
inline void G4VParticleChange::InitializeParentWeight(const G4Track& track)
{
// set the parent track's weight
theParentWeight = track.GetWeight();
}
inline void G4VParticleChange::InitializeTrueStepLength(const G4Track& track)
{
// Reset theTrueStepLength
// !! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
theTrueStepLength = track.GetStep()->GetStepLength();
// !! TrueStepLength should be copied from G4Step not G4Track
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
inline void G4VParticleChange::InitializeSecondaries(const G4Track&)
{
// clear secondaries
if (theNumberOfSecondaries>0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::Initialize() Warning ";
G4cerr << "theListOfSecondaries is not empty " << endl;
G4cerr << "All objects in theListOfSecondaries are destroyed!" << endl;
}
#endif
for (G4int index= 0; index<theNumberOfSecondaries; index++){
if ( (*theListOfSecondaries)[index] ){
delete (*theListOfSecondaries)[index] ;
}
}
}
theNumberOfSecondaries = 0;
}
//----------------------------------------------------------------
// methods for handling secondaries
//
inline void G4VParticleChange::AddSecondary(G4Track *aTrack)
{
// pass the weight of parent track if this particle change use no EB
aTrack->SetWeight(theParentWeight);
// add a secondary after size check
if (theSizeOftheListOfSecondaries > theNumberOfSecondaries) {
theListOfSecondaries->SetElement(theNumberOfSecondaries, aTrack);
theNumberOfSecondaries++;
} else {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::AddSecondary() Warning ";
G4cerr << "theListOfSecondaries is full !! " << endl;
G4cerr << " The object will not be added in theListOfSecondaries" << endl;
}
#endif
}
}
inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries)
{
// check if tracks still exist in theListOfSecondaries
if (theNumberOfSecondaries>0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::SetNumberOfSecondaries() Warning ";
G4cerr << "theListOfSecondaries is not empty ";
}
#endif
for (G4int index= 0; index<theNumberOfSecondaries; index++){
if ( (*theListOfSecondaries)[index] ){
delete (*theListOfSecondaries)[index] ;
}
}
}
theNumberOfSecondaries = 0;
theSizeOftheListOfSecondaries = totSecondaries;
// Initialize ListOfSecondaries
theListOfSecondaries->Initialize(totSecondaries);
}
inline void G4VParticleChange::Initialize(const G4Track& track)
{
InitializeStatusChange(track);
InitializeLocalEnergyDeposit(track);
InitializeSteppingControl(track);
InitializeTrueStepLength(track);
InitializeSecondaries(track);
InitializeParentWeight(track);
}
inline
void G4VParticleChange::RegisterEBMechanism(G4VEvtBiasMechanism* pEB)
{
theEBMechanism = pEB;
}
inline
void G4VParticleChange::SwOnEB()
{
if (theEBMechanism!=NULL) fUseEB = true;
}
inline
void G4VParticleChange::SwOffEB()
{
fUseEB = false;
}
inline
G4bool G4VParticleChange::IsEBActive() const
{
return fUseEB;
}
inline
G4VEvtBiasMechanism* G4VParticleChange::GetEBMechanism() const
{
return theEBMechanism;
}
+95
View File
@@ -0,0 +1,95 @@
// This code implementation is the intellectual property of
// the RD44 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: G4EvtBiasMechanism.cc,v 2.3 1998/11/18 11:06:41 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 9 Nov. 1998 H.Kurahige
// --------------------------------------------------------------
#include "G4EvtBiasMechanism.hh"
#include "G4VParticleChange.hh"
#include "G4Track.hh"
#include "G4Step.hh"
G4EvtBiasMechanism::G4EvtBiasMechanism(const G4String& name, G4int mulFactor):
G4VEvtBiasMechanism(name),
MultiplicationForSecondaries(mulFactor),
particleToBeBiased(NULL)
{
}
G4EvtBiasMechanism::G4EvtBiasMechanism(const G4EvtBiasMechanism& right):
G4VEvtBiasMechanism(right),
MultiplicationForSecondaries(right.MultiplicationForSecondaries)
{
particleToBeBiased = right.particleToBeBiased;
}
G4EvtBiasMechanism::~G4EvtBiasMechanism()
{
}
G4VParticleChange* G4EvtBiasMechanism::ApplyMath( G4VParticleChange* pChange,
const G4Step& aStep )
{
if (particleToBeBiased != NULL) {
G4int currentNumberOfSecondaries = pChange->GetNumberOfSecondaries();
G4int totalNumberOfSecondaries = currentNumberOfSecondaries;
G4int idx;
G4Track* track;
G4double theParentWeight = pChange->GetParentWeight();
G4TrackFastVector* tempList = new G4TrackFastVector();
tempList->Initialize(currentNumberOfSecondaries);
// fill tempList
for (idx=0; idx<currentNumberOfSecondaries; idx+=1){
track = pChange->GetSecondary(idx);
tempList->SetElement(idx, track);
if ( particleToBeBiased == track->GetDefinition() ) {
totalNumberOfSecondaries += (MultiplicationForSecondaries-1);
}
}
pChange->Clear();
pChange->SetNumberOfSecondaries(totalNumberOfSecondaries);
for (idx=0; idx<currentNumberOfSecondaries; idx+=1){
track = (*tempList)[idx];
if (particleToBeBiased == track->GetDefinition()) {
track->SetWeight( theParentWeight/double( MultiplicationForSecondaries) );
pChange->AddSecondary(track);
for (G4int i=0; i<MultiplicationForSecondaries-1; i+=1) {
// duplicate track
G4Track* newTrack = new G4Track(
new G4DynamicParticle( *(track->GetDynamicParticle()) ),
track->GetGlobalTime(),
track->GetPosition()
);
newTrack->SetWeight( theParentWeight/double( MultiplicationForSecondaries) );
pChange->AddSecondary(newTrack);
}
} else {
track->SetWeight( theParentWeight );
pChange->AddSecondary(track);
}
}
delete tempList;
}
return pChange;
}
+988
View File
@@ -0,0 +1,988 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Mars5GeVMechanism.cc,v 2.4 1998/12/12 12:52:49 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------------------------------------------------
// First Implemention 17 Nov. 1998 M.Asai, H.Kurahige
//
// ------------------------------------------------------------
// This is a Event Biasing mechanism based on MARS code
// This model is applicable to
// proton/neutron/pi+-/K+-/gamma/anti_proton
// with energy < 5.0GeV
//
// Original code is MARS13 written by Nikolai Mokhov (FNAL)
//**************************************************************
//* MARS13: 9. hA EVENT GENERATOR:
//* Copyright Nikolai Mokhov (Fermilab)
//*
//* LAST CHANGE: 14-NOV-1998
//**************************************************************
//* Copyright Nikolai Mokhov (Fermilab)
//*
//* MARS13(98)
//*
//* INCLUSIVE HADRON(photon)-NUCLEUS VERTEX AT E < 5 GEV !!!
//* THREE WEIGHTED HADRONS IN FINAL STATE: !!!
//* IP+A -> N/P(CASC)+ PI+/PI-(K+/K-) + PI0
//
#include "G4Mars5GeVMechanism.hh"
#include "globals.hh"
#include "G4ios.hh"
#include "Randomize.hh"
#include "G4VParticleChange.hh"
#include "G4Material.hh"
#include "G4Track.hh"
#include "G4Step.hh"
//-------------------------------------------------------
G4Mars5GeVMechanism::G4Mars5GeVMechanism(const G4String& name):
G4VEvtBiasMechanism(name),
EthForIncident(5.0*GeV)
{
theParticleTable = G4ParticleTable::GetParticleTable();
ProtonMass = theParticleTable->FindParticle("proton")->GetPDGMass();
// set some constants
selec3.Eth = 1.0*MeV;
}
G4Mars5GeVMechanism::G4Mars5GeVMechanism(const G4Mars5GeVMechanism& right):
G4VEvtBiasMechanism(right),
EthForIncident(right.EthForIncident)
{
theParticleTable = G4ParticleTable::GetParticleTable();
ProtonMass = right.ProtonMass;
// set some constants
selec3.Eth = right.selec3.Eth;
}
G4Mars5GeVMechanism::~G4Mars5GeVMechanism()
{
}
void G4Mars5GeVMechanism::GetTargetNuclei(const G4Material* material)
{
// get elements in the actual material,
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
const G4int numberOfElements = material->GetNumberOfElements() ;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::GetTargetNuclei" << endl;
}
#endif
fANucl = 0.0;
fZNucl = 0.0;
G4double totNumAtoms = 0.0;
for (G4int iel=0; iel < numberOfElements; iel +=1) {
totNumAtoms += theAtomicNumDensityVector[iel];
fZNucl += theAtomicNumDensityVector[iel]*((*theElementVector)(iel)->GetZ());
fANucl += theAtomicNumDensityVector[iel]*((*theElementVector)(iel)->GetN());
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << iel << ": " << theAtomicNumDensityVector[iel];
G4cout << " Z=" << (*theElementVector)(iel)->GetZ() << " A=" << (*theElementVector)(iel)->GetN();
G4cout << endl;
}
#endif
}
fANucl /= totNumAtoms;
fZNucl /= totNumAtoms;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << "<Z>=" << fZNucl;
G4cout << "<A>=" << fANucl;
G4cout << endl;
}
#endif
}
void G4Mars5GeVMechanism::Treem5()
{
G4double pMass = incidentParticle->GetDefinition()->GetPDGMass();
G4double pE = incidentParticle->GetKineticEnergy();
G4int pType = incidentMarsEncoding;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::Treem5() ";
G4cout << " Incident Particle: " << incidentParticle->GetDefinition()->GetParticleName();
G4cout << " : energy = " << pE/GeV << "[GeV]" << endl;
}
#endif
// CoulombBarrier
if (CoulombBarrier(pType, pE)) return;
G4int ib;
if (pType==MarsAP) {
ib = MarsP;
} else if (pType==MarsGAM){
if ( G4UniformRand() >0.5) {
ib = MarsPIplus;
} else {
ib = MarsPIminus;
}
} else {
ib = pType;
}
selec1.Einc = pE;
if (pE < 0.5*MeV) pE = 0.5*MeV;
selec3.Emax = pE;
selec3.X = 0.0;
selec3.Pt = 0.0;
selec3.P = 0.0;
// Nucleons at E < 5GeV
CreateNucleon(ib, pType, pE);
// Pion+- or Kaon+- at E < 5GeV
CreatePion(ib, pType, pE);
// Pi0 at E < 5GeV
CreatePionZero(ib, pType, pE);
}
G4bool G4Mars5GeVMechanism::CoulombBarrier(G4int pType, G4double pE){
static const G4double EthCoulombBarrier = 20.0* MeV;
static const G4double AvCoulomb = 1.11*MeV;
static const G4double RCoulombTh = 1.0e-5;
// CoulombBarrier
if ( ( pType == MarsP) || ( pType ==MarsPIplus) || ( pType ==MarsKplus) ) {
if ( ( pE < EthCoulombBarrier ) && (fANucl >=1.5) ) {
G4double pMass = GetParticleDefinition(pType)->GetPDGMass();
G4double vCoulomb = AvCoulomb*pow(fZNucl/fANucl, 1./3.);
G4double tc = pE*(fANucl*ProtonMass)/(pMass+(fANucl*ProtonMass));
G4double rCoulomb = 1.0-vCoulomb/tc;
if ( rCoulomb < RCoulombTh ) {
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " Can not interact because of Coulomb Barrier " << endl;
}
#endif
return true;
}
}
}
return false;
}
void G4Mars5GeVMechanism::CreateNucleon(G4int ib, G4int pType, G4double pE)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::CreateNucleon()" << endl;
}
#endif
if ( pType == MarsGAM) {
selec1.Treac = MarsPIplus;
selec1.Tprod = MarsN;
selec1.V10 = 2.5;
} else {
if ( ib == MarsP ) {
selec1.Treac = MarsP;
} else if ( ib == MarsN ) {
selec1.Treac = MarsN;
} else if ( ib == MarsPIplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsPIminus ) {
selec1.Treac = MarsPIminus;
} else if ( ib == MarsKplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsKminus ) {
selec1.Treac = MarsPIminus;
} else {
selec1.Treac = MarsPIminus;
}
if (G4UniformRand()<0.5) {
selec1.Tprod = MarsN;
} else {
selec1.Tprod = MarsP;
}
selec1.V10 = 2.0;
}
if ( SelBS(pType, fANucl, fZNucl) >0.0 ) AddSecondary();
}
void G4Mars5GeVMechanism::CreatePion(G4int ib, G4int pType, G4double pE)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::CreatePion()" << endl;
}
#endif
static const G4double PionProductionEth = 0.28*GeV;
static const G4double KaonProductionEth = 2.0*GeV;
if ( pE<PionProductionEth ) {
if ((ib==MarsP)||(ib==MarsN)) return;
pE += GetParticleDefinition(MarsPIminus)->GetPDGMass();
}
selec1.Einc = pE;
if ( ib == MarsP ) {
selec1.Treac = MarsP;
} else if ( ib == MarsN ) {
selec1.Treac = MarsN;
} else if ( ib == MarsPIplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsPIminus ) {
selec1.Treac = MarsPIminus;
} else if ( ib == MarsKplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsKminus ) {
selec1.Treac = MarsPIminus;
} else {
selec1.Treac = MarsPIminus;
}
if (G4UniformRand()<0.5) {
selec1.Tprod = MarsPIplus;
} else {
selec1.Tprod = MarsPIminus;
}
selec1.V10 = 2.1;
if ( SelBS(pType, fANucl, fZNucl) >0.0 ){
// change secondary into Kaon
if ( pE > PionProductionEth ) {
if ( Rkaon(ib,selec1.Tprod,pE) > G4UniformRand()) {
if (selec1.Tprod==MarsPIminus) {
selec1.Tprod==MarsKminus;
} else {
selec1.Tprod==MarsKplus;
}
}
}
AddSecondary();
}
}
void G4Mars5GeVMechanism::CreatePionZero(G4int ib, G4int pType, G4double pE)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::CreatePionZero()" << endl;
}
#endif
static const G4double PionProductionEth = 0.28*GeV;
if ( pE<PionProductionEth ) {
if ((ib==MarsP)||(ib==MarsN)) return;
}
if ( ib == MarsP ) {
selec1.Treac = MarsP;
} else if ( ib == MarsN ) {
selec1.Treac = MarsN;
} else if ( ib == MarsPIplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsPIminus ) {
selec1.Treac = MarsPIminus;
} else if ( ib == MarsKplus ) {
selec1.Treac = MarsPIplus;
} else if ( ib == MarsKminus ) {
selec1.Treac = MarsPIminus;
} else {
selec1.Treac = MarsPIminus;
}
selec1.Tprod = MarsKplus;
selec1.V10 = 1.0;
if ( SelBS(pType, fANucl, fZNucl) >0.0 ) {
selec1.Tprod = MarsPI0;
AddSecondary();
}
}
void G4Mars5GeVMechanism::AddSecondary()
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::AddSecondary()" << endl;
G4cout << " Particle :" << selec1.Tprod;
G4cout << ":" << GetParticleName(selec1.Tprod) <<endl;
G4cout << " Energy :" << selec1.EN <<endl;
G4cout << "Weight :" << selec1.V * incidentWeight << endl;
}
#endif
// determine direction cosine
G4double g = 1.0;
while (g>=1.0) {
G4double g1 = G4UniformRand();
G4double g2 = G4UniformRand();
G4double gg = 2.0*g1 - 1.0;
g = gg*gg + g2*g2;
selec2.Ch = (gg*gg - g2*g2)/g;
selec2.Sh = 2.0*gg*g2/g;
}
G4ThreeVector pin = incidentParticle->GetMomentumDirection();
G4ThreeVector pout;
Trans(&pin, &pout);
if (numberOfSecondaries>=FastVectorSize) {
G4Exception(" G4Mars5GeVMechanism::AddSecondary() too many secondaries");
}
// create seconday Dynamic Particle
G4DynamicParticle* secondary =
new G4DynamicParticle(GetParticleDefinition(selec1.Tprod),
pout.unit(),
selec1.EN);
// add secondary into list
secondaries.SetElement(numberOfSecondaries, secondary);
weightOfSecondaries[numberOfSecondaries] = selec1.V * incidentWeight;
numberOfSecondaries +=1;
}
G4double G4Mars5GeVMechanism::SelBS(G4int pType, G4double aNucl, G4double zNucl)
{
static const G4double Atau= 0.2;
static const G4double Btau= 0.5*GeV;
G4int nc = 0;
G4int ip = selec1.Treac; // reaction particle type
G4int jp = selec1.Tprod; // procduction particle type
G4int jj = pType; // incident particle type
G4double e0 = selec1.Einc;
G4double en;
G4double v2 = 0.0;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::SelBS" << endl;
G4cout << " pType = " << pType << " e0 = " << e0 << endl;
G4cout << " aNucl = " << aNucl << " zNucl = " << zNucl << endl;
G4cout << " Treac = " <<selec1.Treac;
G4cout << " Tprod = " <<selec1.Tprod << endl;
}
#endif
while(1){
G4double g1 = G4UniformRand();
G4double g2 = G4UniformRand();
// calculate energy
G4double dw = 0.0;
if (ip==jp) {
G4double ea = e0 * 0.01;
if (ea < selec3.Eth) {
dw = selec3.Emax-selec3.Eth;
en = selec3.Eth + g1*dw;
} else {
G4double cb = log(ea/selec3.Eth);
G4double ca = cb + 99.0;
if (g1<cb/ca) {
en = selec3.Eth*exp(g1*ca);
dw = en*ca;
} else {
en = ea*(g1*ca + 1.0 - cb);
dw = ea*ca;
}
}
} else {
en = selec3.Eth*pow(selec3.Emax/selec3.Eth, g1);
dw = en*log(selec3.Emax/selec3.Eth);
}
selec1.EN = en;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << "selec1.EN = " << en << endl;
}
#endif
if (en<0.5*MeV) {
selec1.V = 0.0;
return selec1.V;
}
// calculate direction cosine
G4double tau = en/Atau/e0*(Btau+e0);
G4double c5 = 1.0-exp(-pi*tau);
G4double c4 = 1.0-g2*c5;
G4double t1 = -log(c4)/tau;
G4double rcs = cos(t1);
G4double rss = sqrt(1.0-rcs*rcs);
G4double da = 2.0*pi*rss*c5/(tau+c4);
selec2.Cs = rcs;
selec2.Ss = rss;
// select particle type
G4int ib = ip;
if (ip == MarsP) {
ib = MarsN;
} else if (ip == MarsN) {
ib = MarsP;
}
G4int jb = jp;
if ( ( jj==MarsGAM ) && ((jp!=MarsP)||(jp!=MarsN)) ){
jb = MarsKplus;
} else if (jp == MarsP) {
jb = MarsN;
} else if (jp == MarsN) {
jb = MarsP;
}
// calculate V
nc +=1;
v2 = dw*D2N2(jj, e0, en, t1, ib, jb, aNucl, zNucl)*da*(selec1.V10);
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " D2N2 = " << v2/(dw*da*(selec1.V10));
G4cout << " v2 = " << v2 << endl;
}
#endif
if (v2>0.0) break;
if (nc >=3) {
selec1.V = 0.0;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << "exceed retry limit !!" << endl;
}
#endif
return selec1.V;
}
}
selec1.V = v2;
return v2;
}
G4double G4Mars5GeVMechanism::D2N2(G4int pType, G4double incidentE,
G4double prodE, G4double tin,
G4int reacType, G4int proType,
G4double ai, G4double z)
{
// Hadron inclusive yield at E0 < 5 GeV
// All parametrizations are based on
// the energy unit of MeV
//
// Original code is written by Nikolai Mokhov (Fermilab)
//C Copyright Nikolai Mokhov (Fermilab)
//C
//C MARS13(98)
//C
//C HADRON INCLUSIVE YIELD AT E0 < 5 GEV
//C-----
//C CREATED: 1979 BY B.SYCHEV
//C MODIFIED: 1979-1998 BY NVM
//C LAST CHANGE: 16-JUL-1998 BY NVM
static const G4double o2pi = 1./twopi;
static const G4double ospi = 1./sqrt(pi);
static G4double abu = 0.0;
static G4double alga = 0.0;
static G4double a13 = 1.0;
static G4double a23 = 1.0;
static G4double a125 = 1.0;
static G4double am25 = 0.0;
static G4double sqa = 1.0;
static G4double sqa1 = 0.0;
static G4double bm = 2.0;
static G4double sl;
static G4double sa;
// input of this method
G4double e0 = incidentE/MeV; // SHOULD BE GIVEN BY MEV !!!
G4double e = prodE/MeV; // SHOULD BE GIVEN BY MEV !!!
G4double t = tin;
G4int i = reacType;
G4int j = proType;
G4int jj = pType;
// output of this method
G4double d2n = 0.0;
G4double dnde = 0.0; // this value is not used anywhere else
if(ai<1.0) return 0.0;
G4double a = ai;
if(abu!=a)
{
abu = a;
if(a<=2.0)
{
alga = 0.0;
a13 = 1.0;
a23 = 1.0;
a125 = 1.0;
am25 = 0.0;
sqa = 1.0;
sqa1 = 0.0;
bm = 2.0;
}
else
{
alga = log(a);
a13 = pow(a,1./3.);
a23 = a13*a13;
a125 = pow(a,-1.25);
am25 = pow(a-1.0,0.25);
sqa = sqrt(a);
sqa1 = sqrt(a-1.);
bm = 1.0 + sqa;
}
sl = 0.72/pow(1.+alga,0.4);
sa = 0.087*a23 + 4.15;
}
G4double bn;
if(a<=2.0)
{
if(i*j<9 && t>halfpi) return 0.0;
bn = 2.0;
if(i>=3) bn = 1.0;
}
else
{ bn = bm*exp(-sa*pow(3.68/e0,sl)); }
G4double emm = e0;
G4double e1ge = 0.001*e0;
G4double e2ge = e1ge*e1ge;
G4double f21 = 0.04/(e2ge*e2ge);
G4double f31 = 0.38*pow(e1ge,-0.65);
G4double f22 = 0.25/e2ge;
G4double f32 = am25*0.7/(e1ge+1.);
G4double ei2 = 0.0;
G4double x1 = f21 + f31;
if(x1<60.) ei2 = 0.8*exp(-x1);
G4double ei1 = ei2;
if(a>2.0)
{
ei1 = 0.;
x1 = f22 + f32;
if(x1<60.) ei1 = exp(-x1);
}
G4double ew1 = ei2;
G4double dnl = 0.0;
G4double dnl1 = 0.0;
G4double eli = 0.0;
if(ew1>=1.e-19)
{
G4double dli = 35.0*ew1/(a+69.0);
eli = 0.5*dli*e0;
if(i==j)
{ dnl1 = dli*(2./3.)/e0; }
else
{ dnl1 = dli*(1.-e/e0)/e0; }
dnl = dli*(5./3.-e/e0)/e0;
}
G4double qel = 1.0 - ei1;
if(a>2.0)
{
G4double e02 = pow(e0/350.,1.5);
G4double ex2 = 1.0;
if(e02<60.) ex2 = 1.0-exp(-e02);
qel = 0.0;
if(t<halfpi) qel = 1.17*ex2*exp(-0.08*sqa1)*(1.-ew1);
}
G4int in = i; // save i
G4double sw2 = (0.5+10.*e2ge/(2.+e1ge))*(4.+e0/470.);
G4double sql = sw2/(2.+e0/940.)-1.0;
G4double eql = 0.0;
G4double dnq = 0.0;
if(jj!=MarsGAM || j!=5)
{
if(qel>1.e-25)
{
eql = qel*e0*(sql+1.)/(sql+2.);
G4double bp1x = -60./log(e/e0);
if(sql<=bp1x)
{
bp1x = pow(e/e0,sql);
dnq = qel/e0*(sql+1.)*bp1x;
}
}
}
G4double bp1 = e0;
if(e0<1.e9) bp1 = sqrt(e0*e0+1880.*e0);
G4double pul = 1.e-3*bp1;
bp1 = 3.*pow(pul,0.25) - 2.0;
if(bp1<1.) bp1 = 1.;
G4double bpi = 0.0;
if(ei1>0.) bpi = bp1*exp(0.075*sqa1)*ei1;
G4double ec = 0.0;
if(a>2.0) ec = 10.5 - 0.02*a;
G4double g = 0.1*alga + 0.2;
G4double eog = pow(e0,g);
G4double f1 = 1./3.*ec*a/(1.8*eog);
x1 = 1.0;
if(f1<60.) x1 = 1.0 - exp(-f1);
G4double fm = 1.8*eog*x1;
G4double ez = ec + fm;
if(fm>=e0) ez = ec + e0;
G4double d = 1.0;
if(i>=3) d = 0.0;
x1 = 1.0;
if(a<=44.) x1 = exp(-exp(4.-a));
G4double ez2 = 33.5*a125*x1*(ez-ec)*(1.-ez/(ec-e0));
G4double epw = e0 - ez - (bn-d)*ec - 140.*bpi - ez2;
G4double e2 = epw - eli - eql;
G4double ak1 = 3.0;
G4double ak20 = 5.e-4*(1.+a13)*e0;
x1 = 1.0;
if(ak20<60.) x1 = 1.0 - exp(-ak20);
G4double ga = pow(e1ge,0.06)*ak1*x1;
G4double egr = e0/(ga+1.);
G4double d2 = 250.*(1.+2.5*e0*exp(-0.02*a)/(e0+1.e3))/sqa;
G4double aea = e2/(e0*(1./(1.+ga)-d2*log(1.+egr/d2)/e0));
aea *= 1./(1.+d2*(ga+1.)/(3.*e0*(d2/e0+1.75)));
if(i<=2 && j>=3)
{
emm = e0 - 140.;
if(j!=5 && a!=1. && (i+j)!=5) emm = e0 - 280;
}
G4double dn = 0.0;
if(e<=emm) dn = aea*(e0/emm)*pow(1.-e/emm,ga)/(e+d2);
if(i>=3) bpi += 1;
dnde = dn + dnq + dnl;
// In original code, check nupr. But in this code, nupr is aliways set to 0
// if(nupr==1) return;
G4double pna = bpi/bp1;
G4double pns = bn+bpi;
// Angular distribution
G4double qe = 0.0;
if((jj!=MarsGAM || j!=5)
&&(t<halfpi)
&&(i<3||i==j||j>4)
&&(i>2||j<3)
&&(a>2.0||i!=2||j!=1)
&&(qel>=1.e-26))
{
G4double d1 = 25.*(1.+0.008*e0*t);
G4double dp;
if(i==j)
{ dp = 0.8; }
else
{ dp = 0.2; }
if(a<=2.&&i==1&&j<=2) dp = 0.5;
if(a<=2.&&i==2&&j==2) dp = 1.0;
G4double eq = e0*sqr(cos(t))/(1.+e0*sqr(sin(t))/1880.) - 25.0;
G4double exq = sqr((e-eq)/d1) + 0.5*sw2*t*t;
if(exq<60.) qe = qel*sw2*exp(-exq)*dp*ospi/d1;
}
G4int iold = i;
if(i==3) i = 2;
if(i==4) i = 1;
G4bool condA = a<2. && i==2;
G4bool condB = a<2.;
G4double az;
G4double pn;
G4double pr;
if(!condB)
{
if(i==2)
{ az = (z+1.)/(a-z); }
else
{ az = (a+1.-z)/z; }
x1 = 0.5*e1ge;
pn = az;
if(x1<60.) pn *= 1. + exp(-x1);
if(i==j)
{ pr = bn*pn/(1.+pn); }
else
{ pr = bn/(1.+pn); }
}
if(condA || !condB)
{
if(i==1) az = z/(a-z);
if(i==2) az = (a-z)/z;
G4double bp = 1.0;
G4double e0g = e1ge*e2ge;
if(e0g<60.) bp -= 0.5*exp(-e0g);
G4double ap = az * bp;
bp = 6.*(1.+ap);
if((i==1&&j==3)||(i==2&&j==4)) pr = pna*(bp1/3.-(2.+ap)/bp);
if((i==2&&j==3)||(i==1&&j==4)) pr = pna*(bp1/3.+(3.-ap)/bp);
if(j==5) pr = pna*(bp1/3.+(2.*ap-1.)/bp);
}
if(condB)
{
switch(i)
{
case 1:
switch(j)
{
case 1:
case 2:
pr = bn/2.; break;
case 3:
case 4:
pr = pna*(bp1/3.-1./6.); break;
case 5:
pr = pna*(bp1+1.)/3.; break;
}
break;
case 2:
switch(j)
{
case 1:
pr = 0.33*ew1/bn; break;
case 2:
pr = (1.-0.33*ew1)/bn; break;
}
break;
}
}
G4double ek3 = 0.01*sqrt(e1ge)*(1.+alga/4.);
G4double tay = 200.*e0/(e0+560.);
G4double w = e/tay;
G4double ek4 = 1.21*e0*w/(sqrt(1.+alga)*(e0+2000.));
if(j>=3) ek4 = 0.3*w*(e0-1000.)/(e0+1000.);
G4double wpic = w*pi;
G4double w2 = w*w;
G4double ex8 = 1.0;
if(wpic<60.) ex8 /= 1.0 + exp(-wpic);
G4double ek = (1.+w2)*(1.+5.2*ek4/(2.+w2))*ex8;
G4double wtw = 2.*(sqrt(1.+ek3*e*t*1.e-3)-1.)/(tay*ek3*1.e-3)+ek4*t*t;
G4double sm = 0.0;
if(dn>=1.e-26 && wtw<60.) sm = pr*dn*ek*exp(-wtw)/pns;
G4double dl = 0.0;
i = iold;
if((dnl1>=1.e-20)
&&(i<3||i==j||j>4)
&&(i>2||j<3))
{
tay = 200.*e0/(e0+2600.);
w = e/tay;
ek4 = 1.21*e0*w/(sqrt(1.+alga)*(e0+2000.));
i = in;
wpic = w*pi;
w2 = w*w;
ex8 = 1.0;
if(wpic<60.) ex8 /= 1.0 + exp(-wpic);
wtw = w*t + ek4*t*t;
if(wtw<60.)
{
G4double ft = (1.+w2)*(1.+5.2*ek4/(2.+w2))*exp(-wtw)*ex8;
if(ft>=1.-16)
{
G4double dp;
if(i==j)
{ dp = 2./3.; }
else
{ dp = 1./3.; }
if(a<=2.&&i==1&&j==2) dp = 0.5;
dl = dp*dnl1*ft;
}
}
}
if(jj==MarsGAM && j==5)
{
sm *= 0.6;
dl *= 2.0;
}
d2n = o2pi*(qe+sm+dl);
// d2n value is calculated in unit of [1/MeV]
d2n *= (1./MeV);
return d2n;
}
G4double G4Mars5GeVMechanism::Rkaon(G4int ib, G4int jp, G4double eRaw)
{
// Energy dependent K/pi ratio
// Parametrizations are valid for energy range of
// incident particle as 2.0 GeV to 100 GeV
// All parametrizations in this method are based on
// the energy unit of GeV.
//
// Original code is written by Nikolai Mokhov (Fermilab)
//C Copyright Nikolai Mokhov (Fermilab)
//C
//C MARS13(98)
//C ENERGY DEPENDENT K/PI RATIO
//C FOR GIVEN TREEM AND SELMO PARAMETERS
//C-----
//C CREATED: 1996 BY N.MOKHOV (NVM)
//C LAST CHANGE: 12-FEB-1996 BY NVM
static const G4double rkp = 0.071;
static const G4double rkm = 0.083;
static const G4double al2 = 0.69314718;
static const G4double al100 = 4.6051702;
static const G4double al21 = 3.0445224;
static const G4double al51 = 3.9318256;
G4double eGeV = eRaw / GeV;
G4double rK = 0.;
if(eGeV < 2.1) return rK;
G4double ale = log(eGeV);
// No.1
rK = rkp;
if(jp == MarsPIminus) rK = rkm;
if(ib == MarsPIplus || ib == MarsPIminus) rK *= 1.3;
else if(ib == MarsKplus || ib == MarsKminus) rK *= 2.0;
G4double rK1 = rK;
if(eGeV<100.)
{
G4double rmi = 0.03;
if(ib >= MarsPIplus) rmi = 0.08;
rK1 = rmi + (rK-rmi)*(ale-al2)/(al100-al2);
}
// No.2
if(eGeV<=5.2 || eGeV>=51.0) {
rK = 1.3*rK1;
} else if(eGeV<7.2) {
rK = rK1*(1.3+0.15*(eGeV-5.2));
} else if(eGeV<21.) {
rK = 1.6*rK1;
} else {
rK = rK1*(1.3+0.3*(al51-ale)/(al51-al21));
}
return rK;
}
void G4Mars5GeVMechanism::Trans(G4ThreeVector* d1,G4ThreeVector* d2)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::Trans() " << endl;
}
#endif
// Direction cosine transformation
// using (cs,ss,ch,sh)
// inputs
G4double cs = selec2.Cs;
G4double ss = selec2.Ss;
G4double ch = selec2.Ch;
G4double sh = selec2.Sh;
G4double sss, ttt, uuu;
G4double dx1 = d1->x();
G4double dy1 = d1->y();
G4double dz1 = d1->z();
G4double sz = dx1*dx1 + dy1*dy1;
if(sz > 1.e-50)
{
sz = sqrt(sz);
sss = ss*(ch*dz1*dx1-sh*dy1)/sz + cs*dx1;
ttt = ss*(ch*dz1*dy1+sh*dx1)/sz + cs*dy1;
uuu = - ss*ch*sz + cs*dz1;
}
else
{
sss = ss*ch + dx1;
ttt = ss*sh + dy1;
uuu = cs*dz1;
}
G4double den = sqrt(sss*sss+uuu*uuu+ttt*ttt);
d2->setX(sss/den);
d2->setY(ttt/den);
d2->setZ(uuu/den);
return;
}
G4VParticleChange* G4Mars5GeVMechanism::ApplyMath(
G4VParticleChange* pVPChange,
const G4Step& aStep )
{
G4VParticleChange* pChange = (pVPChange);
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " G4Mars5GeVMechanism::ApplyMath" << endl;
}
#endif
G4Track* incidentTrack = aStep.GetTrack();
incidentParticle = incidentTrack->GetDynamicParticle();
incidentWeight = pChange->GetParentWeight();
// check incident energy below this model is active
if (incidentParticle->GetKineticEnergy() > EthForIncident) return pChange;
if (incidentParticle->GetKineticEnergy() < 1.0*MeV) return pChange;
// check the incident particle type
incidentMarsEncoding = GetMarsEncoding(incidentParticle->GetDefinition());
if ( !IsApplicable(incidentMarsEncoding) ) return pChange;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cout << " OK the particle is applicable" << endl;
}
#endif
// examine whether the current process is "hadronic interaction"
// by checking secondaries
G4int idx;
G4bool flag = false;
for (idx=0; (!flag) && (idx<pChange->GetNumberOfSecondaries()); idx+=1){
G4String type = pChange->GetSecondary(idx)->GetDefinition()->GetParticleType();
flag |= (type=="baryon")||(type=="nucleus")||(type=="meson");
}
if (!flag) return pChange;
// Atomic and charge number
GetTargetNuclei( incidentTrack->GetMaterial() );
// initialize secondary information
numberOfSecondaries = 0;
secondaries.Initialize(FastVectorSize);
// clean up ParticleChange
for (idx=0; idx<pChange->GetNumberOfSecondaries(); idx+=1){
delete pChange->GetSecondary(idx);
}
pChange->Clear();
// invoke MARS
Treem5();
//
pChange->SetNumberOfSecondaries(numberOfSecondaries);
G4Track* track;
for (idx=0; idx<numberOfSecondaries; idx+=1){
track = new G4Track(
secondaries[idx],
incidentTrack->GetGlobalTime(),
incidentTrack->GetPosition()
);
track->SetWeight( weightOfSecondaries[idx] );
pChange->AddSecondary(track);
}
pChange->SetStatusChange(fStopAndKill);
pChange->SetLocalEnergyDeposit (0.);
return pChange;
}
+436
View File
@@ -0,0 +1,436 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChange.cc,v 2.10 1998/12/16 12:21:47 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
// Change default debug flag to false 10 May. 1998 H.Kurahige
// Add Track weight 12 Nov. 1998 H.Kurashige
// Activate CheckIt method for VERBOSE mode 14 Dec. 1998 H.Kurashige
// --------------------------------------------------------------
#include "G4ParticleChange.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
G4bool G4ParticleChange::fUseEBForAll = false;
G4ParticleChange::G4ParticleChange():G4VParticleChange(false)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::G4ParticleChange() " << endl;
}
#endif
}
G4ParticleChange::G4ParticleChange(G4bool useEB):G4VParticleChange(useEB)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::G4ParticleChange() " << endl;
}
#endif
}
G4ParticleChange::~G4ParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::~G4ParticleChange() " << endl;
}
#endif
}
// copy constructor
G4ParticleChange::G4ParticleChange(const G4ParticleChange &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChange:: copy constructor is called " << endl;
}
theMomentumChange = right.theMomentumChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
theEnergyChange = right.theEnergyChange;
theWeightChange = right.theWeightChange;
}
// assignemnt operator
G4ParticleChange & G4ParticleChange::operator=(const G4ParticleChange &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChange:: assignment operator is called " << endl;
}
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theMomentumChange = right.theMomentumChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
theEnergyChange = right.theEnergyChange;
theWeightChange = right.theWeightChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
}
return *this;
}
G4bool G4ParticleChange::operator==(const G4ParticleChange &right) const
{
return ((G4VParticleChange *)this == (G4VParticleChange *) &right);
}
G4bool G4ParticleChange::operator!=(const G4ParticleChange &right) const
{
return ((G4VParticleChange *)this != (G4VParticleChange *) &right);
}
//----------------------------------------------------------------
// methods for handling secondaries
//
void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
G4bool IsGoodForTracking )
{
// create track
G4Track* aTrack = new G4Track(aParticle, theTimeChange, thePositionChange);
// set IsGoodGorTrackingFlag
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
}
void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
G4ThreeVector newPosition,
G4bool IsGoodForTracking )
{
// create track
G4Track* aTrack = new G4Track(aParticle, theTimeChange, newPosition);
// set IsGoodGorTrackingFlag
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
}
void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
G4double newTime,
G4bool IsGoodForTracking )
{
// create track
G4Track* aTrack = new G4Track(aParticle, newTime, thePositionChange);
// set IsGoodGorTrackingFlag
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
}
void G4ParticleChange::AddSecondary(G4Track* aTrack)
{
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
}
//----------------------------------------------------------------
// functions for Initialization
//
void G4ParticleChange::Initialize(const G4Track& track)
{
// use base class's method at first
G4VParticleChange::Initialize(track);
// set Energy/Momentum etc. equal to those of the parent particle
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
theEnergyChange = pParticle->GetKineticEnergy();
theMomentumChange = pParticle->GetMomentumDirection();
thePolarizationChange = pParticle->GetPolarization();
theProperTimeChange = pParticle->GetProperTime();
// set Position/Time etc. equal to those of the parent track
thePositionChange = track.GetPosition();
theTimeChange = track.GetGlobalTime();
theWeightChange = track.GetWeight();
}
//----------------------------------------------------------------
// methods for updating G4Step
//
G4Step* G4ParticleChange::UpdateStepForAlongStep(G4Step* pStep)
{
// A physics process always calculates the final state of the
// particle relative to the initial state at the beginning
// of the Step, i.e., based on information of G4Track (or
// equivalently the PreStepPoint).
// So, the differences (delta) between these two states have to be
// calculated and be accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMometum. Also it is a normalized
// momentum vector.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// calculate new kinetic energy
G4double energy = pPostStepPoint->GetKineticEnergy()
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
// update kinetic energy and momentum direction
if (energy > 0.0) {
// calculate new momentum
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
+ ( CalcMomentum(theEnergyChange, theMomentumChange, mass)
- pPreStepPoint->GetMomentum());
G4double tMomentum = pMomentum.mag();
G4ThreeVector direction( pMomentum.x()/tMomentum,
pMomentum.y()/tMomentum,
pMomentum.z()/tMomentum );
pPostStepPoint->SetMomentumDirection(direction);
pPostStepPoint->SetKineticEnergy( energy );
} else {
// stop case
pPostStepPoint->SetMomentumDirection(G4ThreeVector(1., 0., 0.));
pPostStepPoint->SetKineticEnergy(0.0);
}
// update polarization
pPostStepPoint->AddPolarization( thePolarizationChange
- pPreStepPoint->GetPolarization());
// update position and time
pPostStepPoint->AddPosition( thePositionChange
- pPreStepPoint->GetPosition() );
pPostStepPoint->AddGlobalTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
pPostStepPoint->AddLocalTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
pPostStepPoint->AddProperTime( theProperTimeChange
- pPreStepPoint->GetProperTime());
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
if (debugFlag) CheckIt(*aTrack);
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChange::UpdateStepForPostStep(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMometum. Also it is a normalized
// momentum vector.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// update kinetic energy and momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
pPostStepPoint->SetKineticEnergy( theEnergyChange );
// update polarization
pPostStepPoint->SetPolarization( thePolarizationChange );
// update position and time
pPostStepPoint->SetPosition( thePositionChange );
pPostStepPoint->SetGlobalTime( theTimeChange );
pPostStepPoint->AddLocalTime( theTimeChange
- aTrack->GetGlobalTime());
pPostStepPoint->SetProperTime( theProperTimeChange );
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
if (debugFlag) CheckIt(*aTrack);
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChange::UpdateStepForAtRest(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// update kinetic energy and momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
pPostStepPoint->SetKineticEnergy( theEnergyChange );
// update polarization
pPostStepPoint->SetPolarization( thePolarizationChange );
// update position and time
pPostStepPoint->SetPosition( thePositionChange );
pPostStepPoint->SetGlobalTime( theTimeChange );
pPostStepPoint->AddLocalTime( theTimeChange
- aTrack->GetGlobalTime());
pPostStepPoint->SetProperTime( theProperTimeChange );
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
if (debugFlag) CheckIt(*aTrack);
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
//----------------------------------------------------------------
// methods for printing messages
//
void G4ParticleChange::DumpInfo() const
{
// use base-class DumpInfo
G4VParticleChange::DumpInfo();
G4cout.precision(3);
G4cout << " Position - x (mm) : "
<< setw(20) << thePositionChange.x()/mm
<< endl;
G4cout << " Position - y (mm) : "
<< setw(20) << thePositionChange.y()/mm
<< endl;
G4cout << " Position - z (mm) : "
<< setw(20) << thePositionChange.z()/mm
<< endl;
G4cout << " Time (ns) : "
<< setw(20) << theTimeChange/ns
<< endl;
G4cout << " Proper Time (ns) : "
<< setw(20) << theProperTimeChange/ns
<< endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << theMomentumChange.x()
<< endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << theMomentumChange.y()
<< endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << theMomentumChange.z()
<< endl;
G4cout << " Kinetic Energy (MeV): "
<< setw(20) << theEnergyChange/MeV
<< endl;
G4cout << " Polarization - x : "
<< setw(20) << thePolarizationChange.x()
<< endl;
G4cout << " Polarization - y : "
<< setw(20) << thePolarizationChange.y()
<< endl;
G4cout << " Polarization - z : "
<< setw(20) << thePolarizationChange.z()
<< endl;
if (fUseEB) {
G4cout << " Track Weight : "
<< setw(20) << theWeightChange
<< endl;
}
}
G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
{
G4bool itsOK = true;
// if (theEnergyChange > aTrack.GetKineticEnergy()) {
// G4cout << " !!! the energy becomes larger than the initial energy !!!"
// << " : " << (theEnergyChange -aTrack.GetKineticEnergy())/MeV
// << "MeV " <<endl;
// itsOK = false;
// }
if ( (theEnergyChange >0.) &&
( abs(theMomentumChange.mag2()-1.0) > perMillion ) ){
G4cout << " !!! the Momentum Change is not unit vector !!!!"
<< " : " << theMomentumChange.mag()
<< endl;
itsOK = false;
}
if (theTimeChange < aTrack.GetGlobalTime()) {
G4cout << " !!! the global time goes back !!!"
<< " : " << aTrack.GetGlobalTime()/ns
<< " -> " << theTimeChange/ns
<< "[ns] " <<endl;
itsOK = false;
}
if (theProperTimeChange < aTrack.GetProperTime()) {
G4cout << " !!! the poper time goes back !!!"
<< " : " << aTrack.GetProperTime()/ns
<< " -> " << theProperTimeChange/ns
<< "[ns] " <<endl;
itsOK = false;
}
if (!itsOK) {
G4cout << " G4ParticleChange::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
G4Exception("G4ParticleChange::CheckIt");
}
return itsOK;
}
@@ -0,0 +1,138 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForDecay.cc,v 2.2 1998/07/20 06:11:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
// Remove modification of energy/momentum 20 Jul, 1998 H.Kurashige
// --------------------------------------------------------------
#include "G4ParticleChangeForDecay.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
G4ParticleChangeForDecay::G4ParticleChangeForDecay():G4VParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForDecay::G4ParticleChangeForDecay() " << endl;
}
#endif
}
G4ParticleChangeForDecay::~G4ParticleChangeForDecay()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForDecay::~G4ParticleChangeForDecay() " << endl;
}
#endif
}
// copy and assignment operators are implemented as "shallow copy"
G4ParticleChangeForDecay::G4ParticleChangeForDecay(const G4ParticleChangeForDecay &right)
{
*this = right;
}
G4ParticleChangeForDecay & G4ParticleChangeForDecay::operator=(const G4ParticleChangeForDecay &right)
{
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
}
return *this;
}
G4bool G4ParticleChangeForDecay::operator==(const G4ParticleChangeForDecay &right) const
{
return ((G4VParticleChange *)this == (G4VParticleChange *) &right);
}
G4bool G4ParticleChangeForDecay::operator!=(const G4ParticleChangeForDecay &right) const
{
return ((G4VParticleChange *)this != (G4VParticleChange *) &right);
}
//----------------------------------------------------------------
// methods for Initialization
//
void G4ParticleChangeForDecay::Initialize(const G4Track& track)
{
// use base class's method at first
G4VParticleChange::Initialize(track);
// set Time e equal to those of the parent track
theTimeChange = track.GetGlobalTime();
}
//----------------------------------------------------------------
// methods for updating G4Step
//
G4Step* G4ParticleChangeForDecay::UpdateStepForPostStep(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChangeForDecay::UpdateStepForAtRest(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
// update time
pPostStepPoint->SetGlobalTime( theTimeChange );
pPostStepPoint->AddLocalTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
pPostStepPoint->AddProperTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
void G4ParticleChangeForDecay::DumpInfo() const
{
// Show header
G4VParticleChange::DumpInfo();
G4cout.precision(3);
G4cout << " Time (ns) : "
<< setw(20) << theTimeChange/ns
<< endl;
}
+158
View File
@@ -0,0 +1,158 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForLoss.cc,v 2.1 1998/12/02 17:20:26 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
// --------------------------------------------------------------
#include "G4ParticleChangeForLoss.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
G4ParticleChangeForLoss::G4ParticleChangeForLoss():G4VParticleChange()
{
debugFlag = false;
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForLoss::G4ParticleChangeForLoss() " << endl;
}
#endif
}
G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForLoss::~G4ParticleChangeForLoss() " << endl;
}
#endif
}
// copy constructor
G4ParticleChangeForLoss::G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForLoss:: copy constructor is called " << endl;
}
theEnergyChange = right.theEnergyChange;
}
// assignemnt operator
G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(const G4ParticleChangeForLoss &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForLoss:: assignment operator is called " << endl;
}
if (this != &right)
{
theEnergyChange = right.theEnergyChange;
theLocalEnergyDeposit = right.theLocalEnergyDeposit ;
}
return *this;
}
//----------------------------------------------------------------
// functions for Initialization
//
void G4ParticleChangeForLoss::Initialize(const G4Track& track)
{
// use base class's method at first
G4VParticleChange::Initialize(track);
// set Energy equal to those of the parent particle
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
theEnergyChange = pParticle->GetKineticEnergy();
}
//----------------------------------------------------------------
// methods for updating G4Step
//
G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
{
// A physics process always calculates the final state of the
// particle relative to the initial state at the beginning
// of the Step, i.e., based on information of G4Track (or
// equivalently the PreStepPoint).
// So, the differences (delta) between these two states have to be
// calculated and be accumulated in PostStepPoint.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
// calculate new kinetic energy
G4double energy = pPostStepPoint->GetKineticEnergy()
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
// update kinetic energy and momentum direction
if (energy > 0.0) {
pPostStepPoint->SetKineticEnergy( energy );
} else {
// stop case
pPostStepPoint->SetKineticEnergy(0.0);
}
if (debugFlag) CheckIt(*aTrack);
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
//----------------------------------------------------------------
// methods for printing messages
//
void G4ParticleChangeForLoss::DumpInfo() const
{
// use base-class DumpInfo
G4VParticleChange::DumpInfo();
G4cout.precision(3);
G4cout << " Kinetic Energy (MeV): "
<< setw(20) << theEnergyChange/MeV
<< endl;
}
G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
{
G4bool itsOK = true;
if (theEnergyChange > aTrack.GetKineticEnergy()) {
G4cout << " !!! the energy becomes larger than the initial energy !!!"
<< " : " << (theEnergyChange -aTrack.GetKineticEnergy())/MeV
<< "MeV " <<endl;
itsOK = false;
}
if (!itsOK) {
G4cout << " G4ParticleChange::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
}
return itsOK;
}
+166
View File
@@ -0,0 +1,166 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForMSC.cc,v 2.1 1998/12/02 17:20:25 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
// --------------------------------------------------------------
#include "G4ParticleChangeForMSC.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
G4ParticleChangeForMSC::G4ParticleChangeForMSC():G4VParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForMSC::G4ParticleChangeForMSC() " << endl;
}
#endif
}
G4ParticleChangeForMSC::~G4ParticleChangeForMSC()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForMSC::~G4ParticleChangeForMSC() " << endl;
}
#endif
}
G4ParticleChangeForMSC::G4ParticleChangeForMSC(
const G4ParticleChangeForMSC &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForMSC:: copy constructor is called " << endl;
}
*this = right;
}
// assignment operator
G4ParticleChangeForMSC & G4ParticleChangeForMSC::operator=(
const G4ParticleChangeForMSC &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForMSC:: assignment operator is called " << endl;
}
if (this != &right)
{
theMomentumChange = right.theMomentumChange;
thePositionChange = right.thePositionChange;
theTrueStepLength = right.theTrueStepLength;
}
return *this;
}
//----------------------------------------------------------------
// functions for Initialization
//
void G4ParticleChangeForMSC::Initialize(const G4Track& track)
{
// use base class's method at first
G4VParticleChange::Initialize(track);
// set Energy/Momentum etc. equal to those of the parent particle
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
theMomentumChange = pParticle->GetMomentumDirection();
// set Position equal to those of the parent track
thePositionChange = track.GetPosition();
}
//----------------------------------------------------------------
// methods for updating G4Step
//
G4Step* G4ParticleChangeForMSC::UpdateStepForAlongStep(G4Step* pStep)
{
// Update the G4Step specific attributes
pStep->SetStepLength(theTrueStepLength) ;
return pStep;
}
G4Step* G4ParticleChangeForMSC::UpdateStepForPostStep(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMometum. Also it is a normalized
// momentum vector.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
// update momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
// update position
pPostStepPoint->SetPosition( thePositionChange );
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChangeForMSC::UpdateStepForAtRest(G4Step* pStep)
{
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
//----------------------------------------------------------------
// methods for printing messages
//
void G4ParticleChangeForMSC::DumpInfo() const
{
// use base-class DumpInfo
G4VParticleChange::DumpInfo();
G4cout.precision(3);
G4cout << " Position - x (mm) : "
<< setw(20) << thePositionChange.x()/mm
<< endl;
G4cout << " Position - y (mm) : "
<< setw(20) << thePositionChange.y()/mm
<< endl;
G4cout << " Position - z (mm) : "
<< setw(20) << thePositionChange.z()/mm
<< endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << theMomentumChange.x()
<< endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << theMomentumChange.y()
<< endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << theMomentumChange.z()
<< endl;
}
@@ -0,0 +1,208 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ParticleChangeForTransport.cc,v 2.8 1998/11/10 19:05:18 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 10 May. 1998 H.Kurahige
// Correct tratment of fpNextTouchable 12 May. 1998 H.Kurashige
// --------------------------------------------------------------
#include "G4ParticleChangeForTransport.hh"
#include "G4VTouchable.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
G4ParticleChangeForTransport::G4ParticleChangeForTransport():G4ParticleChange()
{
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForTransport::G4ParticleChangeForTransport() " << endl;
}
}
G4ParticleChangeForTransport::~G4ParticleChangeForTransport()
{
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForTransport::~G4ParticleChangeForTransport() " << endl;
}
}
G4ParticleChangeForTransport::G4ParticleChangeForTransport(const G4ParticleChangeForTransport &right):G4ParticleChange(right)
{
if (verboseLevel>0) {
G4cerr << "G4ParticleChangeForTransport:: copy constructor is called " << endl;
}
theTouchableChange = right.theTouchableChange;
}
// assignemnt operator
G4ParticleChangeForTransport & G4ParticleChangeForTransport::operator=(const G4ParticleChangeForTransport &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForTransport:: assignment operator is called " << endl;
}
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTouchableChange = right.theTouchableChange;
theMomentumChange = right.theMomentumChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
theEnergyChange = right.theEnergyChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
}
return *this;
}
//----------------------------------------------------------------
// methods for updating G4Step
//
G4Step* G4ParticleChangeForTransport::UpdateStepForAtRest(G4Step* pStep)
{
// Nothing happens for AtRestDoIt
if (verboseLevel>0) {
G4cerr << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << endl;
G4cerr << " Nothing happens for this method " << endl;
}
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
{
// copy of G4ParticleChange::UpdateStepForAlongStep
// i.e. no effect for touchable
// A physics process always calculates the final state of the
// particle relative to the initial state at the beginning
// of the Step, i.e., based on information of G4Track (or
// equivalently the PreStepPoint).
// So, the differences (delta) between these two states have to be
// calculated and be accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMomentum. Also it is a normalized
// momentum vector.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = mass = aTrack->GetDynamicParticle()->GetMass();
// uodate kinetic energy
// now assume that no energy change in transportation
// However it is not true in electric fields
// Case for changing energy will be implemented in future
// update momentum direction and energy
if (isMomentumChanged) {
G4double energy;
energy= pPostStepPoint->GetKineticEnergy()
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
// calculate new momentum
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
+ ( CalcMomentum(theEnergyChange, theMomentumChange, mass)
- pPreStepPoint->GetMomentum());
G4double tMomentum_inv = 1.0 / pMomentum.mag();
pPostStepPoint->SetMomentumDirection(pMomentum*tMomentum_inv);
pPostStepPoint->SetKineticEnergy( energy );
}
// stop case should not occur
//pPostStepPoint->SetMomentumDirection(G4ThreeVector(1., 0., 0.));
// update polarization
//pPostStepPoint->AddPolarization( thePolarizationChange
// - pPreStepPoint->GetPolarization());
// update position and time
pPostStepPoint->AddPosition( thePositionChange
- pPreStepPoint->GetPosition() );
pPostStepPoint->AddGlobalTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
pPostStepPoint->AddLocalTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
pPostStepPoint->AddProperTime( theProperTimeChange
- pPreStepPoint->GetProperTime());
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
//pStep->SetStepLength( theTrueStepLength );
// pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
pStep->SetControlFlag( theSteppingControlFlag );
return pStep;
// return UpdateStepInfo(pStep);
}
G4Step* G4ParticleChangeForTransport::UpdateStepForPostStep(G4Step* pStep)
{
// A physics process always calculates the final state of the particle
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
// update next touchable
// (touchable can be changed only at PostStepDoIt)
pPostStepPoint->SetTouchable( theTouchableChange );
// It used to call base class's method
// - but this would copy uninitialised data members
// return G4ParticleChange::UpdateStepForPostStep(pStep);
// Copying what the base class does would instead
// - also not useful
// return G4VParticleChange::UpdateStepInfo(pStep);
return pStep;
}
//----------------------------------------------------------------
// methods for printing messages
//
void G4ParticleChangeForTransport::DumpInfo() const
{
// use base-class DumpInfo
G4ParticleChange::DumpInfo();
G4cout.precision(3);
G4cout << " Touchable (pointer) : "
<< setw(20) << theTouchableChange
<< endl;
}
+186
View File
@@ -0,0 +1,186 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Step.cc,v 2.3 1998/11/18 11:06:46 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4Step.cc
//
// Description:
// This class represents the Step of a particle tracked.
// It includes information of
// 1) List of Step points which compose the Step,
// 2) static information of particle which generated the
// Step,
// 3) trackID and parent particle ID of the Step,
// 4) termination condition of the Step,
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4Step.hh"
#include "G4VProcess.hh"
////////////////
G4Step::G4Step()
////////////////
{
fpPreStepPoint = new G4StepPoint();
fpPostStepPoint = new G4StepPoint();
}
/////////////////
G4Step::~G4Step()
/////////////////
{
delete fpPreStepPoint;
delete fpPostStepPoint;
}
/////////////////////////////
void G4Step::ShowStep() const
/////////////////////////////
{
// Show header
G4cout << endl;
G4cout << " ++G4Step Information " << endl;
G4cout.precision(3);
// Show G4Step specific information
G4cout << " Address of G4Track : " << fpTrack << endl;
G4cout << " Step Length (mm) : " << fpTrack->GetStepLength() << endl;
G4cout << " Energy Deposit (MeV) : " << fTotalEnergyDeposit << endl;
// Show G4StepPoint specific information
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
G4cout << " StepPoint Information " << setw(20) << "PreStep"
<< setw(20) << "PostStep" << endl;
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
G4cout << " Position - x (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().x()
<< setw(20) << fpPostStepPoint->GetPosition().x() << endl;
G4cout << " Position - y (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().y()
<< setw(20) << fpPostStepPoint->GetPosition().y() << endl;
G4cout << " Position - z (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().z()
<< setw(20) << fpPostStepPoint->GetPosition().z() << endl;
G4cout << " Global Time (ns) : "
<< setw(20) << fpPreStepPoint->GetGlobalTime()
<< setw(20) << fpPostStepPoint->GetGlobalTime() << endl;
G4cout << " Local Time (ns) : "
<< setw(20) << fpPreStepPoint->GetLocalTime()
<< setw(20) << fpPostStepPoint->GetLocalTime() << endl;
G4cout << " Proper Time (ns) : "
<< setw(20) << fpPreStepPoint->GetProperTime()
<< setw(20) << fpPostStepPoint->GetProperTime() << endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().x()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().x() << endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().y()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().y() << endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().z()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().z() << endl;
G4cout << " Momentum - x (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().x()
<< setw(20) << fpPostStepPoint->GetMomentum().x() << endl;
G4cout << " Momentum - y (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().y()
<< setw(20) << fpPostStepPoint->GetMomentum().y() << endl;
G4cout << " Momentum - z (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().z()
<< setw(20) << fpPostStepPoint->GetMomentum().z() << endl;
G4cout << " Total Energy (MeV) : "
<< setw(20) << fpPreStepPoint->GetTotalEnergy()
<< setw(20) << fpPostStepPoint->GetTotalEnergy() << endl;
G4cout << " Kinetic Energy (MeV): "
<< setw(20) << fpPreStepPoint->GetKineticEnergy()
<< setw(20) << fpPostStepPoint->GetKineticEnergy() << endl;
G4cout << " Velocity (mm/ns) : "
<< setw(20) << fpPreStepPoint->GetVelocity()
<< setw(20) << fpPostStepPoint->GetVelocity() << endl;
G4cout << " Volume Name : "
<< setw(20) << fpPreStepPoint->GetPhysicalVolume()->GetName()
<< setw(20) << fpPostStepPoint->GetPhysicalVolume()->GetName() << endl;
G4cout << " Safety (mm) : "
<< setw(20) << fpPreStepPoint->GetSafety()
<< setw(20) << fpPostStepPoint->GetSafety() << endl;
G4cout << " Polarization - x : "
<< setw(20) << fpPreStepPoint->GetPolarization().x()
<< setw(20) << fpPostStepPoint->GetPolarization().x() << endl;
G4cout << " Polarization - y : "
<< setw(20) << fpPreStepPoint->GetPolarization().y()
<< setw(20) << fpPostStepPoint->GetPolarization().y() << endl;
G4cout << " Polarization - Z : "
<< setw(20) << fpPreStepPoint->GetPolarization().z()
<< setw(20) << fpPostStepPoint->GetPolarization().z() << endl;
G4cout << " Weight : "
<< setw(20) << fpPreStepPoint->GetWeight()
<< setw(20) << fpPostStepPoint->GetWeight() << endl;
G4cout << " Step Status : " ;
G4StepStatus tStepStatus = fpPreStepPoint->GetStepStatus();
if( tStepStatus == fGeomBoundary ){
G4cout << setw(20) << "Geom Limit";
} else if ( tStepStatus == fAlongStepDoItProc ){
G4cout << setw(20) << "AlongStep Proc.";
} else if ( tStepStatus == fPostStepDoItProc ){
G4cout << setw(20) << "PostStep Proc";
} else if ( tStepStatus == fAtRestDoItProc ){
G4cout << setw(20) << "AtRest Proc";
} else if ( tStepStatus == fUndefined ){
G4cout << setw(20) << "Undefined";
}
tStepStatus = fpPostStepPoint->GetStepStatus();
if( tStepStatus == fGeomBoundary ){
G4cout << setw(20) << "Geom Limit";
} else if ( tStepStatus == fAlongStepDoItProc ){
G4cout << setw(20) << "AlongStep Proc.";
} else if ( tStepStatus == fPostStepDoItProc ){
G4cout << setw(20) << "PostStep Proc";
} else if ( tStepStatus == fAtRestDoItProc ){
G4cout << setw(20) << "AtRest Proc";
} else if ( tStepStatus == fUndefined ){
G4cout << setw(20) << "Undefined";
}
G4cout << endl;
G4cout << " Process defined Step: " ;
if( fpPreStepPoint->GetProcessDefinedStep() == NULL ){
G4cout << setw(20) << "Undefined";
} else {
G4cout << setw(20) << fpPreStepPoint->GetProcessDefinedStep()
->GetProcessName();
}
if( fpPostStepPoint->GetProcessDefinedStep() == NULL){
G4cout << setw(20) << "Undefined";
} else {
G4cout << setw(20) << fpPostStepPoint->GetProcessDefinedStep()
->GetProcessName();
}
G4cout << endl;
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
}
+47
View File
@@ -0,0 +1,47 @@
// This code implementation is the intellectual property of
// the RD44 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: G4StepPoint.cc,v 2.1 1998/07/12 03:08:56 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4StepPoint.cc
//
// Description:
// This class represents information associated with the
// each end of a Step like the space/time data of the
// particle.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4StepPoint.hh"
//////////////////////////
G4StepPoint::G4StepPoint()
//////////////////////////
{
}
///////////////////////////
G4StepPoint::~G4StepPoint()
///////////////////////////
{
}
+85
View File
@@ -0,0 +1,85 @@
// This code implementation is the intellectual property of
// the RD44 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: G4Track.cc,v 2.2 1998/11/18 11:06:48 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4Track.cc
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4Track.hh"
G4Allocator<G4Track> aTrackAllocator;
///////////////////////////////////////////////////////////
G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
G4double aValueTime,
const G4ThreeVector& aValuePosition)
///////////////////////////////////////////////////////////
{
fpDynamicParticle = apValueDynamicParticle;
fCurrentStepNumber = 0;
fGlobalTime = aValueTime;
fLocalTime = 0.;
fTrackLength = 0.;
fPosition = aValuePosition;
fpTouchable = 0;
fpNextTouchable = 0;
fpLVAtVertex = 0;
fpCreatorProcess = 0;
fTrackStatus = fAlive;
fBelowThreshold = false;
fGoodForTracking = false;
fWeight = 1.0;
}
//////////////////
G4Track::G4Track()
//////////////////
{
fCurrentStepNumber = 0;
fGlobalTime = 0.;
fLocalTime = 0.;
fTrackLength = 0.;
fParentID = 0;
fTrackID = 0;
fpTouchable = 0;
fpNextTouchable = 0;
fpDynamicParticle = 0;
fpLVAtVertex = 0;
fpCreatorProcess = 0;
fTrackStatus = fAlive;
fBelowThreshold = false;
fGoodForTracking = false;
fWeight = 1.0;
}
///////////////////
G4Track::~G4Track()
///////////////////
{
delete fpDynamicParticle;
}
+175
View File
@@ -0,0 +1,175 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VParticleChange.cc,v 2.3 1998/11/18 11:06:49 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
// ------------------------------------------------------------
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
// --------------------------------------------------------------
#include "G4VParticleChange.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4Mars5GeVMechanism.hh"
G4VParticleChange::G4VParticleChange():
theNumberOfSecondaries(0),
theSizeOftheListOfSecondaries(G4TrackFastVectorSize),
theStatusChange(fAlive),
theSteppingControlFlag(NormalCondition),
theLocalEnergyDeposit(0.0),
theParentWeight(1.0),
theEBMechanism(NULL),
fUseEB(false),
verboseLevel(1)
{
theListOfSecondaries = new G4TrackFastVector();
}
G4VParticleChange::G4VParticleChange(G4bool useEB):
theNumberOfSecondaries(0),
theSizeOftheListOfSecondaries(G4TrackFastVectorSize),
theStatusChange(fAlive),
theSteppingControlFlag(NormalCondition),
theLocalEnergyDeposit(0.0),
theParentWeight(1.0),
fUseEB(useEB),
verboseLevel(1)
{
theListOfSecondaries = new G4TrackFastVector();
// register G4EvtBiasMechanism as a default
theEBMechanism = new G4Mars5GeVMechanism();
}
G4VParticleChange::~G4VParticleChange() {
// check if tracks still exist in theListOfSecondaries
if (theNumberOfSecondaries>0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::~G4VParticleChange() Warning ";
G4cerr << "theListOfSecondaries is not empty ";
}
#endif
for (G4int index= 0; index<theNumberOfSecondaries; index++){
if ( (*theListOfSecondaries)[index] ) delete (*theListOfSecondaries)[index] ;
}
}
if (theEBMechanism !=NULL) delete theEBMechanism;
delete theListOfSecondaries;
}
// copy and assignment operators are implemented as "shallow copy"
G4VParticleChange::G4VParticleChange(const G4VParticleChange &right)
{
*this = right;
}
G4VParticleChange & G4VParticleChange::operator=(const G4VParticleChange &right)
{
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
}
return *this;
}
G4bool G4VParticleChange::operator==(const G4VParticleChange &right) const
{
return (this == (G4VParticleChange *) &right);
}
G4bool G4VParticleChange::operator!=(const G4VParticleChange &right) const
{
return (this != (G4VParticleChange *) &right);
}
//----------------------------------------------------------------
// methods for printing messages
//
void G4VParticleChange::DumpInfo() const
{
// Show header
G4cout.precision(3);
G4cout << " -----------------------------------------------"
<< endl;
G4cout << " G4ParticleChange Information " << setw(20) << endl;
G4cout << " -----------------------------------------------"
<< endl;
G4cout << " # of 2ndaries : "
<< setw(20) << theNumberOfSecondaries
<< endl;
if (theNumberOfSecondaries >0) {
G4cout << " Pointer to 2ndaries : "
<< setw(20) << GetSecondary(0)
<< endl;
G4cout << " (Showed only 1st one)"
<< endl;
}
G4cout << " -----------------------------------------------"
<< endl;
G4cout << " Energy Deposit (MeV): "
<< setw(20) << theLocalEnergyDeposit/MeV
<< endl;
G4cout << " Track Status : "
<< setw(20);
if( theStatusChange == fAlive ){
G4cout << " Alive";
} else if( theStatusChange == fStopButAlive ){
G4cout << " StopButAlive";
} else if( theStatusChange == fStopAndKill ){
G4cout << " StopAndKill";
} else if( theStatusChange == fKillTrackAndSecondaries ){
G4cout << " KillTrackAndSecondaries";
} else if( theStatusChange == fSuspend ){
G4cout << " Suspend";
} else if( theStatusChange == fPostponeToNextEvent ){
G4cout << " PostponeToNextEvent";
}
G4cout << endl;
G4cout << " True Path Length (mm) : "
<< setw(20) << theTrueStepLength/mm
<< endl;
G4cout << " Stepping Control : "
<< setw(20) << theSteppingControlFlag
<< endl;
G4cout << " Event Biasing : ";
if (fUseEB) {
G4cout << setw(20) << theEBMechanism->GetName();
} else {
G4cout << " not used ";
}
G4cout << endl;
}