Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -14,6 +14,15 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
08-Mar-2020 V. Ivanchenko hadr-partonstring-mgt-V10-06-01
- G4VParticipants, G4VPartonStringModel, G4VStringFragmentation,
G4StringModel - clean-up: removed unused methods, delete
operators, use C++11 keywords
24-Feb-2020 V. Ivanchenko hadr-partonstring-mgt-V10-06-00
- G4VStringFragmentation : use inheritance from G4HadronicInteraction;
removed implementations of private operators.
28-Nov-2019 A. Ribon hadr-partonstring-mgt-V10-05-02
- G4VPartonStringModel : fixed bug (use of "=" instead of "==" in
if-statement, found by Coverity) in the Scatter method.
@@ -39,42 +39,26 @@ class G4StringModel : public G4VHighEnergyGenerator
{
public:
G4StringModel();
~G4StringModel();
~G4StringModel() override;
private:
G4StringModel(const G4StringModel &right);
const G4StringModel & operator=(const G4StringModel &right);
G4bool operator==(const G4StringModel &right) const;
G4bool operator!=(const G4StringModel &right) const;
G4StringModel(const G4StringModel &right) = delete;
const G4StringModel & operator=(const G4StringModel &right) = delete;
G4bool operator==(const G4StringModel &right) const = delete;
G4bool operator!=(const G4StringModel &right) const = delete;
public:
void Set3DNucleus(G4V3DNucleus *const value);
void SetStringFragmentationModel(G4VStringFragmentation *const value);
private:
const G4V3DNucleus * Get3DNucleus() const;
const G4VStringFragmentation * GetStringFragmentationModel() const;
private:
G4V3DNucleus *the3DNucleus;
G4VStringFragmentation *theStringFragmentationModel;
};
inline const G4V3DNucleus * G4StringModel::Get3DNucleus() const
{
return the3DNucleus;
}
inline void G4StringModel::Set3DNucleus(G4V3DNucleus *const value)
{
the3DNucleus = value;
}
inline const G4VStringFragmentation * G4StringModel::GetStringFragmentationModel() const
{
return theStringFragmentationModel;
}
inline void G4StringModel::SetStringFragmentationModel(G4VStringFragmentation *const value)
{
theStringFragmentationModel = value;
@@ -43,17 +43,16 @@
class G4V3DNucleus;
class G4VParticipants
{
public:
G4VParticipants();
G4VParticipants(const G4VParticipants &right);
virtual ~G4VParticipants();
const G4VParticipants & operator=(const G4VParticipants &right);
G4bool operator==(const G4VParticipants &right) const;
G4bool operator!=(const G4VParticipants &right) const;
G4VParticipants(const G4VParticipants &right) = delete;
const G4VParticipants & operator=(const G4VParticipants &right) = delete;
G4bool operator==(const G4VParticipants &right) const = delete;
G4bool operator!=(const G4VParticipants &right) const = delete;
virtual void Init(G4int theZ, G4int theA);
virtual void SetNucleus(G4V3DNucleus* aNucleus);
@@ -63,10 +62,9 @@ class G4VParticipants
virtual void SetProjectileNucleus(G4V3DNucleus* aNucleus);
virtual G4V3DNucleus* GetProjectileNucleus() const;
protected:
G4V3DNucleus* theNucleus;
G4V3DNucleus* theProjectileNucleus;
private:
G4V3DNucleus* theProjectileNucleus;
};
// Class G4VParticipants
@@ -51,41 +51,35 @@ class G4VPartonStringModel : public G4VHighEnergyGenerator
{
public:
G4VPartonStringModel(const G4String& modelName = "Parton String Model");
virtual ~G4VPartonStringModel();
~G4VPartonStringModel() override;
private:
G4VPartonStringModel(const G4VPartonStringModel &right);
const G4VPartonStringModel & operator=(const G4VPartonStringModel &right);
G4bool operator==(const G4VPartonStringModel &right) const;
G4bool operator!=(const G4VPartonStringModel &right) const;
G4VPartonStringModel(const G4VPartonStringModel &right) = delete;
const G4VPartonStringModel & operator=
(const G4VPartonStringModel &right) = delete;
G4bool operator==(const G4VPartonStringModel &right) const = delete;
G4bool operator!=(const G4VPartonStringModel &right) const = delete;
public:
void SetFragmentationModel(G4VStringFragmentation * aModel);
G4KineticTrackVector * Scatter(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary);
virtual G4V3DNucleus * GetWoundedNucleus() const = 0;
virtual void ModelDescription(std::ostream& outFile) const;
virtual G4V3DNucleus * GetProjectileNucleus() const;
G4KineticTrackVector * Scatter(const G4Nucleus &theNucleus,
const G4DynamicParticle &thePrimary) override;
void ModelDescription(std::ostream& outFile) const override;
G4V3DNucleus * GetProjectileNucleus() const override;
protected:
virtual void Init(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary) = 0;
virtual G4ExcitedStringVector * GetStrings() = 0;
void SetThisPointer(G4VPartonStringModel * aPointer);
G4bool EnergyAndMomentumCorrector(G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMomentum);
private:
G4VStringFragmentation * stringFragmentationModel;
G4VPartonStringModel * theThis;
};
inline void G4VPartonStringModel::SetFragmentationModel(G4VStringFragmentation * aModel)
{
stringFragmentationModel = aModel;
}
inline void G4VPartonStringModel::SetThisPointer(G4VPartonStringModel * aPointer)
{
theThis=aPointer;
if(aModel != stringFragmentationModel) {
stringFragmentationModel = aModel;
}
}
#endif
@@ -28,27 +28,25 @@
#ifndef G4VStringFragmentation_h
#define G4VStringFragmentation_h 1
#include "G4HadronicInteraction.hh"
#include "G4ExcitedStringVector.hh"
class G4KineticTrackVector;
class G4VStringFragmentation
class G4VStringFragmentation : public G4HadronicInteraction
{
public:
G4VStringFragmentation();
virtual ~G4VStringFragmentation();
G4VStringFragmentation(const G4String& name = "StringFragmentation");
~G4VStringFragmentation() override;
private:
G4VStringFragmentation(const G4VStringFragmentation &right);
const G4VStringFragmentation & operator=(const G4VStringFragmentation &right);
G4bool operator==(const G4VStringFragmentation &right) const;
G4bool operator!=(const G4VStringFragmentation &right) const;
G4VStringFragmentation(const G4VStringFragmentation &right) = delete;
const G4VStringFragmentation & operator=
(const G4VStringFragmentation &right) = delete;
G4bool operator==(const G4VStringFragmentation &right) const = delete;
G4bool operator!=(const G4VStringFragmentation &right) const = delete;
public:
virtual G4KineticTrackVector * FragmentStrings(const G4ExcitedStringVector * theStrings)=0;
private:
};
#endif
@@ -29,7 +29,7 @@
#include "G4StringModel.hh"
G4StringModel::G4StringModel() : G4VHighEnergyGenerator(),
the3DNucleus(0), theStringFragmentationModel(0)
the3DNucleus(nullptr), theStringFragmentationModel(nullptr)
{
}
@@ -37,27 +37,4 @@ G4StringModel::~G4StringModel()
{
}
// private:
G4StringModel::G4StringModel(const G4StringModel &) : G4VHighEnergyGenerator(),
the3DNucleus(0), theStringFragmentationModel(0)
{
}
const G4StringModel & G4StringModel::operator=(const G4StringModel &)
{
throw G4HadronicException(__FILE__, __LINE__,
"G4StringModel::operator= meant to not be accessable");
return *this;
}
G4bool G4StringModel::operator==(const G4StringModel &) const
{
return false;
}
G4bool G4StringModel::operator!=(const G4StringModel &) const
{
return true;
}
@@ -40,44 +40,42 @@
#include "G4Fancy3DNucleus.hh"
G4VParticipants::G4VParticipants() : theNucleus(NULL),
theProjectileNucleus(NULL)
G4VParticipants::G4VParticipants() : theNucleus(nullptr),
theProjectileNucleus(nullptr)
{}
G4VParticipants::~G4VParticipants()
{
// G4cout << "G4VParticipants::~G4VParticipants()" << G4endl;
if ( theNucleus != NULL ) delete theNucleus;
if ( theProjectileNucleus != NULL ) delete theProjectileNucleus;
if ( theNucleus != nullptr ) delete theNucleus;
if ( theProjectileNucleus != nullptr ) delete theProjectileNucleus;
}
void G4VParticipants::Init(G4int theA, G4int theZ)
{
if ( theNucleus == NULL ) theNucleus = new G4Fancy3DNucleus();
if ( theNucleus == nullptr ) theNucleus = new G4Fancy3DNucleus();
theNucleus->Init(theA, theZ);
theNucleus->SortNucleonsIncZ();
}
void G4VParticipants::SetNucleus(G4V3DNucleus * aNucleus)
{
if (theNucleus != NULL) delete theNucleus;
if (theNucleus != nullptr) delete theNucleus;
theNucleus = aNucleus;
}
void G4VParticipants::InitProjectileNucleus(G4int theA, G4int theZ)
{
if ( theProjectileNucleus == NULL ) theProjectileNucleus = new G4Fancy3DNucleus();
if ( theProjectileNucleus == nullptr )
theProjectileNucleus = new G4Fancy3DNucleus();
theProjectileNucleus->Init(theA, theZ);
theProjectileNucleus->SortNucleonsDecZ();
}
void G4VParticipants::SetProjectileNucleus(G4V3DNucleus * aNucleus)
{
if (theProjectileNucleus != NULL) delete theProjectileNucleus;
if (theProjectileNucleus != nullptr) delete theProjectileNucleus;
theProjectileNucleus = aNucleus;
}
@@ -45,12 +45,14 @@
G4VPartonStringModel::G4VPartonStringModel(const G4String& modelName)
: G4VHighEnergyGenerator(modelName),
stringFragmentationModel(0),
theThis(0)
stringFragmentationModel(nullptr)
{
// Make shure Shotrylived particles are constructed.
// Make shure Shotrylived particles are constructed.
// VI: should not instantiate particles by any model
/*
G4ShortLivedConstructor ShortLived;
ShortLived.ConstructParticle();
*/
}
G4VPartonStringModel::~G4VPartonStringModel()
@@ -60,11 +62,11 @@ G4VPartonStringModel::~G4VPartonStringModel()
G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus,
const G4DynamicParticle &aPrimary)
{
G4ExcitedStringVector * strings = NULL;
G4ExcitedStringVector * strings = nullptr;
G4DynamicParticle thePrimary=aPrimary;
G4LorentzVector SumStringMom(0.,0.,0.,0.);
G4KineticTrackVector * theResult = 0;
G4Nucleon * theNuclNucleon(0);
G4Nucleon * theNuclNucleon(nullptr);
#ifdef debug_PartonStringModel
G4cout<<G4endl;
@@ -80,7 +82,7 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
G4cout<<"Initial charge "<<Qsum<<G4endl;
G4cout<<"-------------- Parton-String model: Generation of strings -------"<<G4endl<<G4endl;
Bsum -= theNucleus.GetA_asInt(); Qsum -= theNucleus.GetZ_asInt();
if(theThis->GetProjectileNucleus()) {
if(GetProjectileNucleus()) {
Bsum -= thePrimary.GetDefinition()->GetBaryonNumber();
Qsum -= thePrimary.GetDefinition()->GetPDGCharge();
}
@@ -101,20 +103,20 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
{
if (attempts++ > maxAttempts )
{
theThis->Init(theNucleus,thePrimary); // To put a nucleus into ground state
Init(theNucleus,thePrimary); // To put a nucleus into ground state
// But marks of hitted nucleons are left. They must be erased.
G4V3DNucleus * ResNucleus=theThis->GetWoundedNucleus();
theNuclNucleon = ResNucleus->StartLoop() ? ResNucleus->GetNextNucleon() : NULL;
G4V3DNucleus * ResNucleus = GetWoundedNucleus();
theNuclNucleon = ResNucleus->StartLoop() ? ResNucleus->GetNextNucleon() : nullptr;
while( theNuclNucleon )
{
if(theNuclNucleon->AreYouHit()) theNuclNucleon->Hit(nullptr);
theNuclNucleon = ResNucleus->GetNextNucleon();
}
G4V3DNucleus * ProjResNucleus=theThis->GetProjectileNucleus();
G4V3DNucleus * ProjResNucleus = GetProjectileNucleus();
if(ProjResNucleus != 0)
{
theNuclNucleon = ProjResNucleus->StartLoop() ? ProjResNucleus->GetNextNucleon() : NULL;
theNuclNucleon = ProjResNucleus->StartLoop() ? ProjResNucleus->GetNextNucleon() : nullptr;
while( theNuclNucleon )
{
if(theNuclNucleon->AreYouHit()) theNuclNucleon->Hit(nullptr);
@@ -135,18 +137,18 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
G4ThreeVector Position(0.,0.,2*ResNucleus->GetOuterRadius());
G4KineticTrack* Hadron = new G4KineticTrack(aPrimary.GetParticleDefinition(), 0.,
Position, aPrimary.Get4Momentum());
if(theResult == 0) theResult = new G4KineticTrackVector();
if(theResult == nullptr) theResult = new G4KineticTrackVector();
theResult->push_back(Hadron);
return theResult;
}
Success=true;
theThis->Init(theNucleus,thePrimary);
Init(theNucleus,thePrimary);
strings = GetStrings();
if (strings->size() == 0) { Success=false; continue; }
if (strings->empty()) { Success=false; continue; }
G4double stringEnergy(0);
SumStringMom=G4LorentzVector(0.,0.,0.,0.);
@@ -194,12 +196,12 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
G4double ExcitationEt(0.), ExcitationEp(0.);
#endif
G4V3DNucleus * ProjResNucleus=theThis->GetProjectileNucleus();
G4V3DNucleus * ProjResNucleus = GetProjectileNucleus();
G4int numberProtonProjectileResidual( 0 ), numberNeutronProjectileResidual( 0 );
if(ProjResNucleus != 0)
{
theNuclNucleon = ProjResNucleus->StartLoop() ? ProjResNucleus->GetNextNucleon() : NULL;
theNuclNucleon = ProjResNucleus->StartLoop() ? ProjResNucleus->GetNextNucleon() : nullptr;
G4int numberProtonProjectileHits( 0 ), numberNeutronProjectileHits( 0 );
while( theNuclNucleon )
{
@@ -230,10 +232,10 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
- thePrimary.GetDefinition()->GetPDGCharge() - numberNeutronProjectileHits;
}
G4V3DNucleus * ResNucleus=theThis->GetWoundedNucleus();
G4V3DNucleus * ResNucleus = GetWoundedNucleus();
// loop over wounded nucleus
theNuclNucleon = ResNucleus->StartLoop() ? ResNucleus->GetNextNucleon() : NULL;
theNuclNucleon = ResNucleus->StartLoop() ? ResNucleus->GetNextNucleon() : nullptr;
G4int numberProtonTargetHits( 0 ), numberNeutronTargetHits( 0 );
while( theNuclNucleon )
{
@@ -305,7 +307,7 @@ G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus
SumPsecondr=G4LorentzVector(0.,0.,0.,0.);
#endif
if(theResult != 0)
if(theResult != nullptr)
{
std::for_each(theResult->begin(), theResult->end(), DeleteKineticTrack());
delete theResult;
@@ -375,5 +377,5 @@ void G4VPartonStringModel::ModelDescription(std::ostream& outFile) const
}
G4V3DNucleus * G4VPartonStringModel::GetProjectileNucleus() const
{ return 0; }
{ return nullptr; }
@@ -28,32 +28,9 @@
// G4VStringFragmentation
#include "G4VStringFragmentation.hh"
G4VStringFragmentation::G4VStringFragmentation()
{
}
G4VStringFragmentation::G4VStringFragmentation(const G4VStringFragmentation &)
{
}
G4VStringFragmentation::G4VStringFragmentation(const G4String& name)
: G4HadronicInteraction(name)
{}
G4VStringFragmentation::~G4VStringFragmentation()
{
}
const G4VStringFragmentation & G4VStringFragmentation::operator=(const G4VStringFragmentation &)
{
throw G4HadronicException(__FILE__, __LINE__,
"G4VStringFragmentation::operator= meant to not be accessable");
return *this;
}
G4bool G4VStringFragmentation::operator==(const G4VStringFragmentation &) const
{
return false;
}
G4bool G4VStringFragmentation::operator!=(const G4VStringFragmentation &) const
{
return true;
}
{}