Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -37,7 +37,9 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4RichTrajectory.hh"
|
||||
#include "G4ClonedRichTrajectory.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
@@ -47,6 +49,10 @@
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
namespace {
|
||||
G4Mutex CloneRichTrajectoryMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
@@ -61,15 +67,20 @@ G4Allocator<G4RichTrajectory>*& aRichTrajectoryAllocator()
|
||||
}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
|
||||
: G4Trajectory(aTrack) // Note: this initialises the base class data
|
||||
// members and, unfortunately but never mind,
|
||||
// creates a G4TrajectoryPoint in
|
||||
// TrajectoryPointContainer that we cannot
|
||||
// access because it's private. We store the
|
||||
// same information (plus more) in a
|
||||
// G4RichTrajectoryPoint in the
|
||||
// RichTrajectoryPointsContainer
|
||||
{
|
||||
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 G4RichTrajectoryPoint(aTrack));
|
||||
|
||||
fpInitialVolume = aTrack->GetTouchableHandle();
|
||||
fpInitialNextVolume = aTrack->GetNextTouchableHandle();
|
||||
fpCreatorProcess = aTrack->GetCreatorProcess();
|
||||
@@ -85,12 +96,26 @@ G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
|
||||
|
||||
// Insert the first rich trajectory point (see note above)...
|
||||
//
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aTrack));
|
||||
fpRichPointContainer = new G4TrajectoryPointContainer;
|
||||
fpRichPointContainer->push_back(new G4RichTrajectoryPoint(aTrack));
|
||||
}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right) : G4Trajectory(right)
|
||||
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right)
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialKineticEnergy = right.initialKineticEnergy;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new G4TrajectoryPointContainer();
|
||||
|
||||
for (auto& i : *right.positionRecord) {
|
||||
auto rightPoint = (G4RichTrajectoryPoint*)i;
|
||||
positionRecord->push_back(new G4RichTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
|
||||
fpInitialVolume = right.fpInitialVolume;
|
||||
fpInitialNextVolume = right.fpInitialNextVolume;
|
||||
fpCreatorProcess = right.fpCreatorProcess;
|
||||
@@ -99,27 +124,27 @@ G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right) : G4Trajectory(right
|
||||
fpFinalNextVolume = right.fpFinalNextVolume;
|
||||
fpEndingProcess = right.fpEndingProcess;
|
||||
fFinalKineticEnergy = right.fFinalKineticEnergy;
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
for (auto& i : *right.fpRichPointsContainer) {
|
||||
fpRichPointContainer = new G4TrajectoryPointContainer;
|
||||
for (auto& i : *right.fpRichPointContainer) {
|
||||
auto rightPoint = (G4RichTrajectoryPoint*)i;
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(*rightPoint));
|
||||
fpRichPointContainer->push_back(new G4RichTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4RichTrajectory::~G4RichTrajectory()
|
||||
{
|
||||
if (fpRichPointsContainer != nullptr) {
|
||||
for (auto& i : *fpRichPointsContainer) {
|
||||
if (fpRichPointContainer != nullptr) {
|
||||
for (auto& i : *fpRichPointContainer) {
|
||||
delete i;
|
||||
}
|
||||
fpRichPointsContainer->clear();
|
||||
delete fpRichPointsContainer;
|
||||
fpRichPointContainer->clear();
|
||||
delete fpRichPointContainer;
|
||||
}
|
||||
}
|
||||
|
||||
void G4RichTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aStep));
|
||||
fpRichPointContainer->push_back(new G4RichTrajectoryPoint(aStep));
|
||||
|
||||
// Except for first step, which is a sort of virtual step to start
|
||||
// the track, compute the final values...
|
||||
@@ -144,10 +169,10 @@ void G4RichTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
for (G4int i = 1; i < ent; ++i) {
|
||||
// initial point of the second trajectory should not be merged
|
||||
//
|
||||
fpRichPointsContainer->push_back((*(seco->fpRichPointsContainer))[i]);
|
||||
fpRichPointContainer->push_back((*(seco->fpRichPointContainer))[i]);
|
||||
}
|
||||
delete (*seco->fpRichPointsContainer)[0];
|
||||
seco->fpRichPointsContainer->clear();
|
||||
delete (*seco->fpRichPointContainer)[0];
|
||||
seco->fpRichPointContainer->clear();
|
||||
}
|
||||
|
||||
void G4RichTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
@@ -173,12 +198,35 @@ const std::map<G4String, G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectory", isNew);
|
||||
if (isNew) {
|
||||
// Get att defs from base class...
|
||||
//
|
||||
*store = *(G4Trajectory::GetAttDefs());
|
||||
|
||||
G4String ID;
|
||||
|
||||
ID = "ID";
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
ID = "PID";
|
||||
(*store)[ID] = G4AttDef(ID, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
ID = "PN";
|
||||
(*store)[ID] = G4AttDef(ID, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "Ch";
|
||||
(*store)[ID] = G4AttDef(ID, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
ID = "PDG";
|
||||
(*store)[ID] = G4AttDef(ID, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
ID = "IKE";
|
||||
(*store)[ID] = G4AttDef(ID, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
ID = "IMom";
|
||||
(*store)[ID] = G4AttDef(ID, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
ID = "IMag";
|
||||
(*store)[ID] = G4AttDef(ID, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
ID = "NTP";
|
||||
(*store)[ID] = G4AttDef(ID, "No. of points", "Physics", "", "G4int");
|
||||
|
||||
ID = "IVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Initial Volume Path", "Physics", "", "G4String");
|
||||
|
||||
@@ -230,7 +278,17 @@ static G4String Path(const G4TouchableHandle& th)
|
||||
std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
std::vector<G4AttValue>* values = G4Trajectory::CreateAttValues();
|
||||
//std::vector<G4AttValue>* values = G4VTrajectory::CreateAttValues();
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
|
||||
values->push_back(G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
|
||||
values->push_back(G4AttValue("PN", ParticleName, ""));
|
||||
values->push_back(G4AttValue("Ch", G4UIcommand::ConvertToString(PDGCharge), ""));
|
||||
values->push_back(G4AttValue("PDG", G4UIcommand::ConvertToString(PDGEncoding), ""));
|
||||
values->push_back(G4AttValue("IKE", G4BestUnit(initialKineticEnergy, "Energy"), ""));
|
||||
values->push_back(G4AttValue("IMom", G4BestUnit(initialMomentum, "Energy"), ""));
|
||||
values->push_back(G4AttValue("IMag", G4BestUnit(initialMomentum.mag(), "Energy"), ""));
|
||||
values->push_back(G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
|
||||
|
||||
if (fpInitialVolume && (fpInitialVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("IVPath", Path(fpInitialVolume), ""));
|
||||
@@ -293,3 +351,16 @@ std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4RichTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
G4VTrajectory* G4RichTrajectory::CloneForMaster() const
|
||||
{
|
||||
G4AutoLock lock(&CloneRichTrajectoryMutex);
|
||||
auto* cloned = new G4ClonedRichTrajectory(*this);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user