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
+41 -41
View File
@@ -23,19 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ---------------------------------------------------------------
//
// G4Trajectory.cc
// G4Trajectory 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 "G4Trajectory.hh"
#include "G4TrajectoryPoint.hh"
@@ -46,39 +41,40 @@
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
//#define G4ATTDEBUG
// #define G4ATTDEBUG
#ifdef G4ATTDEBUG
#include "G4AttCheck.hh"
#endif
G4Allocator<G4Trajectory>*& aTrajectoryAllocator()
{
G4ThreadLocalStatic G4Allocator<G4Trajectory>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4Trajectory>* _instance = nullptr;
return _instance;
}
G4Trajectory::G4Trajectory()
: positionRecord(0), fTrackID(0), fParentID(0),
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
{;}
: initialMomentum( G4ThreeVector() )
{
}
G4Trajectory::G4Trajectory(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 G4TrajectoryPoint(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();
// Following is for the first trajectory point
positionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
}
G4Trajectory::G4Trajectory(G4Trajectory & right):G4VTrajectory()
G4Trajectory::G4Trajectory(G4Trajectory& right)
: G4VTrajectory()
{
ParticleName = right.ParticleName;
PDGCharge = right.PDGCharge;
@@ -87,20 +83,22 @@ G4Trajectory::G4Trajectory(G4Trajectory & 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)
{
G4TrajectoryPoint* rightPoint = (G4TrajectoryPoint*)((*(right.positionRecord))[i]);
G4TrajectoryPoint* rightPoint
= (G4TrajectoryPoint*)((*(right.positionRecord))[i]);
positionRecord->push_back(new G4TrajectoryPoint(*rightPoint));
}
}
G4Trajectory::~G4Trajectory()
{
if (positionRecord) {
size_t i;
for(i=0;i<positionRecord->size();i++){
if (positionRecord != nullptr)
{
for(std::size_t i=0; i<positionRecord->size(); ++i)
{
delete (*positionRecord)[i];
}
positionRecord->clear();
@@ -112,6 +110,7 @@ void G4Trajectory::ShowTrajectory(std::ostream& os) const
{
// Invoke the default implementation in G4VTrajectory...
G4VTrajectory::ShowTrajectory(os);
// ... or override with your own code here.
}
@@ -119,6 +118,7 @@ void G4Trajectory::DrawTrajectory() const
{
// Invoke the default implementation in G4VTrajectory...
G4VTrajectory::DrawTrajectory();
// ... or override with your own code here.
}
@@ -127,8 +127,8 @@ const std::map<G4String,G4AttDef>* G4Trajectory::GetAttDefs() const
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4Trajectory",isNew);
if (isNew) {
if (isNew)
{
G4String ID("ID");
(*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
@@ -204,23 +204,23 @@ std::vector<G4AttValue>* G4Trajectory::CreateAttValues() const
void G4Trajectory::AppendStep(const G4Step* aStep)
{
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
GetPosition() ));
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
GetPosition()) );
}
G4ParticleDefinition* G4Trajectory::GetParticleDefinition()
{
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
}
void G4Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
{
if(!secondTrajectory) return;
if(secondTrajectory == nullptr) return;
G4Trajectory* seco = (G4Trajectory*)secondTrajectory;
G4int ent = seco->GetPointEntries();
for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
{
for(G4int i=1; i<ent; ++i) // initial pt of 2nd trajectory shouldn't be merged
{
positionRecord->push_back((*(seco->positionRecord))[i]);
}
delete (*seco->positionRecord)[0];