Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+13 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.23 2007/05/07 10:17:36 kurasige Exp $
$Id: History,v 1.28 2007/10/30 03:14:18 gum Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,18 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- Oct. 29, 07 P.Gumplinger (decay-V09-00-02)
- add G4PionDecayMakeSpin class
set the daughter muon spin for 2 body decays of
pi, K and K0_long
- Oct. 12, 07 H.Kurashige (decay-V09-00-01)
- add forward declaration for G4VExtDecayer in G4DecayWithSpin
- Oct. 06, 07 H.Kurashige (decay-V09-00-00)
- Add a method of DaughterPolarization in G4Decay
- May 07, 07 H.Kurashige (decay-V08-02-00)
- Add protection for "TotalEnergy < Mass"
+10 -3
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Decay.hh,v 1.15 2006/06/29 19:30:34 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Decay.hh,v 1.18 2007/07/23 23:13:04 kurasige Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// ------------------------------------------------------------
@@ -47,6 +47,8 @@
// Fixed bug in PostStepGPIL
// in case of stopping during AlongStepDoIt 12 Mar. 2004 H.Kurashige
// Add GetRemainderLifeTime 10 Aug/2004 H.Kurashige
// Add DaughterPolarization 23 July 2008 H.Kurashige
#ifndef G4Decay_h
#define G4Decay_h 1
@@ -111,7 +113,12 @@ class G4Decay : public G4VRestDiscreteProcess
// The DecayIt() method returns by pointer a particle-change object,
// which has information of daughter particles.
public:
// Set daughter polarization
// NO OPERATION in the base class of G4Decay
virtual void DaughterPolarization(const G4Track& aTrack,
G4DecayProducts* products);
public:
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
@@ -40,8 +40,6 @@
#include "G4Decay.hh"
class G4VExtDecayer;
class G4DecayWithSpin : public G4Decay
{
public:
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef G4PionDecayMakeSpin_h
#define G4PionDecayMakeSpin_h 1
#include "G4Decay.hh"
#include "G4ParticleTable.hh"
class G4PionDecayMakeSpin : public G4Decay
{
public:
// Constructors
G4PionDecayMakeSpin(const G4String& processName ="Decay");
// Destructor
virtual ~G4PionDecayMakeSpin();
private:
// copy constructor
G4PionDecayMakeSpin(const G4PionDecayMakeSpin &right);
// Assignment Operation (generated)
G4PionDecayMakeSpin & operator=(const G4PionDecayMakeSpin &right);
protected:
virtual void DaughterPolarization(const G4Track& aTrack,
G4DecayProducts* products);
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4UnknownDecay.hh,v 1.3 2006/06/29 19:30:56 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// ------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4VExtDecayer.hh,v 1.4 2006/06/29 19:31:11 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// ------------------------------------------------------------
+37 -27
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Decay.cc,v 1.24 2007/05/07 12:05:45 kurasige Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Decay.cc,v 1.27 2007/10/06 07:01:09 kurasige Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// --------------------------------------------------------------
@@ -65,7 +65,7 @@ G4Decay::G4Decay(const G4String& processName)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay constructor " << " Name:" << processName << G4endl;
G4cout << "G4Decay constructor " << " Name:" << processName << G4endl;
}
#endif
pParticleChange = &fParticleChangeForDecay;
@@ -150,9 +150,9 @@ G4double G4Decay::GetMeanFreePath(const G4Track& aTrack,G4double, G4ForceConditi
// too slow particle
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay::GetMeanFreePath() !!particle stops!!";
G4cerr << aParticleDef->GetParticleName() << G4endl;
G4cerr << "KineticEnergy:" << aParticle->GetKineticEnergy()/GeV <<"[GeV]";
G4cout << "G4Decay::GetMeanFreePath() !!particle stops!!";
G4cout << aParticleDef->GetParticleName() << G4endl;
G4cout << "KineticEnergy:" << aParticle->GetKineticEnergy()/GeV <<"[GeV]";
}
#endif
pathlength = DBL_MIN;
@@ -200,12 +200,14 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// Error due to NO Decay Table
if ( (decaytable == 0) && !isExtDecayer &&!isPreAssigned ){
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4Decay::DoIt : decay table not defined for ";
G4cerr << aParticle->GetDefinition()->GetParticleName()<< G4endl;
G4cout << "G4Decay::DoIt : decay table not defined for ";
G4cout << aParticle->GetDefinition()->GetParticleName()<< G4endl;
}
#endif
G4Exception( "G4Decay::DecayIt ",
"No Decay Table",JustWarning,
"Decay table is not defined");
fParticleChangeForDecay.SetNumberOfSecondaries(0);
// Kill the parent particle
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
@@ -233,7 +235,7 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
#ifdef G4VERBOSE
G4int temp = decaychannel->GetVerboseLevel();
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl;
G4cout << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl;
decaychannel->SetVerboseLevel(GetVerboseLevel());
}
#endif
@@ -244,8 +246,9 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
}
#endif
#ifdef G4VERBOSE
// for debug
//if (! products->IsChecked() ) products->DumpInfo();
if (GetVerboseLevel()>2) {
if (! products->IsChecked() ) products->DumpInfo();
}
#endif
}
}
@@ -255,15 +258,13 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
G4double ParentMass = aParticle->GetMass();
if (ParentEnergy < ParentMass) {
ParentEnergy = ParentMass;
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4Decay::DoIt : Total Energy is less than its mass" << G4endl;
G4cerr << " Particle: " << aParticle->GetDefinition()->GetParticleName();
G4cerr << " Energy:" << ParentEnergy/MeV << "[MeV]";
G4cerr << " Mass:" << ParentMass/MeV << "[MeV]";
G4cerr << G4endl;
G4cout << "G4Decay::DoIt : Total Energy is less than its mass" << G4endl;
G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName();
G4cout << " Energy:" << ParentEnergy/MeV << "[MeV]";
G4cout << " Mass:" << ParentMass/MeV << "[MeV]";
G4cout << G4endl;
}
#endif
}
G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
@@ -281,18 +282,22 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
if (!isExtDecayer) products->Boost( ParentEnergy, ParentDirection);
}
// set polarization for daughter particles
DaughterPolarization(aTrack, products);
//add products in fParticleChangeForDecay
G4int numberOfSecondaries = products->entries();
fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4Decay::DoIt : Decay vertex :";
G4cerr << " Time: " << finalGlobalTime/ns << "[ns]";
G4cerr << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
G4cerr << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
G4cerr << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
G4cerr << G4endl;
G4cerr << "G4Decay::DoIt : decay products in Lab. Frame" << G4endl;
G4cout << "G4Decay::DoIt : Decay vertex :";
G4cout << " Time: " << finalGlobalTime/ns << "[ns]";
G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
G4cout << G4endl;
G4cout << "G4Decay::DoIt : decay products in Lab. Frame" << G4endl;
products->DumpInfo();
}
#endif
@@ -325,6 +330,11 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
return &fParticleChangeForDecay ;
}
void G4Decay::DaughterPolarization(const G4Track& , G4DecayProducts* )
{
}
void G4Decay::StartTracking(G4Track*)
{
+12 -13
View File
@@ -153,20 +153,19 @@ G4ThreeVector G4DecayWithSpin::Spin_Precession( const G4Step& aStep,
G4Vector3D newSpin = SpinRotation * Spin;
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4double normspin = std::sqrt(Spin*Spin);
G4double normnewspin = std::sqrt(newSpin*newSpin);
//G4double cosalpha = Spin*newSpin/normspin/normnewspin;
//G4double alpha = std::acos(cosalpha);
// G4double normspin = std::sqrt(Spin*Spin);
// G4double normnewspin = std::sqrt(newSpin*newSpin);
// G4double cosalpha = Spin*newSpin/normspin/normnewspin;
// G4double alpha = std::acos(cosalpha);
// G4cout<< "AT REST::: PARAMETERS\n"
// << "Initial spin : " << Spin <<"\n"
// << "Delta time : " << deltatime <<"\n"
// << "Rotation angle: " << rotationangle/rad <<"\n"
// << "New spin : " << newSpin <<"\n"
// << "Checked norms : " << normspin <<" " << normnewspin <<" \n"
// << G4endl;
G4cout << "AT REST::: PARAMETERS " << G4endl;
G4cout << "Initial spin : " << Spin << G4endl;
G4cout << "Delta time : " << deltatime << G4endl;
G4cout << "Rotation angle: " << rotationangle/rad << G4endl;
G4cout << "New spin : " << newSpin << G4endl;
G4cout << "Checked norms : " << normspin <<" " << normnewspin << G4endl;
}
#endif
return newSpin;
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
#include "G4PionDecayMakeSpin.hh"
#include "G4Decay.hh"
#include "G4DecayProducts.hh"
#include "G4RandomDirection.hh"
// constructor
G4PionDecayMakeSpin::G4PionDecayMakeSpin(const G4String& processName)
: G4Decay(processName) { }
G4PionDecayMakeSpin::~G4PionDecayMakeSpin() { }
void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
G4DecayProducts* products)
{
// This routine deals only with particles that can decay into a muon
// pi+, pi-, K+, K- and K0_long
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
G4ParticleDefinition* aMuonPlus =
G4ParticleTable::GetParticleTable()->FindParticle("mu+");
G4ParticleDefinition* aMuonMinus =
G4ParticleTable::GetParticleTable()->FindParticle("mu-");
G4ParticleDefinition* aPionPlus =
G4ParticleTable::GetParticleTable()->FindParticle("pi+");
G4ParticleDefinition* aPionMinus =
G4ParticleTable::GetParticleTable()->FindParticle("pi-");
G4ParticleDefinition* aKaonPlus =
G4ParticleTable::GetParticleTable()->FindParticle("kaon+");
G4ParticleDefinition* aKaonMinus =
G4ParticleTable::GetParticleTable()->FindParticle("kaon-");
G4ParticleDefinition* aKaon0Long =
G4ParticleTable::GetParticleTable()->FindParticle("kaon0L");
G4ParticleDefinition* aNeutrinoMu =
G4ParticleTable::GetParticleTable()->FindParticle("nu_mu");
G4ParticleDefinition* aAntiNeutrinoMu =
G4ParticleTable::GetParticleTable()->FindParticle("anti_nu_mu");
if( aParticleDef == aPionPlus ||
aParticleDef == aPionMinus ||
aParticleDef == aKaonPlus ||
aParticleDef == aKaonMinus ||
aParticleDef == aKaon0Long ) {
} else {
return;
}
G4DynamicParticle* aMuon = NULL;
G4double emu(0), eneutrino(0);
G4ThreeVector p_muon, p_neutrino;
G4int numberOfSecondaries = products->entries();
if (numberOfSecondaries > 0) {
for (G4int index=0; index < numberOfSecondaries; index++)
{
G4DynamicParticle* aSecondary = (*products)[index];
G4ParticleDefinition* aSecondaryDef = aSecondary->GetDefinition();
if (aSecondaryDef == aMuonPlus ||
aSecondaryDef == aMuonMinus ) {
// Muon+ or Muon-
aMuon = aSecondary;
emu = aSecondary->GetTotalEnergy();
p_muon = aSecondary->GetMomentum();
} else if (aSecondaryDef == aNeutrinoMu ||
aSecondaryDef == aAntiNeutrinoMu ) {
// Muon-Neutrino / Muon-Anti-Neutrino
eneutrino = aSecondary->GetTotalEnergy();
p_neutrino = aSecondary->GetMomentum();
}
}
}
// This routine deals only with decays with a
// muon and mu-(anti)neutrinos in the final state
if (!aMuon) return;
if (eneutrino==0||emu==0) return;
G4ThreeVector spin(0,0,0);
const G4DynamicParticle* theParentParticle = products->GetParentParticle();
G4double amass = theParentParticle->GetMass();
G4double emmu = aMuonPlus->GetPDGMass();
if (numberOfSecondaries == 2 ) {
G4double scale = - (eneutrino - ( p_muon * p_neutrino )/(emu+emmu));
p_muon = scale * p_muon;
p_neutrino = emmu * p_neutrino;
spin = p_muon + p_neutrino;
scale = 2./(amass*amass-emmu*emmu);
spin = scale * spin;
if (aParticle->GetCharge() < 0.0) spin = -spin;
} else {
spin = G4RandomDirection();
}
spin = spin.unit();
aMuon->SetPolarization(spin.x(),spin.y(),spin.z());
return;
}
+15 -15
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4UnknownDecay.cc,v 1.4 2007/05/07 10:16:08 kurasige Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4UnknownDecay.cc,v 1.5 2007/10/06 07:01:09 kurasige Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// --------------------------------------------------------------
@@ -48,7 +48,7 @@ G4UnknownDecay::G4UnknownDecay(const G4String& processName)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
G4cout << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
}
#endif
pParticleChange = &fParticleChangeForDecay;
@@ -112,11 +112,11 @@ G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step&
ParentEnergy = ParentMass;
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4UnknownDecay::DoIt : Total Energy is less than its mass" << G4endl;
G4cerr << " Particle: " << aParticle->GetDefinition()->GetParticleName();
G4cerr << " Energy:" << ParentEnergy/MeV << "[MeV]";
G4cerr << " Mass:" << ParentMass/MeV << "[MeV]";
G4cerr << G4endl;
G4cout << "G4UnknownDecay::DoIt : Total Energy is less than its mass" << G4endl;
G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName();
G4cout << " Energy:" << ParentEnergy/MeV << "[MeV]";
G4cout << " Mass:" << ParentMass/MeV << "[MeV]";
G4cout << G4endl;
}
#endif
}
@@ -135,13 +135,13 @@ G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step&
fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4UnknownDecay::DoIt : Decay vertex :";
G4cerr << " Time: " << finalGlobalTime/ns << "[ns]";
G4cerr << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
G4cerr << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
G4cerr << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
G4cerr << G4endl;
G4cerr << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl;
G4cout << "G4UnknownDecay::DoIt : Decay vertex :";
G4cout << " Time: " << finalGlobalTime/ns << "[ns]";
G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
G4cout << G4endl;
G4cout << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl;
products->DumpInfo();
}
#endif