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
+52 -49
View File
@@ -23,20 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// ---------------------------------------------------------------
//
// G4SmoothTrajectory.cc
// G4SmoothTrajectory class implementation
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
// Makoto Asai (e-mail: asai@slac.stanford.edu)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
// --------------------------------------------------------------------
#include "G4SmoothTrajectory.hh"
#include "G4SmoothTrajectoryPoint.hh"
@@ -54,36 +48,41 @@
G4Allocator<G4SmoothTrajectory>*& aSmoothTrajectoryAllocator()
{
G4ThreadLocalStatic G4Allocator<G4SmoothTrajectory>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4SmoothTrajectory>* _instance = nullptr;
return _instance;
}
G4SmoothTrajectory::G4SmoothTrajectory()
: positionRecord(0), fTrackID(0), fParentID(0),
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
{;}
: initialMomentum( G4ThreeVector() )
{
}
G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
{
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
ParticleName = fpParticleDefinition->GetParticleName();
PDGCharge = fpParticleDefinition->GetPDGCharge();
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
fTrackID = aTrack->GetTrackID();
fParentID = aTrack->GetParentID();
initialKineticEnergy = aTrack->GetKineticEnergy();
initialMomentum = aTrack->GetMomentum();
positionRecord = new TrajectoryPointContainer();
// Following is for the first trajectory point
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
G4ParticleDefinition* fpParticleDefinition = aTrack->GetDefinition();
ParticleName = fpParticleDefinition->GetParticleName();
PDGCharge = fpParticleDefinition->GetPDGCharge();
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
fTrackID = aTrack->GetTrackID();
fParentID = aTrack->GetParentID();
initialKineticEnergy = aTrack->GetKineticEnergy();
initialMomentum = aTrack->GetMomentum();
positionRecord = new G4TrajectoryPointContainer();
// The first point has no auxiliary points, so set the auxiliary
// points vector to NULL
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), 0));
// Following is for the first trajectory point
//
positionRecord
->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
// The first point has no auxiliary points, so set the auxiliary
// points vector to NULL
//
positionRecord
->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), nullptr));
}
G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory & right):G4VTrajectory()
G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory& right)
: G4VTrajectory()
{
ParticleName = right.ParticleName;
PDGCharge = right.PDGCharge;
@@ -92,11 +91,12 @@ G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory & right):G4VTrajectory
fParentID = right.fParentID;
initialKineticEnergy = right.initialKineticEnergy;
initialMomentum = right.initialMomentum;
positionRecord = new TrajectoryPointContainer();
positionRecord = new G4TrajectoryPointContainer();
for(size_t i=0;i<right.positionRecord->size();i++)
for(std::size_t i=0; i<right.positionRecord->size(); ++i)
{
G4SmoothTrajectoryPoint* rightPoint = (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
G4SmoothTrajectoryPoint* rightPoint
= (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
}
}
@@ -105,8 +105,7 @@ G4SmoothTrajectory::~G4SmoothTrajectory()
{
if (positionRecord)
{
size_t i;
for(i=0;i<positionRecord->size();i++)
for(std::size_t i=0; i<positionRecord->size(); ++i)
{
delete (*positionRecord)[i];
}
@@ -118,14 +117,18 @@ G4SmoothTrajectory::~G4SmoothTrajectory()
void G4SmoothTrajectory::ShowTrajectory(std::ostream& os) const
{
// Invoke the default implementation in G4VTrajectory...
//
G4VTrajectory::ShowTrajectory(os);
// ... or override with your own code here.
}
void G4SmoothTrajectory::DrawTrajectory() const
{
// Invoke the default implementation in G4VTrajectory...
//
G4VTrajectory::DrawTrajectory();
// ... or override with your own code here.
}
@@ -134,8 +137,8 @@ const std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
if (isNew) {
if (isNew)
{
G4String ID("ID");
(*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
@@ -152,22 +155,19 @@ const std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
G4String IKE("IKE");
(*store)[IKE] =
G4AttDef(IKE, "Initial kinetic energy",
"Physics","G4BestUnit","G4double");
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy",
"Physics","G4BestUnit","G4double");
G4String IMom("IMom");
(*store)[IMom] = G4AttDef(IMom, "Initial momentum",
"Physics","G4BestUnit","G4ThreeVector");
"Physics","G4BestUnit","G4ThreeVector");
G4String IMag("IMag");
(*store)[IMag] = G4AttDef
(IMag, "Initial momentum magnitude",
"Physics","G4BestUnit","G4double");
(*store)[IMag] = G4AttDef(IMag, "Initial momentum magnitude",
"Physics","G4BestUnit","G4double");
G4String NTP("NTP");
(*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
}
return store;
}
@@ -213,8 +213,8 @@ std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
void G4SmoothTrajectory::AppendStep(const G4Step* aStep)
{
positionRecord->push_back(
new G4SmoothTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
aStep->GetPointerToVectorOfAuxiliaryPoints()));
new G4SmoothTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
aStep->GetPointerToVectorOfAuxiliaryPoints()));
}
G4ParticleDefinition* G4SmoothTrajectory::GetParticleDefinition()
@@ -224,11 +224,14 @@ G4ParticleDefinition* G4SmoothTrajectory::GetParticleDefinition()
void G4SmoothTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
{
if(!secondTrajectory) return;
if(secondTrajectory == nullptr) return;
G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
G4int ent = seco->GetPointEntries();
for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
// initial point of the second trajectory should not be merged
//
for(G4int i=1; i<ent; ++i)
{
positionRecord->push_back((*(seco->positionRecord))[i]);
}