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
+16 -1
View File
@@ -1,4 +1,4 @@
$Id: History 100340 2016-10-18 07:50:12Z gcosmo $
$Id: History 106151 2017-09-14 06:43:04Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,21 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- 12 September 2017 Krzysztof Genser (decay-V10-03-04)
- Moved Muonic Atom files to processes/hadronic/stopping
- Replaced DECAY_MuonicAtomDecay process type with DECAY_MuAtom
- Aug. 15, 2017 Hisaya Kurashige (decay-V10-03-03)
- clean up NULL and 0 pointer and use nullptr
- remove tests/test01
- add tests/tst_dcy_01
- Aug. 14, 2017 Hisaya Kurashige (decay-V10-03-02)
- Modified to suppress Compiler Warning (clang80)
- Aug. 14, 2017 Hisaya Kurashige (decay-V10-03-00)
- Add ProcessDescription
- October 18, 2016 Gabriele Cosmo (decay-V10-02-03)
- Corrected CMake and GNUMake scripts to include new dependency on
particles/hadrons/ions submodule...
+13 -20
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Decay.hh 78547 2014-01-07 09:40:38Z gcosmo $
// $Id: G4Decay.hh 105727 2017-08-16 12:47:05Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -88,21 +88,21 @@ class G4Decay : public G4VRestDiscreteProcess
virtual G4VParticleChange *PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
) override;
virtual G4VParticleChange* AtRestDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
) override;
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
virtual void BuildPhysicsTable(const G4ParticleDefinition&) override;
// In G4Decay, thePhysicsTable stores values of
// beta * std::sqrt( 1 - beta*beta)
// as a function of normalized kinetic enregy (=Ekin/mass),
// becasuse this table is universal for all particle types,
virtual G4bool IsApplicable(const G4ParticleDefinition&);
virtual G4bool IsApplicable(const G4ParticleDefinition&) override;
// returns "true" if the decay process can be applied to
// the particle type.
@@ -123,13 +123,13 @@ class G4Decay : public G4VRestDiscreteProcess
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
);
) override;
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
) override;
protected: // With Description
// GetMeanFreePath returns ctau*beta*gamma for decay in flight
@@ -137,15 +137,15 @@ class G4Decay : public G4VRestDiscreteProcess
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
);
) override;
virtual G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition
);
) override;
public: //With Description
virtual void StartTracking(G4Track*);
virtual void EndTracking();
virtual void StartTracking(G4Track*) override;
virtual void EndTracking() override;
// inform Start/End of tracking for each track to the physics process
public: //With Description
@@ -156,9 +156,8 @@ class G4Decay : public G4VRestDiscreteProcess
G4double GetRemainderLifeTime() const;
//Get Remainder of life time at rest decay
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
virtual void ProcessDescription(std::ostream& outFile) const override;
//
protected:
G4int verboseLevel;
@@ -181,12 +180,6 @@ class G4Decay : public G4VRestDiscreteProcess
G4VExtDecayer* pExtDecayer;
};
inline
void G4Decay::SetVerboseLevel(G4int value){ verboseLevel = value; }
inline
G4int G4Decay::GetVerboseLevel() const { return verboseLevel; }
inline
G4VParticleChange* G4Decay::AtRestDoIt(
const G4Track& aTrack,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DecayProcessType.hh 71045 2013-06-10 09:34:33Z gcosmo $
// $Id: G4DecayProcessType.hh 106151 2017-09-14 06:43:04Z gcosmo $
//
//
//---------------------------------------------------------------
@@ -47,6 +47,7 @@ enum G4DecayProcessType
DECAY_PionMakeSpin ,
DECAY_Radioactive = 210,
DECAY_Unknown = 211,
DECAY_MuAtom = 221,
DECAY_External = 231
};
#endif
@@ -48,20 +48,23 @@ class G4DecayWithSpin : public G4Decay
// Destructor
virtual ~G4DecayWithSpin();
virtual void ProcessDescription(std::ostream& outFile) const override;
//
protected: // With Description
virtual G4VParticleChange* PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
) override;
virtual G4VParticleChange* AtRestDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
) override;
private:
G4ThreeVector Spin_Precession(const G4Step& aStep,
G4ThreeVector B, G4double deltatime );
G4ThreeVector Spin_Precession(const G4Step& aStep,
G4ThreeVector B, G4double deltatime );
};
@@ -1,64 +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: G4MuonicAtomDecay.hh 78547 2014-01-07 09:40:38Z gcosmo $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, 30 August 2016 K.Lynch
#ifndef G4MuonicAtomDecay_h
#define G4MuonicAtomDecay_h 1
#include "G4Decay.hh"
class G4MuonicAtomDecay : public G4Decay
{
// Class Description
// This class is a decay process
public:
// Constructors
G4MuonicAtomDecay(const G4String& processName ="MuonicAtomDecay");
virtual G4bool IsApplicable(const G4ParticleDefinition&) override;
// returns "true" if the decay process can be applied to
// the particle type.
};
#endif
@@ -46,6 +46,9 @@ class G4PionDecayMakeSpin : public G4Decay
// Destructor
virtual ~G4PionDecayMakeSpin();
virtual void ProcessDescription(std::ostream& outFile) const override;
//
private:
// copy constructor
@@ -57,7 +60,7 @@ class G4PionDecayMakeSpin : public G4Decay
protected:
virtual void DaughterPolarization(const G4Track& aTrack,
G4DecayProducts* products);
G4DecayProducts* products) override;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UnknownDecay.hh 71045 2013-06-10 09:34:33Z gcosmo $
// $Id: G4UnknownDecay.hh 105727 2017-08-16 12:47:05Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -65,24 +65,27 @@ class G4UnknownDecay : public G4VDiscreteProcess
virtual G4VParticleChange *PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
) override;
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
virtual void BuildPhysicsTable(const G4ParticleDefinition&) override;
// In G4UnknownDecay, thePhysicsTable stores values of
// beta * std::sqrt( 1 - beta*beta)
// as a function of normalized kinetic enregy (=Ekin/mass),
// becasuse this table is universal for all particle types,
virtual G4bool IsApplicable(const G4ParticleDefinition&);
virtual G4bool IsApplicable(const G4ParticleDefinition&) override;
// returns "true" if the decay process can be applied to
// the particle type.
virtual void ProcessDescription(std::ostream& outFile) const override;
//
protected: // With Description
virtual G4VParticleChange* DecayIt(
const G4Track& aTrack,
const G4Step& aStep
);
) ;
// The DecayIt() method returns by pointer a particle-change object,
// which has information of daughter particles.
@@ -92,7 +95,7 @@ class G4UnknownDecay : public G4VDiscreteProcess
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
) override;
protected: // With Description
@@ -100,11 +103,7 @@ class G4UnknownDecay : public G4VDiscreteProcess
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
);
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
) override;
private:
G4int verboseLevel;
@@ -147,12 +146,6 @@ inline
}
inline
void G4UnknownDecay::SetVerboseLevel(G4int value){ verboseLevel = value; }
inline
G4int G4UnknownDecay::GetVerboseLevel() const { return verboseLevel; }
inline
G4VParticleChange* G4UnknownDecay::PostStepDoIt(
const G4Track& aTrack,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VExtDecayer.hh 71045 2013-06-10 09:34:33Z gcosmo $
// $Id: G4VExtDecayer.hh 105727 2017-08-16 12:47:05Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -70,7 +70,7 @@ class G4VExtDecayer
) = 0;
const G4String& GetName() const;
protected:
G4String decayerName;
};
+2 -4
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 100340 2016-10-18 07:50:12Z gcosmo $
# $Id: sources.cmake 106151 2017-09-14 06:43:04Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -43,15 +43,13 @@ GEANT4_DEFINE_MODULE(NAME G4decay
G4Decay.hh
G4DecayProcessType.hh
G4DecayWithSpin.hh
G4MuonicAtomDecay.hh
G4PionDecayMakeSpin.hh
G4UnknownDecay.hh
G4VExtDecayer.hh
SOURCES
G4Decay.cc
G4DecayWithSpin.cc
G4MuonicAtomDecay.cc
G4PionDecayMakeSpin.cc
G4PionDecayMakeSpin.cc
G4UnknownDecay.cc
GRANULAR_DEPENDENCIES
G4csg
+51 -42
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Decay.cc 97800 2016-06-13 12:14:40Z gcosmo $
// $Id: G4Decay.cc 105727 2017-08-16 12:47:05Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -65,7 +65,7 @@ G4Decay::G4Decay(const G4String& processName)
verboseLevel(1),
HighestValue(20.0),
fRemainderLifeTime(-1.0),
pExtDecayer(0)
pExtDecayer(nullptr)
{
// set Process Sub Type
SetProcessSubType(static_cast<int>(DECAY));
@@ -81,7 +81,7 @@ G4Decay::G4Decay(const G4String& processName)
G4Decay::~G4Decay()
{
if (pExtDecayer) {
if (pExtDecayer != nullptr) {
delete pExtDecayer;
}
}
@@ -198,17 +198,17 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
//check if thePreAssignedDecayProducts exists
const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
G4bool isPreAssigned = (o_products != 0);
G4DecayProducts* products = 0;
G4bool isPreAssigned = (o_products != nullptr);
G4DecayProducts* products = nullptr;
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
// check if external decayer exists
G4bool isExtDecayer = (decaytable == 0) && (pExtDecayer !=0);
G4bool isExtDecayer = (decaytable == nullptr) && (pExtDecayer != nullptr);
// Error due to NO Decay Table
if ( (decaytable == 0) && !isExtDecayer &&!isPreAssigned ){
if ( (decaytable == nullptr) && !isExtDecayer && !isPreAssigned ){
if (GetVerboseLevel()>0) {
G4cout << "G4Decay::DoIt : decay table not defined for ";
G4cout << aParticle->GetDefinition()->GetParticleName()<< G4endl;
@@ -246,35 +246,38 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// wide resonance. However, if this is the case, and the channel is
// accepted, then the masses of the resonance daughter particles will
// be sampled by taking into account their widths.
G4VDecayChannel* decaychannel = 0;
G4VDecayChannel* decaychannel = nullptr;
G4double massParent = aParticle->GetMass();
decaychannel = decaytable->SelectADecayChannel(massParent);
if ( decaychannel ==0) {
if ( decaychannel == nullptr) {
// decay channel not found
G4ExceptionDescription ed;
ed << "Can not determine decay channel for "
<< aParticleDef->GetParticleName() << G4endl
<< " mass of dynamic particle: " << massParent/GeV << " (GEV)" << G4endl
<< " dacay table has " << decaytable->entries() << " entries" << G4endl;
<< aParticleDef->GetParticleName() << G4endl
<< " mass of dynamic particle: "
<< massParent/GeV << " (GEV)" << G4endl
<< " dacay table has " << decaytable->entries()
<< " entries" << G4endl;
G4double checkedmass=massParent;
if (massParent < 0.) {
checkedmass=aParticleDef->GetPDGMass();
ed << "Using PDG mass ("<<checkedmass/GeV << "(GeV)) in IsOKWithParentMass" << G4endl;
}
for (G4int ic =0;ic <decaytable->entries();++ic) {
G4VDecayChannel * dc= decaytable->GetDecayChannel(ic);
ed << ic << ": BR " << dc->GetBR() << ", IsOK? "
<< dc->IsOKWithParentMass(checkedmass)
<< ", --> ";
G4int ndaughters=dc->GetNumberOfDaughters();
for (G4int id=0;id<ndaughters;++id) {
if (id>0) ed << " + "; // seperator, except for first
ed << dc->GetDaughterName(id);
}
ed << G4endl;
}
checkedmass=aParticleDef->GetPDGMass();
ed << "Using PDG mass ("<<checkedmass/GeV
<< "(GeV)) in IsOKWithParentMass" << G4endl;
}
for (G4int ic =0;ic <decaytable->entries();++ic) {
G4VDecayChannel * dc= decaytable->GetDecayChannel(ic);
ed << ic << ": BR " << dc->GetBR() << ", IsOK? "
<< dc->IsOKWithParentMass(checkedmass)
<< ", --> ";
G4int ndaughters=dc->GetNumberOfDaughters();
for (G4int id=0;id<ndaughters;++id) {
if (id>0) ed << " + "; // seperator, except for first
ed << dc->GetDaughterName(id);
}
ed << G4endl;
}
G4Exception("G4Decay::DoIt", "DECAY003", FatalException,ed);
} else {
} else {
// execute DecayIt()
#ifdef G4VERBOSE
G4int temp = decaychannel->GetVerboseLevel();
@@ -353,35 +356,35 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
G4int index;
G4ThreeVector currentPosition;
const G4TouchableHandle thand = aTrack.GetTouchableHandle();
for (index=0; index < numberOfSecondaries; index++)
{
// get current position of the track
currentPosition = aTrack.GetPosition();
// create a new track object
G4Track* secondary = new G4Track( products->PopProducts(),
for (index=0; index < numberOfSecondaries; index++){
// get current position of the track
currentPosition = aTrack.GetPosition();
// create a new track object
G4Track* secondary = new G4Track( products->PopProducts(),
finalGlobalTime ,
currentPosition );
// switch on good for tracking flag
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(thand);
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
// switch on good for tracking flag
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(thand);
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
}
delete products;
// Kill the parent particle
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit);
fParticleChangeForDecay.ProposeLocalTime( finalLocalTime );
// Clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForDecay ;
}
void G4Decay::DaughterPolarization(const G4Track& , G4DecayProducts* )
{
// empty implementation
}
@@ -514,3 +517,9 @@ G4VParticleChange* G4Decay::PostStepDoIt(
}
}
void G4Decay::ProcessDescription(std::ostream& outFile) const
{
outFile << GetProcessName() << ": Decay of particles. \n"
<< "kinematics of daughters are dertermined by DecayChannels "
<< " or by PreAssignedDecayProducts\n";
}
+17 -24
View File
@@ -73,10 +73,8 @@ G4VParticleChange* G4DecayWithSpin::PostStepDoIt(const G4Track& aTrack, const G4
// get parent_polarization
G4ThreeVector parent_polarization = aParticle->GetPolarization();
if(parent_polarization == G4ThreeVector(0,0,0))
{
if(parent_polarization == G4ThreeVector(0,0,0)){
// Generate random polarization direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
@@ -91,26 +89,20 @@ G4VParticleChange* G4DecayWithSpin::PostStepDoIt(const G4Track& aTrack, const G4
parent_polarization.setX(px);
parent_polarization.setY(py);
parent_polarization.setZ(pz);
}
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable) {
if (decaytable != nullptr) {
for (G4int ip=0; ip<decaytable->entries(); ip++){
decaytable->GetDecayChannel(ip)->SetPolarization(parent_polarization);
}
}
}
G4ParticleChangeForDecay* pParticleChangeForDecay;
pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
pParticleChangeForDecay->ProposePolarization(parent_polarization);
//G4cout << parent_polarization.x() << ", "
// << parent_polarization.y() << ", "
// << parent_polarization.z() << G4endl;
return pParticleChangeForDecay;
}
@@ -124,10 +116,8 @@ G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4St
// get parent_polarization
G4ThreeVector parent_polarization = aParticle->GetPolarization();
if(parent_polarization == G4ThreeVector(0,0,0))
{
if(parent_polarization == G4ThreeVector(0,0,0)) {
// Generate random polarization direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
@@ -147,8 +137,7 @@ G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4St
G4FieldManager* fieldMgr = aStep.GetTrack()->GetVolume()->
GetLogicalVolume()->GetFieldManager();
if (!fieldMgr) {
if (fieldMgr == nullptr) {
G4TransportationManager *transportMgr =
G4TransportationManager::GetTransportationManager();
G4PropagatorInField* fFieldPropagator =
@@ -157,20 +146,18 @@ G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4St
fFieldPropagator->GetCurrentFieldManager();
}
const G4Field* field = NULL;
if(fieldMgr)field = fieldMgr->GetDetectorField();
if (field) {
const G4Field* field = nullptr;
if (fieldMgr != nullptr) field = fieldMgr->GetDetectorField();
if ( field != nullptr ) {
G4double point[4];
point[0] = (aStep.GetPostStepPoint()->GetPosition())[0];
point[1] = (aStep.GetPostStepPoint()->GetPosition())[1];
point[2] = (aStep.GetPostStepPoint()->GetPosition())[2];
point[3] = aTrack.GetGlobalTime();
G4double fieldValue[6];
G4double fieldValue[6] ={ 0., 0., 0., 0., 0., 0.};
field -> GetFieldValue(point,fieldValue);
G4ThreeVector B(fieldValue[0],fieldValue[1],fieldValue[2]);
// Call the spin precession only for non-zero mag. field
@@ -182,7 +169,7 @@ G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4St
// decay table
G4DecayTable *decaytable = aParticleDef->GetDecayTable();
if (decaytable) {
if ( decaytable != nullptr) {
for (G4int ip=0; ip<decaytable->entries(); ip++){
decaytable->GetDecayChannel(ip)->SetPolarization(parent_polarization);
}
@@ -190,7 +177,6 @@ G4VParticleChange* G4DecayWithSpin::AtRestDoIt(const G4Track& aTrack, const G4St
G4ParticleChangeForDecay* pParticleChangeForDecay;
pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
pParticleChangeForDecay->ProposePolarization(parent_polarization);
return pParticleChangeForDecay;
@@ -235,3 +221,10 @@ G4ThreeVector G4DecayWithSpin::Spin_Precession( const G4Step& aStep,
return newSpin;
}
void G4DecayWithSpin::ProcessDescription(std::ostream& outFile) const
{
outFile << GetProcessName()
<< ": Decay of particles considering parent polarization \n"
<< "kinematics of daughters are dertermined by DecayChannels \n";
}
@@ -1,49 +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: G4MuonicAtomDecay.cc 97800 2016-06-13 12:14:40Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, 30 August 2016
#include "G4MuonicAtomDecay.hh"
#include "G4GenericIon.hh"
// constructor
G4MuonicAtomDecay::G4MuonicAtomDecay(const G4String& processName)
: G4Decay(processName)
{}
G4bool
G4MuonicAtomDecay::IsApplicable(const G4ParticleDefinition& aParticleType)
{
if (aParticleType.GetParticleName() == "GenericIon")
return true;
return false;
}
@@ -84,7 +84,7 @@ void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
return;
}
G4DynamicParticle* aMuon = NULL;
G4DynamicParticle* aMuon = nullptr;
G4double emu(0), eneutrino(0);
G4ThreeVector p_muon, p_neutrino;
@@ -92,30 +92,28 @@ void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
G4int numberOfSecondaries = products->entries();
if (numberOfSecondaries > 0) {
for (G4int index=0; index < numberOfSecondaries; index++)
{
G4DynamicParticle* aSecondary = (*products)[index];
const 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();
}
for (G4int index=0; index < numberOfSecondaries; index++){
G4DynamicParticle* aSecondary = (*products)[index];
const 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 (aMuon == nullptr) return;
if (eneutrino==0||emu==0) return;
G4ThreeVector spin(0,0,0);
@@ -126,7 +124,6 @@ void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
G4double emmu = aMuonPlus->GetPDGMass();
if (numberOfSecondaries == 2 ) {
G4double scale = - (eneutrino - ( p_muon * p_neutrino )/(emu+emmu));
p_muon = scale * p_muon;
@@ -139,7 +136,6 @@ void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
if (aParticle->GetCharge() < 0.0) spin = -spin;
} else {
spin = G4RandomDirection();
}
@@ -150,3 +146,13 @@ void G4PionDecayMakeSpin::DaughterPolarization(const G4Track& aTrack,
return;
}
void G4PionDecayMakeSpin::ProcessDescription(std::ostream& outFile) const
{
outFile << GetProcessName()
<< ": Decay of mesons that can decay into a muon \n"
<< " i.e. pi+, pi-, K+, K- and K0_long \n"
<< " kinematics of daughters are dertermined by DecayChannels \n"
<< " polarization of daughter particles are take into account. \n";
}
+21 -15
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UnknownDecay.cc 71045 2013-06-10 09:34:33Z gcosmo $
// $Id: G4UnknownDecay.cc 105727 2017-08-16 12:47:05Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -95,8 +95,8 @@ G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step&
//check if thePreAssignedDecayProducts exists
const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
G4bool isPreAssigned = (o_products != 0);
G4DecayProducts* products = 0;
G4bool isPreAssigned = (o_products != nullptr);
G4DecayProducts* products = nullptr;
if (!isPreAssigned ){
fParticleChangeForDecay.SetNumberOfSecondaries(0);
@@ -154,22 +154,21 @@ G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step&
G4int index;
G4ThreeVector currentPosition;
const G4TouchableHandle thand = aTrack.GetTouchableHandle();
for (index=0; index < numberOfSecondaries; index++)
{
// get current position of the track
currentPosition = aTrack.GetPosition();
// create a new track object
G4Track* secondary = new G4Track( products->PopProducts(),
for (index=0; index < numberOfSecondaries; index++){
// get current position of the track
currentPosition = aTrack.GetPosition();
// create a new track object
G4Track* secondary = new G4Track( products->PopProducts(),
finalGlobalTime ,
currentPosition );
// switch on good for tracking flag
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(thand);
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
// switch on good for tracking flag
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(thand);
// add the secondary track in the List
fParticleChangeForDecay.AddSecondary(secondary);
}
delete products;
// Kill the parent particle
fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit);
@@ -180,6 +179,13 @@ G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step&
return &fParticleChangeForDecay ;
}
void G4UnknownDecay::ProcessDescription(std::ostream& outFile) const
{
outFile << GetProcessName()
<< ": Decay of 'unknown' particles. \n"
<< "kinematics of daughters are dertermined "
<< "by PreAssignedDecayProducts. \n";
}