Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DecayTable.hh 92057 2015-08-14 13:34:55Z gcosmo $
// $Id: G4DecayTable.hh 105720 2017-08-16 12:38:10Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -93,7 +93,7 @@ class G4DecayTable
private:
G4ParticleDefinition *parent;
G4VDecayChannelVector *channels;
G4VDecayChannelVector *channels;
};
inline
@@ -112,7 +112,7 @@ inline
inline
G4VDecayChannel* G4DecayTable::GetDecayChannel(G4int index) const
{
G4VDecayChannel* selectedChannel = 0;
G4VDecayChannel* selectedChannel = nullptr;
if ( (index>=0) && (index<G4int(channels->size())) ){
selectedChannel = (*channels)[index];
}
@@ -28,10 +28,11 @@
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// GEANT 4 class header file
//
// History: first implementation,
// History: first implementation,
// July 2016, K. Lynch
// June 2017, K.L. Genser added baseion, lifetimes and access functions
#ifndef G4MuonicAtom_h
#define G4MuonicAtom_h 1
@@ -40,21 +41,83 @@
class G4MuonicAtom : public G4Ions
{
public:
G4MuonicAtom(
const G4String& aName, G4double mass,
G4double width, G4double charge,
G4int iSpin, G4int iParity,
G4int iConjugation, G4int iIsospin,
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifetime,
G4DecayTable *decaytable, G4bool shortlived,
const G4String& subType =""
);
protected:
G4MuonicAtom(){};
public:
G4MuonicAtom(
const G4String& aName, G4double mass,
G4double width, G4double charge,
G4int iSpin, G4int iParity,
G4int iConjugation, G4int iIsospin,
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifeTime,
G4DecayTable *decaytable, G4bool shortlived,
const G4String& subType, G4Ions const* baseion,
G4int anti_encoding =0,
G4double excitation = 0.0,
G4int isomer = 0,
G4double DIOLifeTime = -1.0,
G4double NCLifeTime = -1.0
);
virtual ~G4MuonicAtom();
G4MuonicAtom* MuonicAtomDefinition();
G4MuonicAtom* MuonicAtom();
G4Ions const* GetBaseIon() const;
G4double GetDIOLifeTime() const;
void SetDIOLifeTime(G4double lt);
G4double GetNCLifeTime() const;
void SetNCLifeTime(G4double lt);
private:
G4Ions const* baseIon;
G4double fDIOLifeTime;
G4double fNCLifeTime;
};
inline
G4MuonicAtom* G4MuonicAtom::MuonicAtomDefinition()
{
return this;
}
inline
G4MuonicAtom* G4MuonicAtom::MuonicAtom()
{
return this;
}
inline
G4Ions const* G4MuonicAtom::GetBaseIon() const
{
return baseIon;
}
inline
G4double G4MuonicAtom::GetDIOLifeTime() const
{
return fDIOLifeTime;
}
inline
void G4MuonicAtom::SetDIOLifeTime(G4double lt)
{
fDIOLifeTime = lt;
}
inline
G4double G4MuonicAtom::GetNCLifeTime() const
{
return fNCLifeTime;
}
inline
void G4MuonicAtom::SetNCLifeTime(G4double lt)
{
fNCLifeTime = lt;
}
#endif
@@ -1,39 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomDIODecayChannel.hh 96314 2016-04-06 07:21:51Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 17 October 16 K.Lynch
// ------------------------------------------------------------
#ifndef G4MuonicAtomDIODecayChannel_h
#define G4MuonicAtomDIODecayChannel_h 1
#endif
@@ -30,7 +30,11 @@
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 1 July 16 K.Lynch
// History:
// 20160701 K.Lynch first implementation
// 20170612 K L Genser major revision; also copied
// functions from G4MuonMinusBoundDecay &
// old G4MuMinusCaptureCascade; used constexpr
// ------------------------------------------------------------
#ifndef G4MuonicAtomHelper_h
#define G4MuonicAtomHelper_h 1
@@ -41,6 +45,20 @@
class G4MuonicAtomHelper {
public:
static G4MuonicAtom* ConstructMuonicAtom(G4String name, G4int encoding, G4Ions const* baseion);
static G4double GetMuonCaptureRate(G4int Z, G4int A);
static G4double GetMuonDecayRate(G4int Z);
static G4double GetMuonZeff(G4int Z);
static G4double GetKShellEnergy(G4double A);
static G4double GetLinApprox(G4int N,
const G4double* const X,
const G4double* const Y,
G4double Xuser);
};
#endif
@@ -1,39 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomNuclearCaptureChannel.hh 96314 2016-04-06 07:21:51Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 17 October 16 K.Lynch
// ------------------------------------------------------------
#ifndef G4MuonicAtomNuclearCaptureChannel_h
#define G4MuonicAtomNuclearCaptureChannel_h 1
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.hh 103108 2017-03-16 13:00:35Z gcosmo $
// $Id: G4ParticleDefinition.hh 106143 2017-09-14 06:34:42Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -49,6 +49,7 @@
// restructuring for Cuts per Region - H.Kurashige - 11 March 2003
// added MagneticMoment - H.Kurashige - March 2007
// modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013
// added support for MuonicAtom - K.L.Genser - September 2017
// ------------------------------------------------------------
#ifndef G4ParticleDefinition_h
@@ -200,6 +201,10 @@ class G4ParticleDefinition
// true only if the particle is G4Ions
// (it means that theProcessManager is same as one for G4GenricIon)
G4bool IsMuonicAtom() const;
// true only if the particle is a G4MuonicAtom
// (it means that theProcessManager is same as the one for G4GenricMuonicAtom)
G4int operator==(const G4ParticleDefinition &right) const;
G4int operator!=(const G4ParticleDefinition &right) const;
@@ -366,6 +371,7 @@ class G4ParticleDefinition
protected:
G4bool isGeneralIon;
G4bool isMuonicAtom;
public:
void SetParticleDefinitionID(G4int id=-1);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.icc 99391 2016-09-20 13:32:30Z gcosmo $
// $Id: G4ParticleDefinition.icc 106143 2017-09-14 06:34:42Z gcosmo $
//
inline
@@ -204,6 +204,12 @@ inline
return isGeneralIon;
}
inline
G4bool G4ParticleDefinition::IsMuonicAtom() const
{
return isMuonicAtom;
}
inline
G4int G4ParticleDefinition::GetParticleDefinitionID() const
{
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleTable.hh 94421 2015-11-16 08:22:56Z gcosmo $
// $Id: G4ParticleTable.hh 106143 2017-09-14 06:34:42Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -45,6 +45,7 @@
// 28 ct., 99 H.Kurashige
// modified implementation of Remove 21 Mar.,08 H.Kurashige
// remove G4ShortLivedTable 25 July, 13 H.Kurashige
// added support for MuonicAtom September, 17 K.L.Genser
//
#ifndef G4ParticleTable_h
@@ -219,12 +220,15 @@ class G4ParticleTable
G4bool readyToUse;
G4ParticleDefinition* genericIon;
G4ParticleDefinition* genericMuonicAtom;
public:
void SetReadiness(G4bool val=true);
G4bool GetReadiness() const;
G4ParticleDefinition* GetGenericIon() const;
void SetGenericIon(G4ParticleDefinition*);
G4ParticleDefinition* GetGenericMuonicAtom() const;
void SetGenericMuonicAtom(G4ParticleDefinition*);
private:
void CheckReadiness() const;
@@ -24,12 +24,13 @@
// ********************************************************************
//
//
// $Id: G4ParticleTable.icc 73711 2013-09-09 09:57:29Z gcosmo $
// $Id: G4ParticleTable.icc 106143 2017-09-14 06:34:42Z gcosmo $
//
//
// ------------------------------------------------------------
// implement new version for using STL map instaed of RW PtrHashedDictionary
// 28 ct., 99 H.Kurashige
// added support for MuonicAtom Sep, 17 K.L.Genser
inline
@@ -100,3 +101,15 @@ inline
{
genericIon = gi;
}
inline
G4ParticleDefinition* G4ParticleTable::GetGenericMuonicAtom() const
{
return genericMuonicAtom;
}
inline
void G4ParticleTable::SetGenericMuonicAtom(G4ParticleDefinition* gma)
{
genericMuonicAtom = gma;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VDecayChannel.hh 95906 2016-03-02 10:56:50Z gcosmo $
// $Id: G4VDecayChannel.hh 105720 2017-08-16 12:38:10Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -290,9 +290,6 @@ inline
inline
const G4String& G4VDecayChannel::GetKinematicsName() const { return kinematics_name; }
inline
void G4VDecayChannel::SetBR(G4double value){ rbranch = value; }
inline
G4double G4VDecayChannel::GetBR() const { return rbranch; }
+5 -9
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 101025 2016-11-04 08:36:30Z gcosmo $
# $Id: sources.cmake 106143 2017-09-14 06:34:42Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -45,13 +45,11 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4Ions.hh
G4IsotopeProperty.hh
G4KL3DecayChannel.hh
G4MuonicAtom.hh
G4MuonicAtomHelper.hh
G4MuonDecayChannel.hh
G4MuonDecayChannelWithSpin.hh
G4MuonRadiativeDecayChannelWithSpin.hh
G4MuonicAtom.hh
G4MuonicAtomDIODecayChannel.hh
G4MuonicAtomHelper.hh
G4MuonicAtomNuclearCaptureChannel.hh
G4NeutronBetaDecayChannel.hh
G4NucleiProperties.hh
G4NucleiPropertiesTableAME03.hh
@@ -96,12 +94,10 @@ GEANT4_DEFINE_MODULE(NAME G4partman
G4Ions.cc
G4IsotopeProperty.cc
G4KL3DecayChannel.cc
G4MuonicAtom.cc
G4MuonicAtomHelper.cc
G4MuonDecayChannel.cc
G4MuonDecayChannelWithSpin.cc
G4MuonicAtom.cc
G4MuonicAtomDIODecayChannel.cc
G4MuonicAtomHelper.cc
G4MuonicAtomNuclearCaptureChannel.cc
G4MuonRadiativeDecayChannelWithSpin.cc
G4NeutronBetaDecayChannel.cc
G4NucleiProperties.cc
+43 -25
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DecayTable.cc 95052 2016-01-21 08:34:03Z gcosmo $
// $Id: G4DecayTable.cc 105720 2017-08-16 12:38:10Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -40,7 +40,8 @@
#include "G4DecayTable.hh"
#include "Randomize.hh"
G4DecayTable::G4DecayTable():parent(0)
G4DecayTable::G4DecayTable()
:parent(nullptr), channels(nullptr)
{
channels = new G4VDecayChannelVector;
}
@@ -48,29 +49,32 @@ G4DecayTable::G4DecayTable():parent(0)
G4DecayTable::~G4DecayTable()
{
// remove and delete all contents
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
delete (*i);
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
delete (*iCh);
}
channels->clear();
delete channels;
channels = 0;
channels = nullptr;
parent = nullptr;
}
void G4DecayTable::Insert( G4VDecayChannel * aChannel){
if (parent == 0) { parent = (G4ParticleDefinition*)(aChannel->GetParent()); }
if (parent == nullptr) {
parent = (G4ParticleDefinition*)(aChannel->GetParent());
}
if (parent != aChannel->GetParent()) {
#ifdef G4VERBOSE
G4cout << " G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) "
G4cout << " G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) "
<< " " << parent->GetParticleName()
<< " input:" << aChannel->GetParent()->GetParticleName() << G4endl;
#endif
} else {
G4double r = aChannel->GetBR();
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
if (r > (*i)->GetBR()) {
channels->insert(i,aChannel);
G4double br = aChannel->GetBR();
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
if (br > (*iCh)->GetBR()) {
channels->insert(iCh,aChannel);
return;
}
}
@@ -84,30 +88,44 @@ G4VDecayChannel *G4DecayTable::SelectADecayChannel(G4double parentMass)
if (channels->size()<1) return 0;
if(parentMass<0.) parentMass=parent->GetPDGMass();
G4VDecayChannelVector::iterator iCh;
G4double sumBR = 0.;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
if ( !((*iCh)->IsOKWithParentMass(parentMass)) ) continue;
sumBR += (*iCh)->GetBR();
}
if (sumBR <=0.0) {
#ifdef G4VERBOSE
G4cout << " G4DecayTable::SelectADecayChannel :: no possible DecayChannel"
<< " " << parent->GetParticleName() << G4endl;
#endif
return nullptr;
}
const size_t MAX_LOOP = 10000;
for (size_t loop_counter=0; loop_counter <MAX_LOOP; ++loop_counter){
G4double sumBR = 0.0;
G4double r= G4UniformRand();
G4double sum = 0.0;
G4double br= sumBR*G4UniformRand();
// select decay channel
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
sumBR += (*i)->GetBR();
if ( !((*i)->IsOKWithParentMass(parentMass)) ) continue;
if (r < sumBR) return (*i);
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
sum += (*iCh)->GetBR();
if ( !((*iCh)->IsOKWithParentMass(parentMass)) ) continue;
if (br < sum) return (*iCh);
}
}
return 0;
return nullptr;
}
void G4DecayTable::DumpInfo() const
{
G4cout << "G4DecayTable: " << parent->GetParticleName() << G4endl;
G4int index =0;
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
G4cout << index << ": ";
(*i)->DumpInfo();
index +=1;
(*iCh)->DumpInfo();
index += 1;
}
G4cout << G4endl;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DecayTableMessenger.cc 81373 2014-05-27 13:06:32Z gcosmo $
// $Id: G4DecayTableMessenger.cc 105720 2017-08-16 12:38:10Z gcosmo $
//
//
//---------------------------------------------------------------
@@ -57,13 +57,19 @@
G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
:theParticleTable(pTable),
currentParticle(0), currentDecayTable(0),
idxCurrentChannel(-1), currentChannel(0),
thisDirectory(0),dumpCmd(0),selectCmd(0),brCmd(0)
currentParticle(nullptr),
currentDecayTable(nullptr),
idxCurrentChannel(-1),
currentChannel(nullptr),
thisDirectory(nullptr),
dumpCmd(nullptr),
selectCmd(nullptr),
brCmd(nullptr)
{
if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
currentParticle = 0;
if ( theParticleTable == nullptr ) {
theParticleTable = G4ParticleTable::GetParticleTable();
}
currentParticle = nullptr;
//Commnad /particle/property/decay/
thisDirectory = new G4UIdirectory("/particle/property/decay/");
@@ -75,7 +81,7 @@ G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
selectCmd->SetParameterName("mode", true);
selectCmd->SetDefaultValue(0);
selectCmd->SetRange("mode >=0");
currentChannel = 0;
currentChannel = nullptr;
//Commnad /particle/property/decay/dump
dumpCmd = new G4UIcmdWithoutParameter("/particle/property/decay/dump",this);
@@ -91,19 +97,19 @@ G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
G4DecayTableMessenger::~G4DecayTableMessenger()
{
delete dumpCmd;
delete selectCmd;
delete brCmd;
delete thisDirectory;
if (dumpCmd != nullptr) delete dumpCmd;
if (selectCmd != nullptr) delete selectCmd;
if (brCmd != nullptr) delete brCmd;
if (thisDirectory != nullptr) delete thisDirectory;
}
void G4DecayTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (SetCurrentParticle()==0) {
if (SetCurrentParticle()== nullptr) {
G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
return;
}
if (currentDecayTable==0) {
if (currentDecayTable== nullptr) {
G4cout << "The particle has no decay table !! Command ignored." << G4endl;
return;
}
@@ -116,14 +122,14 @@ void G4DecayTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
//Commnad /particle/property/decay/select
G4int index = selectCmd->GetNewIntValue(newValue) ;
currentChannel = currentDecayTable->GetDecayChannel(index);
if ( currentChannel == 0 ) {
if ( currentChannel == nullptr ) {
G4cout << "Invalid index. Command ignored." << G4endl;
} else {
idxCurrentChannel = index;
}
} else {
if ( currentChannel == 0 ) {
if ( currentChannel == nullptr ) {
G4cout << "Select a decay channel. Command ignored." << G4endl;
return;
}
@@ -142,36 +148,36 @@ void G4DecayTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
G4ParticleDefinition* G4DecayTableMessenger::SetCurrentParticle()
{
// set currentParticle pointer
// set currentParticle pointer
// get particle name by asking G4ParticleMessenger via UImanager
G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
if (currentParticle != 0 ){
if (currentParticle != nullptr ){
// check whether selection is changed
if (currentParticle->GetParticleName() != particleName) {
currentParticle = theParticleTable->FindParticle(particleName);
idxCurrentChannel = -1;
currentDecayTable = 0;
currentDecayTable = nullptr;
} else {
// no change
return currentParticle;
}
} else {
currentParticle = theParticleTable->FindParticle(particleName);
idxCurrentChannel = -1;
currentDecayTable = 0;
}
if (currentParticle != 0 ){
currentDecayTable = currentParticle->GetDecayTable();
if ((currentDecayTable != 0 ) && (idxCurrentChannel >0) ) {
currentChannel = currentDecayTable->GetDecayChannel(idxCurrentChannel);
} else {
idxCurrentChannel = -1;
currentChannel = 0;
currentDecayTable = nullptr;
if (currentParticle != nullptr ){
currentDecayTable = currentParticle->GetDecayTable();
if ((currentDecayTable != nullptr ) && (idxCurrentChannel >0) ) {
currentChannel = currentDecayTable->GetDecayChannel(idxCurrentChannel);
} else {
idxCurrentChannel = -1;
currentChannel = nullptr;
}
}
}
return currentParticle;
}
@@ -180,7 +186,7 @@ G4String G4DecayTableMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String returnValue('\0');
if (SetCurrentParticle()==0) {
if (SetCurrentParticle()==nullptr) {
// no particle is selected. return null
return returnValue;
}
@@ -190,7 +196,7 @@ G4String G4DecayTableMessenger::GetCurrentValue(G4UIcommand * command)
returnValue = selectCmd->ConvertToString(idxCurrentChannel);
} else if( command == brCmd ){
if ( currentChannel != 0) {
if ( currentChannel != nullptr) {
returnValue = brCmd->ConvertToString(currentChannel->GetBR());
}
}
+62 -16
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4IonTable.cc 102916 2017-03-02 12:58:58Z gcosmo $
// $Id: G4IonTable.cc 106143 2017-09-14 06:34:42Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -44,6 +44,7 @@
// Modified Element Name for Z>103 06 Apr. 01 H.Kurashige
// Remove test of cuts in SetCuts 16 Jan 03 V.Ivanchenko
// Added initial support for Muonic Atoms 1 Jul 16 K.Lynch
// Extended support for Muonic Atoms September 17 K.L.Genser
#include <iostream>
#include <iomanip>
@@ -1518,23 +1519,68 @@ void G4IonTable::AddProcessManager(G4ParticleDefinition* ion)
// return;
// }
// check whether GenericIon has processes
G4ParticleDefinition* genericIon =
G4ParticleTable::GetParticleTable()->GetGenericIon();
if(ion->IsGeneralIon()) {
G4ProcessManager* pman=0;
if (genericIon!=0) pman = genericIon->GetProcessManager();
if ((genericIon ==0) || (genericIon->GetParticleDefinitionID() < 0) || (pman==0)){
G4cout << "G4IonTable::AddProcessManager() : can not create ion of "
<< ion->GetParticleName()
<< " because GenericIon is not available!!" << G4endl;
G4Exception( "G4IonTable::AddProcessManager()","PART105", FatalException,
"Can not create ions because GenericIon is not available");
return;
}
// check whether GenericIon has processes
G4ParticleDefinition* genericIon =
G4ParticleTable::GetParticleTable()->GetGenericIon();
G4ProcessManager* pman=0;
if (genericIon!=0) pman = genericIon->GetProcessManager();
if ((genericIon ==0) || (genericIon->GetParticleDefinitionID() < 0) || (pman==0)){
G4cout << "G4IonTable::AddProcessManager() : can not create ion of "
<< ion->GetParticleName()
<< " because GenericIon is not available!!" << G4endl;
G4Exception( "G4IonTable::AddProcessManager()","PART105", FatalException,
"Can not create ions because GenericIon is not available");
return;
}
//////// ion->SetProcessManager(pman);
ion->SetParticleDefinitionID(genericIon->GetParticleDefinitionID());
//////// ion->SetProcessManager(pman);
ion->SetParticleDefinitionID(genericIon->GetParticleDefinitionID());
}
else {
// is this a MuonicAtom ?
G4MuonicAtom* muatom = dynamic_cast<G4MuonicAtom*> (ion);
if ( muatom != nullptr ) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4IonTable::AddProcessManager() : MuonicAtom dynamic_cast succeeded for "
<< ion->GetParticleName() << G4endl;
}
#endif
// check whether GenericMuonicAtom has processes
G4ParticleDefinition* genericMA =
G4ParticleTable::GetParticleTable()->GetGenericMuonicAtom();
G4ProcessManager* pman = nullptr;
if (genericMA != nullptr) pman = genericMA->GetProcessManager();
if ((genericMA == nullptr) || (genericMA->GetParticleDefinitionID() < 0) || (pman==nullptr)){
G4cout << "G4IonTable::AddProcessManager() : can not create MuonicAtom "
<< ion->GetParticleName()
<< " because GenericMuonicAtom is not available!!" << G4endl;
G4Exception( "G4IonTable::AddProcessManager()","PART106", FatalException,
"Can not create MuonicAtoms because GenericMuonicAtom is not available");
return;
}
//////// ion->SetProcessManager(pman);
ion->SetParticleDefinitionID(genericMA->GetParticleDefinitionID());
}
else {
G4cout << "G4IonTable::AddProcessManager() : can not create "
<< ion->GetParticleName()
<< " because of unsupported particle type !!" << G4endl;
G4Exception( "G4IonTable::AddProcessManager()","PART107", FatalException,
"Can not create particle");
return;
}
}
return;
}
#include <vector>
@@ -30,7 +30,9 @@
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, K.Lynch July 2016
// History:
// July 2016, K.Lynch - first implementation
// June 2017, K.L.Genser - added baseion, lifetimes and access functions
#include "G4MuonicAtom.hh"
@@ -42,17 +44,28 @@ G4MuonicAtom::G4MuonicAtom(
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifetime,
G4bool stable, G4double lifeTime,
G4DecayTable *decaytable, G4bool shortlived,
const G4String& subType
const G4String& subType, G4Ions const* baseion,
G4int anti_encoding,
G4double excitation,
G4int isomer,
G4double DIOLifeTime,
G4double NCLifeTime
) : G4Ions( aName,mass,width,charge,iSpin,iParity,
iConjugation,iIsospin,iIsospin3,gParity,pType,
lepton,baryon,encoding,stable,lifetime,decaytable,
shortlived, subType, 0,0,0)
iConjugation,iIsospin,iIsospin3,gParity,pType,
lepton,baryon,encoding,stable,lifeTime,decaytable,
shortlived,subType,anti_encoding,excitation,isomer),
baseIon(baseion),
fDIOLifeTime(DIOLifeTime),
fNCLifeTime(NCLifeTime)
{
// member is private in base, so we need to go through the public
// interface
SetFloatLevelBase(G4FloatLevelBase::no_Float);
isGeneralIon=true;
SetFloatLevelBase(G4FloatLevelBase::no_Float);
// from G4ParticleDefinition
isGeneralIon = false;
isMuonicAtom = true;
}
G4MuonicAtom::~G4MuonicAtom(){}
@@ -1,36 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomDIODecayChannel.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 17 October 16 K.Lynch
// ---------------------------------------------------------------
#include "G4MuonicAtomDIODecayChannel.hh"
@@ -26,53 +26,364 @@
//
// $Id: G4MuonicAtomHelper.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 1 July 16 K.Lynch
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History:
// July 2016, K.Lynch - first implementation
// June 2017, K.L.Genser - major revision;
// also copied functions from G4MuonMinusBoundDecay &
// old G4MuMinusCaptureCascade; used constexpr
// ---------------------------------------------------------------
#include "G4MuonicAtomHelper.hh"
#include "G4DecayTable.hh"
#include "G4PhaseSpaceDecayChannel.hh"
#include "G4ParticleTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
G4MuonicAtom*
G4MuonicAtom*
G4MuonicAtomHelper::ConstructMuonicAtom(G4String name, G4int encoding, G4Ions const* baseion){
// mass calculation is missing binding energy correction
//auto const mass = G4MuonMinus::Definition()->GetPDGMass() + baseion->GetPDGMass();
auto const mass = 0.1056583715*CLHEP::GeV + baseion->GetPDGMass();
// what should static charge be? for G4Ions, it is Z ... should it
// be Z-1 here (since there will always be a muon attached), or Z?
auto const charge = baseion->GetPDGCharge();
auto muatom = new G4MuonicAtom(name, mass, 0.0, charge,
const G4double charge = baseion->GetPDGCharge();
static const G4String pType("MuonicAtom"); // put in an include? in an enum?
G4bool stable = false;
// Get the lifetime
G4int Z = baseion->GetAtomicNumber();
G4int A = baseion->GetAtomicMass();
G4double lambdac = GetMuonCaptureRate(Z, A);
G4double lambdad = GetMuonDecayRate(Z);
G4double lifetime = 1./(lambdac+lambdad);
G4bool shortlived = false;
const G4double mass =
(G4ParticleTable::GetParticleTable()->FindParticle("mu-"))->GetPDGMass() +
baseion->GetPDGMass() - GetKShellEnergy(G4double(Z)); //fixme check
G4DecayTable* decayTable = new G4DecayTable();
auto muatom = new G4MuonicAtom(name, mass, 0.0, charge,
baseion->GetPDGiSpin(),
baseion->GetPDGiParity(),
baseion->GetPDGiConjugation(),
baseion->GetPDGiIsospin(),
baseion->GetPDGiIsospin3(),
baseion->GetPDGiGParity(),
baseion->GetParticleType(),
pType,
baseion->GetLeptonNumber(),
baseion->GetBaryonNumber(),
encoding,
baseion->GetPDGStable(),
// TODO: this is wrong ... need to
// get correct muonic atom lifetime.
// but see next comment
baseion->GetPDGLifeTime(),
// TODO: this is _definitely_ wrong:
// we need to add muonic atom decay
// channels ... do we try to support
// other modes of decay, or do we
// just assume for now that we don't
// need to worry about radioactive
// decay and the like?
baseion->GetDecayTable(),
baseion->IsShortLived(),
baseion->GetParticleSubType());
stable,
lifetime,
decayTable,
shortlived,
baseion->GetParticleSubType(),
baseion);
muatom->SetPDGMagneticMoment(baseion->GetPDGMagneticMoment());
// by this time both G4MuonicAtom and baseion should exist
// if we choose DIO this will be the channel we'll use, so we put
// br=1. to force it in that case
decayTable->Insert(new G4PhaseSpaceDecayChannel(name, 1., 4,
"e-","anti_nu_e","nu_mu",
baseion->GetParticleName()));
muatom->SetDIOLifeTime(1./lambdad);
muatom->SetNCLifeTime(1./lambdac);
return muatom;
}
G4double G4MuonicAtomHelper::GetMuonCaptureRate(G4int Z, G4int A)
{
// Initialize data
// Mu- capture data from
// T. Suzuki, D. F. Measday, J.P. Roalsvig Phys.Rev. C35 (1987) 2212
// weighted average of the two most precise measurements
// Data for Hydrogen from Phys. Rev. Lett. 99(2007)032002
// Data for Helium from D.F. Measday Phys. Rep. 354(2001)243
struct capRate {
G4int Z;
G4int A;
G4double cRate;
G4double cRErr;
};
// this struct has to be sorted by Z when initialized as we exit the
// loop once Z is above the stored value; cRErr are not used now but
// are included for completeness and future use
constexpr capRate capRates [] = {
{ 1, 1, 0.000725, 0.000017 },
{ 2, 3, 0.002149, 0.00017 },
{ 2, 4, 0.000356, 0.000026 },
{ 3, 6, 0.004647, 0.00012 },
{ 3, 7, 0.002229, 0.00012 },
{ 4, 9, 0.006107, 0.00019 },
{ 5, 10, 0.02757 , 0.00063 },
{ 5, 11, 0.02188 , 0.00064 },
{ 6, 12, 0.03807 , 0.00031 },
{ 6, 13, 0.03474 , 0.00034 },
{ 7, 14, 0.06885 , 0.00057 },
{ 8, 16, 0.10242 , 0.00059 },
{ 8, 18, 0.0880 , 0.0015 },
{ 9, 19, 0.22905 , 0.00099 },
{ 10, 20, 0.2288 , 0.0045 },
{ 11, 23, 0.3773 , 0.0014 },
{ 12, 24, 0.4823 , 0.0013 },
{ 13, 27, 0.6985 , 0.0012 },
{ 14, 28, 0.8656 , 0.0015 },
{ 15, 31, 1.1681 , 0.0026 },
{ 16, 32, 1.3510 , 0.0029 },
{ 17, 35, 1.800 , 0.050 },
{ 17, 37, 1.250 , 0.050 },
{ 18, 40, 1.2727 , 0.0650 },
{ 19, 39, 1.8492 , 0.0050 },
{ 20, 40, 2.5359 , 0.0070 },
{ 21, 45, 2.711 , 0.025 },
{ 22, 48, 2.5908 , 0.0115 },
{ 23, 51, 3.073 , 0.022 },
{ 24, 50, 3.825 , 0.050 },
{ 24, 52, 3.465 , 0.026 },
{ 24, 53, 3.297 , 0.045 },
{ 24, 54, 3.057 , 0.042 },
{ 25, 55, 3.900 , 0.030 },
{ 26, 56, 4.408 , 0.022 },
{ 27, 59, 4.945 , 0.025 },
{ 28, 58, 6.11 , 0.10 },
{ 28, 60, 5.56 , 0.10 },
{ 28, 62, 4.72 , 0.10 },
{ 29, 63, 5.691 , 0.030 },
{ 30, 66, 5.806 , 0.031 },
{ 31, 69, 5.700 , 0.060 },
{ 32, 72, 5.561 , 0.031 },
{ 33, 75, 6.094 , 0.037 },
{ 34, 80, 5.687 , 0.030 },
{ 35, 79, 7.223 , 0.28 },
{ 35, 81, 7.547 , 0.48 },
{ 37, 85, 6.89 , 0.14 },
{ 38, 88, 6.93 , 0.12 },
{ 39, 89, 7.89 , 0.11 },
{ 40, 91, 8.620 , 0.053 },
{ 41, 93, 10.38 , 0.11 },
{ 42, 96, 9.298 , 0.063 },
{ 45, 103, 10.010 , 0.045 },
{ 46, 106, 10.000 , 0.070 },
{ 47, 107, 10.869 , 0.095 },
{ 48, 112, 10.624 , 0.094 },
{ 49, 115, 11.38 , 0.11 },
{ 50, 119, 10.60 , 0.11 },
{ 51, 121, 10.40 , 0.12 },
{ 52, 128, 9.174 , 0.074 },
{ 53, 127, 11.276 , 0.098 },
{ 55, 133, 10.98 , 0.25 },
{ 56, 138, 10.112 , 0.085 },
{ 57, 139, 10.71 , 0.10 },
{ 58, 140, 11.501 , 0.087 },
{ 59, 141, 13.45 , 0.13 },
{ 60, 144, 12.35 , 0.13 },
{ 62, 150, 12.22 , 0.17 },
{ 64, 157, 12.00 , 0.13 },
{ 65, 159, 12.73 , 0.13 },
{ 66, 163, 12.29 , 0.18 },
{ 67, 165, 12.95 , 0.13 },
{ 68, 167, 13.04 , 0.27 },
{ 72, 178, 13.03 , 0.21 },
{ 73, 181, 12.86 , 0.13 },
{ 74, 184, 12.76 , 0.16 },
{ 79, 197, 13.35 , 0.10 },
{ 80, 201, 12.74 , 0.18 },
{ 81, 205, 13.85 , 0.17 },
{ 82, 207, 13.295 , 0.071 },
{ 83, 209, 13.238 , 0.065 },
{ 90, 232, 12.555 , 0.049 },
{ 92, 238, 12.592 , 0.035 },
{ 92, 233, 14.27 , 0.15 },
{ 92, 235, 13.470 , 0.085 },
{ 92, 236, 13.90 , 0.40 },
{ 93, 237, 13.58 , 0.18 },
{ 94, 239, 13.90 , 0.20 },
{ 94, 242, 12.86 , 0.19 }
};
G4double lambda = -1.;
size_t nCapRates = sizeof(capRates)/sizeof(capRates[0]);
for (size_t j = 0; j < nCapRates; ++j) {
if( capRates[j].Z == Z && capRates[j].A == A ) {
lambda = capRates[j].cRate / microsecond;
break;
}
// make sure the data is sorted for the next statement to work correctly
if (capRates[j].Z > Z) {break;}
}
if (lambda < 0.) {
// == Mu capture lifetime (Goulard and Primakoff PRC10(1974)2034.
constexpr G4double b0a = -0.03;
constexpr G4double b0b = -0.25;
constexpr G4double b0c = 3.24;
constexpr G4double t1 = 875.e-9; // -10-> -9 suggested by user
G4double r1 = GetMuonZeff(Z);
G4double zeff2 = r1 * r1;
// ^-4 -> ^-5 suggested by user
G4double xmu = zeff2 * 2.663e-5;
G4double a2ze = 0.5 *G4double(A) / G4double(Z);
G4double r2 = 1.0 - xmu;
lambda = t1 * zeff2 * zeff2 * (r2 * r2) * (1.0 - (1.0 - xmu) * .75704) *
(a2ze * b0a + 1.0 - (a2ze - 1.0) * b0b -
G4double(2 * (A - Z) + std::abs(a2ze - 1.) ) * b0c / G4double(A * 4) );
}
return lambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuonicAtomHelper::GetMuonZeff(G4int Z)
{
// == Effective charges from
// "Total Nuclear Capture Rates for Negative Muons"
// T. Suzuki, D. F. Measday, J.P. Roalsvig Phys.Rev. C35 (1987) 2212
// and if not present from
// Ford and Wills Nucl Phys 35(1962)295 or interpolated
constexpr size_t maxZ = 100;
constexpr G4double zeff[maxZ+1] =
{ 0.,
1.00, 1.98, 2.94, 3.89, 4.81, 5.72, 6.61, 7.49, 8.32, 9.14,
9.95,10.69,11.48,12.22,12.90,13.64,14.24,14.89,15.53,16.15,
16.77,17.38,18.04,18.49,19.06,19.59,20.13,20.66,21.12,21.61,
22.02,22.43,22.84,23.24,23.65,24.06,24.47,24.85,25.23,25.61,
25.99,26.37,26.69,27.00,27.32,27.63,27.95,28.20,28.42,28.64,
28.79,29.03,29.27,29.51,29.75,29.99,30.22,30.36,30.53,30.69,
30.85,31.01,31.18,31.34,31.48,31.62,31.76,31.90,32.05,32.19,
32.33,32.47,32.61,32.76,32.94,33.11,33.29,33.46,33.64,33.81,
34.21,34.18,34.00,34.10,34.21,34.31,34.42,34.52,34.63,34.73,
34.84,34.94,35.05,35.16,35.25,35.36,35.46,35.57,35.67,35.78 };
if (Z<0) {Z=0;}
if (Z>G4int(maxZ)) {Z=maxZ;}
return zeff[Z];
}
G4double G4MuonicAtomHelper::GetMuonDecayRate(G4int Z)
{
// Decay time on K-shell
// N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
// this is the "small Z" approximation formula (2.9)
// Lambda(bound)/Lambda(free) = 1-beta(Z*alpha)**2 with beta~=2.5
// we assume that Z is Zeff
// PDG 2012 muon lifetime value is 2.1969811(22) 10e-6s
// which when inverted gives 0.45517005 10e+6/s
struct decRate {
G4int Z;
G4double dRate;
G4double dRErr;
};
// this struct has to be sorted by Z when initialized as we exit the
// loop once Z is above the stored value
constexpr decRate decRates [] = {
{ 1, 0.4558514, 0.0000151 }
};
G4double lambda = -1.;
// size_t nDecRates = sizeof(decRates)/sizeof(decRates[0]);
// for (size_t j = 0; j < nDecRates; ++j) {
// if( decRates[j].Z == Z ) {
// lambda = decRates[j].dRate / microsecond;
// break;
// }
// // make sure the data is sorted for the next statement to work
// if (decRates[j].Z > Z) {break;}
// }
// we'll use the above code once we have more data
// since we only have one value we just assign it
if (Z == 1) {lambda = decRates[0].dRate/microsecond;}
if (lambda < 0.) {
constexpr G4double freeMuonDecayRate = 0.45517005 / microsecond;
lambda = 1.0;
G4double x = GetMuonZeff(Z)*fine_structure_const;
lambda -= 2.5 * x * x;
lambda *= freeMuonDecayRate;
}
return lambda;
}
// From V.Ivanchenko's G4MuMinusCaptureCascade
G4double G4MuonicAtomHelper::GetKShellEnergy(G4double Z) {
// Calculate the Energy of K Mesoatom Level for this Element using
// the Energy of Hydrogen Atom taken into account finite size of the
// nucleus (V.Ivanchenko)
constexpr G4int ListK = 28;
constexpr G4double ListZK[ListK] = {
1., 2., 4., 6., 8., 11., 14., 17., 18., 21., 24.,
26., 29., 32., 38., 40., 41., 44., 49., 53., 55.,
60., 65., 70., 75., 81., 85., 92.};
constexpr G4double ListKEnergy[ListK] = {
0.00275, 0.011, 0.043, 0.098, 0.173, 0.326,
0.524, 0.765, 0.853, 1.146, 1.472,
1.708, 2.081, 2.475, 3.323, 3.627,
3.779, 4.237, 5.016, 5.647, 5.966,
6.793, 7.602, 8.421, 9.249, 10.222,
10.923,11.984};
// Energy with finite size corrections
G4double KEnergy = GetLinApprox(ListK,ListZK,ListKEnergy,Z);
return KEnergy;
}
// From V.Ivanchenko's G4MuMinusCaptureCascade
G4double G4MuonicAtomHelper::GetLinApprox(G4int N,
const G4double* const X,
const G4double* const Y,
G4double Xuser) {
G4double Yuser;
if(Xuser <= X[0]) Yuser = Y[0];
else if(Xuser >= X[N-1]) Yuser = Y[N-1];
else {
G4int i;
for (i=1; i<N; i++){
if(Xuser <= X[i]) break;
}
if(Xuser == X[i]) Yuser = Y[i];
else Yuser = Y[i-1] + (Y[i] - Y[i-1])*(Xuser - X[i-1])/(X[i] - X[i-1]);
}
return Yuser;
}
@@ -1,36 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MuonicAtomNuclearCaptureChannel.cc 96797 2016-05-09 10:13:42Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 17 October 16 K.Lynch
// ---------------------------------------------------------------
#include "G4MuonicAtomNuclearCaptureChannel.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PDGCodeChecker.cc 94091 2015-11-05 15:13:52Z gcosmo $
// $Id: G4PDGCodeChecker.cc 105720 2017-08-16 12:38:10Z gcosmo $
//
//
// ----------------------------------------------------------------------
@@ -325,6 +325,8 @@ G4int G4PDGCodeChecker::CheckForDiQuarks()
/////////////
G4int G4PDGCodeChecker::CheckForQuarks()
{
quark1 = std::abs(code);
if ( std::abs(quark1)>NumberOfQuarkFlavor ) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
@@ -338,8 +340,6 @@ G4int G4PDGCodeChecker::CheckForQuarks()
}
quark1 = std::abs(code);
// Fill Quark Contents
if (code>0){
theQuarkContent[quark1-1] =1;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleDefinition.cc 103108 2017-03-16 13:00:35Z gcosmo $
// $Id: G4ParticleDefinition.cc 106143 2017-09-14 06:34:42Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -48,6 +48,7 @@
//
// modify FillQuarkContents() to use G4PDGCodeChecker 17 Aug. 99 H.Kurashige
// modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013
// added support for MuonicAtom - K.L.Genser - June 2017
// --------------------------------------------------------------
@@ -121,9 +122,11 @@ G4ParticleDefinition::G4ParticleDefinition(
theAtomicMass(0),
verboseLevel(1),
fApplyCutsFlag(false),
isGeneralIon(false)
isGeneralIon(false),
isMuonicAtom(false)
{
static G4String nucleus("nucleus");
static const G4String nucleus("nucleus");
static const G4String muAtom("MuonicAtom");
g4particleDefinitionInstanceID = -1;
theProcessManagerShadow = 0;
@@ -151,7 +154,7 @@ G4ParticleDefinition::G4ParticleDefinition(
// check initialization is in Pre_Init state except for ions
G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState();
if ( !fShortLivedFlag && (theParticleType!=nucleus) && (currentState!=G4State_PreInit)){
if ( !fShortLivedFlag && (theParticleType!=nucleus) && (theParticleType!=muAtom) && (currentState!=G4State_PreInit)){
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout << "G4ParticleDefintion (other than ions and shortlived) should be created in Pre_Init state "
@@ -440,7 +443,7 @@ void G4ParticleDefinition::SetParticleDefinitionID(G4int id)
}
else
{
if(isGeneralIon)
if( isGeneralIon || isMuonicAtom )
{ g4particleDefinitionInstanceID = id; }
else
{
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ParticleTable.cc 103108 2017-03-16 13:00:35Z gcosmo $
// $Id: G4ParticleTable.cc 106143 2017-09-14 06:34:42Z gcosmo $
//
// class G4ParticleTable
//
@@ -47,6 +47,7 @@
// RW PtrHashedDictionary 28 Oct., 99 H.Kurashige
// remove G4ShortLivedTable 25 July, 13 H.Kurashige
// remove FindIon/GetIon 25 Sep. 14 H.Kurashige
// added support for MuonicAtom September, 17 K.L.Genser
//
#include "globals.hh"
@@ -112,7 +113,8 @@ G4ParticleTable::G4ParticleTable()
:verboseLevel(1),
noName(" "),
readyToUse(false),
genericIon(NULL)
genericIon(nullptr),
genericMuonicAtom(nullptr)
{
fDictionary = new G4PTblDictionary();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VDecayChannel.cc 98352 2016-07-08 08:21:00Z gcosmo $
// $Id: G4VDecayChannel.cc 105720 2017-08-16 12:38:10Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -50,17 +50,18 @@ G4VDecayChannel::G4VDecayChannel()
:kinematics_name(""),
rbranch(0.0),
numberOfDaughters(0),
parent_name(0), daughters_name(0),
parent_name(nullptr),
daughters_name(nullptr),
rangeMass(2.5),
parent_polarization(),
particletable(0),
particletable(nullptr),
verboseLevel(1)
{
G4MT_parent = 0;
G4MT_daughters = 0;
G4MT_parent = nullptr;
G4MT_daughters = nullptr;
G4MT_parent_mass = 0.0;
G4MT_daughters_mass = 0;
G4MT_daughters_width = 0;
G4MT_daughters_mass = nullptr;
G4MT_daughters_width = nullptr;
// set pointer to G4ParticleTable (static and singleton object)
particletable = G4ParticleTable::GetParticleTable();
@@ -70,19 +71,20 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName, G4int Verbose)
:kinematics_name(aName),
rbranch(0.0),
numberOfDaughters(0),
parent_name(0), daughters_name(0),
parent_name(nullptr),
daughters_name(nullptr),
rangeMass(2.5),
parent_polarization(),
particletable(0),
particletable(nullptr),
verboseLevel(Verbose),
daughtersMutex(G4MUTEX_INITIALIZER),
parentMutex(G4MUTEX_INITIALIZER)
{
G4MT_parent = 0;
G4MT_daughters = 0;
G4MT_parent = nullptr;
G4MT_daughters = nullptr;
G4MT_parent_mass = 0.0;
G4MT_daughters_mass = 0;
G4MT_daughters_width = 0;
G4MT_daughters_mass = nullptr;
G4MT_daughters_width = nullptr;
// set pointer to G4ParticleTable (static and singleton object)
particletable = G4ParticleTable::GetParticleTable();
@@ -99,7 +101,8 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
:kinematics_name(aName),
rbranch(theBR),
numberOfDaughters(theNumberOfDaughters),
parent_name(0), daughters_name(0),
parent_name(nullptr),
daughters_name(nullptr),
rangeMass(1.0),
parent_polarization(),
particletable(0),
@@ -107,11 +110,11 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
daughtersMutex(G4MUTEX_INITIALIZER),
parentMutex(G4MUTEX_INITIALIZER)
{
G4MT_parent = 0;
G4MT_daughters = 0;
G4MT_parent = nullptr;
G4MT_daughters = nullptr;
G4MT_parent_mass = 0.0;
G4MT_daughters_mass = 0;
G4MT_daughters_width = 0;
G4MT_daughters_mass = nullptr;
G4MT_daughters_width = nullptr;
// set pointer to G4ParticleTable (static and singleton object)
particletable = G4ParticleTable::GetParticleTable();
@@ -128,6 +131,9 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
if (numberOfDaughters>1) daughters_name[1] = new G4String(theDaughterName2);
if (numberOfDaughters>2) daughters_name[2] = new G4String(theDaughterName3);
if (numberOfDaughters>3) daughters_name[3] = new G4String(theDaughterName4);
if (rbranch <0. ) rbranch = 0.0;
else if (rbranch >1.0 ) rbranch = 1.0;
}
G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
@@ -139,26 +145,25 @@ G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
// copy parent name
parent_name = new G4String(*right.parent_name);
G4MT_parent = 0;
G4MT_parent = nullptr;
G4MT_parent_mass = 0.0;
//create array
numberOfDaughters = right.numberOfDaughters;
daughters_name =0;
daughters_name =nullptr;
if ( numberOfDaughters >0 ) {
daughters_name = new G4String*[numberOfDaughters];
//copy daughters name
for (G4int index=0; index < numberOfDaughters; index++)
{
daughters_name[index] = new G4String(*right.daughters_name[index]);
}
for (G4int index=0; index < numberOfDaughters; index++){
daughters_name[index] = new G4String(*right.daughters_name[index]);
}
}
//
G4MT_daughters_mass = 0;
G4MT_daughters = 0;
G4MT_daughters_width = 0;
G4MT_daughters_mass = nullptr;
G4MT_daughters = nullptr;
G4MT_daughters_width = nullptr;
// particle table
particletable = G4ParticleTable::GetParticleTable();
@@ -186,7 +191,7 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
// recreate array
numberOfDaughters = right.numberOfDaughters;
if ( numberOfDaughters >0 ) {
if (daughters_name !=0) ClearDaughtersName();
if (daughters_name != nullptr) ClearDaughtersName();
daughters_name = new G4String*[numberOfDaughters];
//copy daughters name
for (G4int index=0; index < numberOfDaughters; index++) {
@@ -196,11 +201,11 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
}
//
G4MT_parent = 0;
G4MT_daughters = 0;
G4MT_parent = nullptr;
G4MT_daughters = nullptr;
G4MT_parent_mass = 0.0;
G4MT_daughters_mass = 0;
G4MT_daughters_width = 0;
G4MT_daughters_mass = nullptr;
G4MT_daughters_width = nullptr;
// particle table
particletable = G4ParticleTable::GetParticleTable();
@@ -214,12 +219,12 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
G4VDecayChannel::~G4VDecayChannel()
{
ClearDaughtersName();
if (parent_name != 0) delete parent_name;
parent_name = 0;
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
G4MT_daughters_mass =0;
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
G4MT_daughters_width = 0;
if (parent_name != nullptr) delete parent_name;
parent_name = nullptr;
if (G4MT_daughters_mass != nullptr) delete [] G4MT_daughters_mass;
G4MT_daughters_mass =nullptr;
if (G4MT_daughters_width != nullptr) delete [] G4MT_daughters_width;
G4MT_daughters_width = nullptr;
G4MUTEXDESTROY(daughtersMutex);
G4MUTEXDESTROY(parentMutex);
}
@@ -227,7 +232,7 @@ G4VDecayChannel::~G4VDecayChannel()
void G4VDecayChannel::ClearDaughtersName()
{
G4AutoLock l(&daughtersMutex);
if ( daughters_name != 0) {
if ( daughters_name != nullptr) {
if (numberOfDaughters>0) {
#ifdef G4VERBOSE
if (verboseLevel>1) {
@@ -236,20 +241,19 @@ void G4VDecayChannel::ClearDaughtersName()
}
#endif
for (G4int index=0; index < numberOfDaughters; index++) {
if (daughters_name[index] != 0) delete daughters_name[index];
if (daughters_name[index] != nullptr) delete daughters_name[index];
}
}
delete [] daughters_name;
daughters_name = 0;
daughters_name = nullptr;
}
//
if (G4MT_daughters != 0) delete [] G4MT_daughters;
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
G4MT_daughters_width = 0;
G4MT_daughters = 0;
G4MT_daughters_mass = 0;
G4MT_daughters_width = 0;
if (G4MT_daughters != nullptr) delete [] G4MT_daughters;
if (G4MT_daughters_mass != nullptr) delete [] G4MT_daughters_mass;
if (G4MT_daughters_width != nullptr) delete [] G4MT_daughters_width;
G4MT_daughters_width = nullptr;
G4MT_daughters = nullptr;
G4MT_daughters_mass = nullptr;
numberOfDaughters = 0;
}
@@ -261,7 +265,7 @@ void G4VDecayChannel::SetNumberOfDaughters(G4int size)
ClearDaughtersName();
// cleate array
daughters_name = new G4String*[size];
for (G4int index=0;index<size;index++) daughters_name[index]=0;
for (G4int index=0;index<size;index++) daughters_name[index]=nullptr;
numberOfDaughters = size;
}
}
@@ -290,15 +294,15 @@ void G4VDecayChannel::SetDaughter(G4int anIndex,
// at construction, i.e. when G4MT_daugheters == 0
// moreover this method can be called only after SetNumberOfDaugthers
// has been called (see previous if), in such a case daughters_name != 0
if ( daughters_name == 0 ) {
G4Exception("G4VDecayChannel::SetDaughter","PART112",FatalException,
"Trying to add a daughter without specifying number of secondaries, useSetNumberOfDaughters first");
return;
if ( daughters_name == nullptr ) {
G4Exception("G4VDecayChannel::SetDaughter","PART112",FatalException,
"Trying to add a daughter without specifying number of secondaries, useSetNumberOfDaughters first");
return;
}
if ( G4MT_daughters != 0 ) {
G4Exception("G4VDecayChannel::SetDaughter","PART111",FatalException,
"Trying to modify a daughter of a decay channel, but decay channel already has daughters.");
return;
if ( G4MT_daughters != nullptr ) {
G4Exception("G4VDecayChannel::SetDaughter","PART111",FatalException,
"Trying to modify a daughter of a decay channel, but decay channel already has daughters.");
return;
}
//<-:ANDREA
@@ -324,7 +328,7 @@ void G4VDecayChannel::SetDaughter(G4int anIndex,
void G4VDecayChannel::SetDaughter(G4int anIndex, const G4ParticleDefinition * parent_type)
{
if (parent_type != 0) SetDaughter(anIndex, parent_type->GetParticleName());
if (parent_type != nullptr) SetDaughter(anIndex, parent_type->GetParticleName());
}
void G4VDecayChannel::FillDaughters()
@@ -332,16 +336,16 @@ void G4VDecayChannel::FillDaughters()
G4AutoLock lock(&daughtersMutex);
//Double check, check again if another thread has already filled this, in
//case do not need to do anything
if ( G4MT_daughters != 0 ) return;
if ( G4MT_daughters != nullptr ) return;
G4int index;
#ifdef G4VERBOSE
if (verboseLevel>1) G4cout << "G4VDecayChannel::FillDaughters()" <<G4endl;
#endif
if (G4MT_daughters != 0) {
if (G4MT_daughters != nullptr) {
delete [] G4MT_daughters;
G4MT_daughters = 0;
G4MT_daughters = nullptr;
}
// parent mass
@@ -352,7 +356,7 @@ void G4VDecayChannel::FillDaughters()
G4double sumofdaughtermass = 0.0;
G4double sumofdaughterwidthsq = 0.0;
if ((numberOfDaughters <=0) || (daughters_name == 0) ){
if ((numberOfDaughters <=0) || (daughters_name == nullptr) ){
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cout << "G4VDecayChannel::FillDaughters "
@@ -360,7 +364,7 @@ void G4VDecayChannel::FillDaughters()
<< "numberOfDaughters is not defined yet";
}
#endif
G4MT_daughters = 0;
G4MT_daughters = nullptr;
G4Exception("G4VDecayChannel::FillDaughters",
"PART011", FatalException,
"Can not fill daughters: numberOfDaughters is not defined yet");
@@ -368,13 +372,13 @@ void G4VDecayChannel::FillDaughters()
//create and set the array of pointers to daughter particles
G4MT_daughters = new G4ParticleDefinition*[numberOfDaughters];
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
if (G4MT_daughters_mass != nullptr) delete [] G4MT_daughters_mass;
if (G4MT_daughters_width != nullptr) delete [] G4MT_daughters_width;
G4MT_daughters_mass = new G4double[numberOfDaughters];
G4MT_daughters_width = new G4double[numberOfDaughters];
// loop over all daughters
for (index=0; index < numberOfDaughters; index++) {
if (daughters_name[index] == 0) {
if (daughters_name[index] == nullptr) {
// daughter name is not defined
#ifdef G4VERBOSE
if (verboseLevel>0) {
@@ -383,14 +387,14 @@ void G4VDecayChannel::FillDaughters()
<< index << "-th daughter is not defined yet" << G4endl;
}
#endif
G4MT_daughters[index] = 0;
G4MT_daughters[index] = nullptr;
G4Exception("G4VDecayChannel::FillDaughters",
"PART011", FatalException,
"Can not fill daughters: name of a daughter is not defined yet");
}
//search daughter particles in the particle table
G4MT_daughters[index] = particletable->FindParticle(*daughters_name[index]);
if (G4MT_daughters[index] == 0) {
if (G4MT_daughters[index] == nullptr ) {
// can not find the daughter particle
#ifdef G4VERBOSE
if (verboseLevel>0) {
@@ -448,9 +452,9 @@ void G4VDecayChannel::FillParent()
G4AutoLock lock(&parentMutex);
//Double check, check again if another thread has already filled this, in
//case do not need to do anything
if ( G4MT_parent != 0 ) return;
if ( G4MT_parent != nullptr ) return;
if (parent_name == 0) {
if (parent_name == nullptr) {
// parent name is not defined
#ifdef G4VERBOSE
if (verboseLevel>0) {
@@ -458,7 +462,7 @@ void G4VDecayChannel::FillParent()
<< ": parent name is not defined !!" << G4endl;
}
#endif
G4MT_parent = 0;
G4MT_parent = nullptr;
G4Exception("G4VDecayChannel::FillParent()",
"PART012", FatalException,
"Can not fill parent: parent name is not defined yet");
@@ -466,7 +470,7 @@ void G4VDecayChannel::FillParent()
}
// search parent particle in the particle table
G4MT_parent = particletable->FindParticle(*parent_name);
if (G4MT_parent == 0) {
if (G4MT_parent == nullptr) {
// parent particle does not exist
#ifdef G4VERBOSE
if (verboseLevel>0) {
@@ -484,7 +488,7 @@ void G4VDecayChannel::FillParent()
void G4VDecayChannel::SetParent(const G4ParticleDefinition * parent_type)
{
if (parent_type != 0) SetParent(parent_type->GetParticleName());
if (parent_type != nullptr) SetParent(parent_type->GetParticleName());
}
G4int G4VDecayChannel::GetAngularMomentum()
@@ -550,7 +554,7 @@ void G4VDecayChannel::DumpInfo()
G4cout << " BR: " << rbranch << " [" << kinematics_name << "]";
G4cout << " : " ;
for (G4int index=0; index < numberOfDaughters; index++){
if(daughters_name[index] != 0) {
if(daughters_name[index] != nullptr) {
G4cout << " " << *(daughters_name[index]);
} else {
G4cout << " not defined ";
@@ -597,3 +601,11 @@ G4bool G4VDecayChannel::IsOKWithParentMass(G4double parentMass)
}
return (parentMass >= sumOfDaughterMassMin);
}
void G4VDecayChannel::SetBR(G4double value)
{
rbranch = value;
if (rbranch <0. ) rbranch = 0.0;
else if (rbranch >1.0 ) rbranch = 1.0;
}