Import Geant4 6.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:41:53 +02:00
parent 4aea781e80
commit 96686e0c8f
6560 changed files with 153347 additions and 238155 deletions
+2 -3
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2000/01/31 09:18:39 gcosmo Exp $
# $Id: GNUmakefile,v 1.3 2003/10/03 15:49:20 gcosmo Exp $
# ----------------------------------------------------------
# GNUmakefile for track library. Gabriele Cosmo, 3/4/1997.
# ----------------------------------------------------------
@@ -18,8 +18,7 @@ CPPFLAGS += \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include
-I$(G4BASE)/geometry/management/include
include $(G4INSTALL)/config/common.gmk
+14 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.57 2003/06/03 08:56:52 gcosmo Exp $
$Id: History,v 1.61 2003/11/27 03:51:13 kurasige Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,19 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov. 26, 03 H.Kurashige(track-V05-02-03)
- Fixed problem of setting momentum direction for stoppped particle in G4ParticleChange (Vladimir)
Oct. 4, 03 G.Cosmo (track-V05-02-02)
- Modified GNUmakefile:
o added dependency to new module "geometry/navigation".
- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
Jun. 11, 03 H.Kurashige (track-V05-02-01)
- Add ExceptionSeverity
- Add G4VParticleChange::CheckSecondary
- Remove inclusion of G4MaterialCutsCouple
Jun. 03, 03 G.Cosmo (track-V05-01-03)
- Fixed warning in G4ParticleChangeForRadDecay.hh.
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ForceCondition.hh,v 1.4 2002/10/31 23:41:52 tsasaki Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4GPILSelection.hh,v 1.3 2001/07/11 10:08:35 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChange.hh,v 1.9 2001/11/21 14:05:57 kurasige Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChange.icc,v 1.9 2001/10/20 08:07:49 kurasige Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
inline
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForDecay.hh,v 1.5 2001/07/11 10:08:35 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForLoss.hh,v 1.4 2001/07/11 10:08:35 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForMSC.icc,v 1.4 2001/07/11 10:08:36 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForRadDecay.hh,v 1.5 2003/06/03 08:56:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleChangeForTransport.hh,v 1.11 2003/06/16 17:12:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4ParticleChangeForTransport.hh,v 1.12 2003/09/19 19:08:14 kurasige Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
@@ -46,7 +46,8 @@
#include "G4ios.hh"
#include "G4TouchableHandle.hh"
#include "G4ParticleChange.hh"
#include "G4MaterialCutsCouple.hh"
class G4MaterialCutsCouple;
class G4ParticleChangeForTransport: public G4ParticleChange
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForTransport.icc,v 1.9 2003/06/16 17:12:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
inline
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Step.hh,v 1.10 2003/06/16 17:12:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Step.icc,v 1.10 2003/03/05 04:42:53 kurasige Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+3 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StepPoint.hh,v 1.12 2003/05/07 20:08:36 asaim Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4StepPoint.hh,v 1.13 2003/09/19 19:08:14 kurasige Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
@@ -55,9 +55,9 @@ class G4VProcess;
#include "G4StepStatus.hh" // Include from 'track'
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4LogicalVolume.hh"
class G4MaterialCutsCouple;
/////////////////
class G4StepPoint
/////////////////
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StepPoint.icc,v 1.8 2003/05/07 20:08:37 asaim Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
inline const G4ThreeVector& G4StepPoint::GetPosition() const
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StepStatus.hh,v 1.3 2001/07/11 10:08:37 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4SteppingControl.hh,v 1.3 2001/07/11 10:08:37 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Track.hh,v 1.16 2002/12/16 11:59:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Track.icc,v 1.10 2002/12/16 11:59:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//-----------------------------------------------------------------
// Definitions of inline functions
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4TrackFastVector.hh,v 1.4 2001/07/11 10:08:37 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4TrackStatus.hh,v 1.3 2001/07/11 10:08:37 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+6 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VParticleChange.hh,v 1.8 2002/11/20 16:52:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4VParticleChange.hh,v 1.9 2003/06/11 07:16:28 kurasige Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// ------------------------------------------------------------
@@ -65,6 +65,7 @@
// Implement Event Biasing Scheme 9 Nov.,98 H.Kurashige
// add CheckIt 13 Apr.,99 H.Kurashige
// add accuracy leveles 5 May, 99 H.Kurashige
// add check secondaries 11 June, 03 H.Kurashige
#ifndef G4VParticleChange_h
#define G4VParticleChange_h 1
@@ -241,6 +242,9 @@ class G4VParticleChange
G4bool GetDebugFlag() const;
protected:
// CheckSecondary method is provided for debug
G4bool CheckSecondary(G4Track&);
const G4double GetAccuracyForWarning() const;
const G4double GetAccuracyForException() const;
+2 -25
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VParticleChange.icc,v 1.9 2001/12/24 05:14:39 kurasige Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4VParticleChange.icc,v 1.10 2003/06/11 07:16:28 kurasige Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//----------------------------------------------------------------
// Virtual methods for updating G4Step
@@ -224,29 +224,6 @@ inline void G4VParticleChange::InitializeSecondaries(const G4Track&)
// methods for handling secondaries
//
inline void G4VParticleChange::AddSecondary(G4Track *aTrack)
{
if (!fSetSecondaryWeightByProcess){
// pass the weight of parent track
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 !! " << G4endl;
G4cerr << " The object will not be added in theListOfSecondaries" << G4endl;
}
#endif
}
}
inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries)
{
// check if tracks still exist in theListOfSecondaries
@@ -22,7 +22,7 @@
//
//
// $Id: G4VUserTrackInformation.hh,v 1.4 2003/05/09 20:42:27 asaim Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+20 -5
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleChange.cc,v 1.21.10.1 2003/06/16 17:19:28 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4ParticleChange.cc,v 1.24 2003/11/24 10:27:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
@@ -43,6 +43,7 @@
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
#include "G4ExceptionSeverity.hh"
G4ParticleChange::G4ParticleChange():G4VParticleChange()
@@ -249,7 +250,7 @@ G4Step* G4ParticleChange::UpdateStepForAlongStep(G4Step* pStep)
pPostStepPoint->SetKineticEnergy( energy );
} else {
// stop case
pPostStepPoint->SetMomentumDirection(G4ThreeVector(1., 0., 0.));
//pPostStepPoint->SetMomentumDirection(G4ThreeVector(1., 0., 0.));
pPostStepPoint->SetKineticEnergy(0.0);
}
@@ -429,9 +430,11 @@ G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
if ( theEnergyChange >0.) {
accuracy = abs(theMomentumDirectionChange.mag2()-1.0);
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the Momentum Change is not unit vector !!" << G4endl;
G4cout << " Difference: " << accuracy << G4endl;
#endif
itsOKforMomentum = false;
if (accuracy > accuracyForException) exitWithError = true;
}
@@ -441,9 +444,11 @@ G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
G4bool itsOKforGlobalTime = true;
accuracy = (aTrack.GetGlobalTime()- theTimeChange)/ns;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the global time goes back !!" << G4endl;
G4cout << " Difference: " << accuracy << "[ns] " <<G4endl;
#endif
itsOKforGlobalTime = false;
if (accuracy > accuracyForException) exitWithError = true;
}
@@ -451,9 +456,11 @@ G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
G4bool itsOKforProperTime = true;
accuracy = (aTrack.GetProperTime() - theProperTimeChange )/ns;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the proper time goes back !!" << G4endl;
G4cout << " Difference: " << accuracy << "[ns] " <<G4endl;
#endif
itsOKforProperTime = false;
if (accuracy > accuracyForException) exitWithError = true;
}
@@ -462,23 +469,31 @@ G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
G4bool itsOKforEnergy = true;
accuracy = -1.0*theEnergyChange/MeV;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the kinetic energy is negative !!" << G4endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
#endif
itsOKforEnergy = false;
if (accuracy > accuracyForException) exitWithError = true;
}
G4bool itsOK = itsOKforMomentum && itsOKforEnergy && itsOKforProperTime && itsOKforGlobalTime;
// dump out information of this particle change
#ifdef G4VERBOSE
if (!itsOK) {
G4cout << " G4ParticleChange::CheckIt " <<G4endl;
DumpInfo();
}
#endif
// Exit with error
if (exitWithError) G4Exception("G4ParticleChange::CheckIt");
if (exitWithError) {
G4Exception("G4ParticleChange::CheckIt",
"200",
EventMustBeAborted,
"momentum, energy, and/or time was illegal");
}
//correction
if (!itsOKforMomentum) {
G4double vmag = theMomentumDirectionChange.mag();
+13 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleChangeForDecay.cc,v 1.7.12.1 2003/06/16 17:19:31 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4ParticleChangeForDecay.cc,v 1.9 2003/06/19 14:45:07 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
@@ -40,6 +40,7 @@
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
#include "G4ExceptionSeverity.hh"
G4ParticleChangeForDecay::G4ParticleChangeForDecay():G4VParticleChange()
{
@@ -160,21 +161,30 @@ G4bool G4ParticleChangeForDecay::CheckIt(const G4Track& aTrack)
G4bool itsOK =true;
accuracy = -1.0*(theTimeChange - aTrack.GetGlobalTime())/ns;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChangeForDecay::CheckIt : ";
G4cout << "the global time goes back !!" << G4endl;
G4cout << " Difference: " << accuracy << "[ns] " <<G4endl;
#endif
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
#ifdef G4VERBOSE
if (!itsOK) {
G4cout << " G4ParticleChangeForDecay::CheckIt " <<G4endl;
DumpInfo();
}
#endif
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForDecay::CheckIt");
if (exitWithError) {
G4Exception("G4ParticleChangeForDecay::CheckIt",
"500",
EventMustBeAborted,
"time was illegal");
}
// correction
if (!itsOK) {
+13 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleChangeForLoss.cc,v 1.6.12.1 2003/06/16 17:19:34 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4ParticleChangeForLoss.cc,v 1.8 2003/06/19 14:45:08 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
@@ -39,6 +39,7 @@
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
#include "G4ExceptionSeverity.hh"
G4ParticleChangeForLoss::G4ParticleChangeForLoss():G4VParticleChange()
{
@@ -168,21 +169,30 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
// Energy should not be lager than initial value
accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChangeForLoss::CheckIt : ";
G4cout << "the energy becoes larger than the initial value !!" << G4endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
#endif
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
#ifdef G4VERBOSE
if (!itsOK) {
G4cout << " G4ParticleChangeForLoss::CheckIt " <<G4endl;
DumpInfo();
}
#endif
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForLoss::CheckIt");
if (exitWithError) {
G4Exception("G4ParticleChangeForLoss::CheckIt",
"400",
EventMustBeAborted,
"energy was illegal");
}
//correction
if (!itsOK) {
+13 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleChangeForMSC.cc,v 1.8.12.1 2003/06/16 17:19:36 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4ParticleChangeForMSC.cc,v 1.10 2003/06/19 14:45:09 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
@@ -39,6 +39,7 @@
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4DynamicParticle.hh"
#include "G4ExceptionSeverity.hh"
G4ParticleChangeForMSC::G4ParticleChangeForMSC():G4VParticleChange()
{
@@ -198,22 +199,30 @@ G4bool G4ParticleChangeForMSC::CheckIt(const G4Track& aTrack)
// MomentumDirection should be unit vector
accuracy = abs(theMomentumDirectionChange.mag2()-1.0);
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4ParticleChangeForMSC::CheckIt : ";
G4cout << "the Momentum Change is not unit vector !!" << G4endl;
G4cout << " Difference: " << accuracy << G4endl;
#endif
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
#ifdef G4VERBOSE
if (!itsOK) {
G4cout << " G4ParticleChangeForMSC::CheckIt " <<G4endl;
DumpInfo();
}
#endif
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForMSC::CheckIt");
if (exitWithError) {
G4Exception("G4ParticleChangeForMSC::CheckIt",
"300",
EventMustBeAborted,
"momentum direction was illegal");
}
//correction
if (!itsOK) {
G4double vmag = theMomentumDirectionChange.mag();
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleChangeForTransport.cc,v 1.15 2003/06/16 17:13:04 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Step.cc,v 1.5 2001/07/11 10:08:39 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StepPoint.cc,v 1.9 2002/12/16 11:59:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Track.cc,v 1.19 2003/05/20 22:24:41 asaim Exp $
// GEANT4 tag $Name: geant4-05-02 $
// GEANT4 tag $Name: geant4-06-00 $
//
//
//---------------------------------------------------------------
+126 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VParticleChange.cc,v 1.12.2.1 2003/06/16 17:19:38 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4VParticleChange.cc,v 1.15 2003/06/19 14:45:12 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
//
// --------------------------------------------------------------
@@ -37,6 +37,7 @@
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
#include "G4ExceptionSeverity.hh"
const G4double G4VParticleChange::accuracyForWarning = 1.0e-9;
const G4double G4VParticleChange::accuracyForException = 0.001;
@@ -204,9 +205,11 @@ G4bool G4VParticleChange::CheckIt(const G4Track& )
G4bool itsOKforEnergy = true;
accuracy = -1.0*theLocalEnergyDeposit/MeV;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4VParticleChange::CheckIt : ";
G4cout << "the energy deposit is negative !!" << G4endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
#endif
itsOKforEnergy = false;
if (accuracy > accuracyForException) exitWithError = true;
}
@@ -215,22 +218,31 @@ G4bool G4VParticleChange::CheckIt(const G4Track& )
G4bool itsOKforStepLength = true;
accuracy = -1.0*theTrueStepLength/mm;
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4VParticleChange::CheckIt : ";
G4cout << "the true step length is negative !!" << G4endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
#endif
itsOKforStepLength = false;
if (accuracy > accuracyForException) exitWithError = true;
}
G4bool itsOK = itsOKforStepLength && itsOKforEnergy ;
// dump out information of this particle change
#ifdef G4VERBOSE
if (! itsOK ){
G4cout << " G4VParticleChange::CheckIt " <<G4endl;
DumpInfo();
}
#endif
// Exit with error
if (exitWithError) G4Exception("G4VParticleChange::CheckIt");
if (exitWithError) {
G4Exception("G4VParticleChange::CheckIt",
"100",
EventMustBeAborted,
"step length and/or energy deposit was illegal");
}
// correction
if ( !itsOKforStepLength ) {
@@ -242,6 +254,77 @@ G4bool G4VParticleChange::CheckIt(const G4Track& )
return itsOK;
}
G4bool G4VParticleChange::CheckSecondary(G4Track& aTrack)
{
G4bool exitWithError = false;
G4double accuracy;
// MomentumDirection should be unit vector
G4bool itsOKforMomentum = true;
accuracy = abs((aTrack.GetMomentumDirection()).mag2()-1.0);
if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
G4cout << " G4VParticleChange::CheckSecondary : ";
G4cout << "the Momentum direction is not unit vector !!" << G4endl;
G4cout << " Difference: " << accuracy << G4endl;
#endif
itsOKforMomentum = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// Kinetic Energy should not be negative
G4bool itsOKforEnergy;
accuracy = -1.0*(aTrack.GetKineticEnergy())/MeV;
if (accuracy < accuracyForWarning) {
itsOKforEnergy = true;
} else {
#ifdef G4VERBOSE
G4cout << " G4VParticleChange::CheckSecondary : ";
G4cout << "the kinetic energy is negative !!" << G4endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
#endif
itsOKforEnergy = false;
if (accuracy < accuracyForException) { exitWithError = false;}
else { exitWithError = true; }
}
G4bool itsOKforProperTime = true;
//accuracy = (aTrack.GetProperTime())/ns;
// if (accuracy > accuracyForWarning) {
#ifdef G4VERBOSE
// G4cout << " G4VParticleChange::CheckSecondary : ";
// G4cout << "the proper time goes back !!" << G4endl;
// G4cout << " Difference: " << accuracy << "[ns] " <<G4endl;
#endif
// itsOKforProperTime = false;
// if (accuracy > accuracyForException) exitWithError = true;
//}
// Exit with error
if (exitWithError) {
G4Exception("G4VParticleChange::CheckSecondary",
"10",
EventMustBeAborted,
"momentum, energy and/or proper time was illegal");
}
G4bool itsOK = itsOKforMomentum && itsOKforEnergy && itsOKforProperTime;
//correction
if (!itsOKforMomentum) {
G4double vmag = (aTrack.GetMomentumDirection()).mag();
aTrack.SetMomentumDirection((1./vmag)*aTrack.GetMomentumDirection());
}
//if (!itsOKforProperTime) {
// aTrack.SetProperTime(0.0);
//}
if (!itsOKforEnergy) {
aTrack.SetKineticEnergy(0.0);
}
return itsOK;
}
const G4double G4VParticleChange::GetAccuracyForWarning() const
{
return accuracyForWarning;
@@ -251,3 +334,43 @@ const G4double G4VParticleChange::GetAccuracyForException() const
{
return accuracyForException;
}
void G4VParticleChange::AddSecondary(G4Track *aTrack)
{
if (debugFlag) CheckSecondary(*aTrack);
if (!fSetSecondaryWeightByProcess){
// pass the weight of parent track
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 !! " << G4endl;
G4cerr << " The object will not be added in theListOfSecondaries" << G4endl;
}
#endif
}
}