Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -327,7 +327,7 @@ G4bool G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(
|
||||
ListOfSphereRadius[ind] = 0.;
|
||||
ListOfSphereCenter[ind] = G4ThreeVector(0., 0., 0.);
|
||||
ListOfVol1Name[ind] = volume_name;
|
||||
ListOfVol2Name[ind] = mother_vol_name;
|
||||
ListOfVol2Name[ind] = std::move(mother_vol_name);
|
||||
AreaOfSurface[ind] = Area;
|
||||
}
|
||||
else {
|
||||
@@ -336,7 +336,7 @@ G4bool G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(
|
||||
ListOfSphereRadius.push_back(0.);
|
||||
ListOfSphereCenter.emplace_back(0., 0., 0.);
|
||||
ListOfVol1Name.push_back(volume_name);
|
||||
ListOfVol2Name.push_back(mother_vol_name);
|
||||
ListOfVol2Name.push_back(std::move(mother_vol_name));
|
||||
AreaOfSurface.push_back(Area);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedRichTrajectory class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedRichTrajectory.hh"
|
||||
#include "G4RichTrajectory.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
#include "G4ClonedRichTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4Allocator<G4ClonedRichTrajectory>*& aClonedRichTrajectoryAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedRichTrajectory>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedRichTrajectory::G4ClonedRichTrajectory(const 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 G4ClonedTrajectoryPointContainer();
|
||||
//for (auto& i : *right.positionRecord) {
|
||||
// auto rightPoint = (G4ClonedTrajectoryPoint*)i;
|
||||
// positionRecord->push_back(new G4ClonedTrajectoryPoint(*rightPoint));
|
||||
//}
|
||||
fpInitialVolume = right.fpInitialVolume;
|
||||
fpInitialNextVolume = right.fpInitialNextVolume;
|
||||
fpCreatorProcess = right.fpCreatorProcess;
|
||||
fCreatorModelID = right.fCreatorModelID;
|
||||
fpFinalVolume = right.fpFinalVolume;
|
||||
fpFinalNextVolume = right.fpFinalNextVolume;
|
||||
fpEndingProcess = right.fpEndingProcess;
|
||||
fFinalKineticEnergy = right.fFinalKineticEnergy;
|
||||
if(right.fpRichPointContainer!=nullptr && right.fpRichPointContainer->size()>0)
|
||||
{
|
||||
fpRichPointContainer = new G4TrajectoryPointContainer;
|
||||
for (auto& i : *right.fpRichPointContainer) {
|
||||
auto rightPoint = (G4RichTrajectoryPoint*)i;
|
||||
fpRichPointContainer->push_back(new G4ClonedRichTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4ClonedRichTrajectory::~G4ClonedRichTrajectory()
|
||||
{
|
||||
if (fpRichPointContainer != nullptr) {
|
||||
for (auto& i : *fpRichPointContainer) {
|
||||
delete i;
|
||||
}
|
||||
fpRichPointContainer->clear();
|
||||
delete fpRichPointContainer;
|
||||
}
|
||||
}
|
||||
|
||||
void G4ClonedRichTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpRichPointContainer->push_back(new G4ClonedRichTrajectoryPoint(aStep));
|
||||
|
||||
// Except for first step, which is a sort of virtual step to start
|
||||
// the track, compute the final values...
|
||||
//
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
|
||||
if (track->GetCurrentStepNumber() > 0) {
|
||||
fpFinalVolume = track->GetTouchableHandle();
|
||||
fpFinalNextVolume = track->GetNextTouchableHandle();
|
||||
fpEndingProcess = postStepPoint->GetProcessDefinedStep();
|
||||
fFinalKineticEnergy =
|
||||
aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetTotalEnergyDeposit();
|
||||
}
|
||||
}
|
||||
|
||||
void G4ClonedRichTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
auto seco = (G4ClonedRichTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for (G4int i = 1; i < ent; ++i) {
|
||||
// initial point of the second trajectory should not be merged
|
||||
//
|
||||
fpRichPointContainer->push_back((*(seco->fpRichPointContainer))[i]);
|
||||
}
|
||||
delete (*seco->fpRichPointContainer)[0];
|
||||
seco->fpRichPointContainer->clear();
|
||||
}
|
||||
|
||||
void G4ClonedRichTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
//
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void G4ClonedRichTrajectory::DrawTrajectory() const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
//
|
||||
G4VTrajectory::DrawTrajectory();
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedRichTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4ClonedRichTrajectory", isNew);
|
||||
if (isNew) {
|
||||
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");
|
||||
|
||||
ID = "INVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Initial Next Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "CPN";
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Process Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "CPTN";
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Process Type Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "CMID";
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Model ID", "Physics", "", "G4int");
|
||||
|
||||
ID = "CMN";
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Model Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "FVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Final Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "FNVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Final Next Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "EPN";
|
||||
(*store)[ID] = G4AttDef(ID, "Ending Process Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "EPTN";
|
||||
(*store)[ID] = G4AttDef(ID, "Ending Process Type Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "FKE";
|
||||
(*store)[ID] = G4AttDef(ID, "Final kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
}
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName() << ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedRichTrajectory::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
//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), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("IVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpInitialNextVolume && (fpInitialNextVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("INVPath", Path(fpInitialNextVolume), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("INVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpCreatorProcess != nullptr) {
|
||||
values->push_back(G4AttValue("CPN", fpCreatorProcess->GetProcessName(), ""));
|
||||
G4ProcessType type = fpCreatorProcess->GetProcessType();
|
||||
values->push_back(G4AttValue("CPTN", G4VProcess::GetProcessTypeName(type), ""));
|
||||
values->push_back(G4AttValue("CMID", G4UIcommand::ConvertToString(fCreatorModelID), ""));
|
||||
const G4String& creatorModelName = G4PhysicsModelCatalog::GetModelNameFromID(fCreatorModelID);
|
||||
values->push_back(G4AttValue("CMN", creatorModelName, ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("CPN", "None", ""));
|
||||
values->push_back(G4AttValue("CPTN", "None", ""));
|
||||
values->push_back(G4AttValue("CMID", "None", ""));
|
||||
values->push_back(G4AttValue("CMN", "None", ""));
|
||||
}
|
||||
|
||||
if (fpFinalVolume && (fpFinalVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("FVPath", Path(fpFinalVolume), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("FVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpFinalNextVolume && (fpFinalNextVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("FNVPath", Path(fpFinalNextVolume), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("FNVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpEndingProcess != nullptr) {
|
||||
values->push_back(G4AttValue("EPN", fpEndingProcess->GetProcessName(), ""));
|
||||
G4ProcessType type = fpEndingProcess->GetProcessType();
|
||||
values->push_back(G4AttValue("EPTN", G4VProcess::GetProcessTypeName(type), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("EPN", "None", ""));
|
||||
values->push_back(G4AttValue("EPTN", "None", ""));
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("FKE", G4BestUnit(fFinalKineticEnergy, "Energy"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4ClonedRichTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedRichTrajectoryPoint class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedRichTrajectoryPoint.hh"
|
||||
#include "G4RichTrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4Allocator<G4ClonedRichTrajectoryPoint>*& aClonedRichTrajectoryPointAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedRichTrajectoryPoint>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedRichTrajectoryPoint::G4ClonedRichTrajectoryPoint(const G4Track* aTrack)
|
||||
: fPosition(aTrack->GetPosition()),
|
||||
fPreStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fPostStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fpPreStepPointVolume(aTrack->GetTouchableHandle()),
|
||||
fpPostStepPointVolume(aTrack->GetNextTouchableHandle()),
|
||||
fPreStepPointWeight(aTrack->GetWeight()),
|
||||
fPostStepPointWeight(aTrack->GetWeight())
|
||||
{}
|
||||
|
||||
G4ClonedRichTrajectoryPoint::G4ClonedRichTrajectoryPoint(const G4Step* aStep)
|
||||
: fPosition(aStep->GetPostStepPoint()->GetPosition()),
|
||||
fpAuxiliaryPointVector(aStep->GetPointerToVectorOfAuxiliaryPoints()),
|
||||
fTotEDep(aStep->GetTotalEnergyDeposit())
|
||||
{
|
||||
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
||||
G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
|
||||
if (aStep->GetTrack()->GetCurrentStepNumber() <= 0) // First step
|
||||
{
|
||||
fRemainingEnergy = aStep->GetTrack()->GetKineticEnergy();
|
||||
}
|
||||
else {
|
||||
fRemainingEnergy = preStepPoint->GetKineticEnergy() - fTotEDep;
|
||||
}
|
||||
fpProcess = postStepPoint->GetProcessDefinedStep();
|
||||
fPreStepPointStatus = preStepPoint->GetStepStatus();
|
||||
fPostStepPointStatus = postStepPoint->GetStepStatus();
|
||||
fPreStepPointGlobalTime = preStepPoint->GetGlobalTime();
|
||||
fPostStepPointGlobalTime = postStepPoint->GetGlobalTime();
|
||||
fpPreStepPointVolume = preStepPoint->GetTouchableHandle();
|
||||
fpPostStepPointVolume = postStepPoint->GetTouchableHandle();
|
||||
fPreStepPointWeight = preStepPoint->GetWeight();
|
||||
fPostStepPointWeight = postStepPoint->GetWeight();
|
||||
}
|
||||
|
||||
G4ClonedRichTrajectoryPoint::G4ClonedRichTrajectoryPoint(const G4RichTrajectoryPoint& right)
|
||||
{
|
||||
fPosition = right.fPosition;
|
||||
fTotEDep = right.fTotEDep;
|
||||
fRemainingEnergy = right.fRemainingEnergy;
|
||||
fpProcess = right.fpProcess;
|
||||
fPreStepPointStatus = right.fPreStepPointStatus;
|
||||
fPostStepPointStatus = right.fPostStepPointStatus;
|
||||
fPreStepPointGlobalTime = right.fPreStepPointGlobalTime;
|
||||
fPostStepPointGlobalTime = right.fPostStepPointGlobalTime;
|
||||
fpPreStepPointVolume = right.fpPreStepPointVolume;
|
||||
fpPostStepPointVolume = right.fpPostStepPointVolume;
|
||||
fPreStepPointWeight = right.fPreStepPointWeight;
|
||||
fPostStepPointWeight = right.fPostStepPointWeight;
|
||||
if(right.fpAuxiliaryPointVector!=nullptr && right.fpAuxiliaryPointVector->size()>0)
|
||||
{
|
||||
fpAuxiliaryPointVector = new std::vector<G4ThreeVector>;
|
||||
for(auto& i : *(right.fpAuxiliaryPointVector))
|
||||
{ fpAuxiliaryPointVector->push_back(i); }
|
||||
}
|
||||
}
|
||||
|
||||
G4ClonedRichTrajectoryPoint::~G4ClonedRichTrajectoryPoint() { delete fpAuxiliaryPointVector; }
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedRichTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String ID;
|
||||
|
||||
ID = "Pos";
|
||||
(*store)[ID] = G4AttDef(ID, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
ID = "Aux";
|
||||
(*store)[ID] =
|
||||
G4AttDef(ID, "Auxiliary Point Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
ID = "TED";
|
||||
(*store)[ID] = G4AttDef(ID, "Total Energy Deposit", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "RE";
|
||||
(*store)[ID] = G4AttDef(ID, "Remaining Energy", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PDS";
|
||||
(*store)[ID] = G4AttDef(ID, "Process Defined Step", "Physics", "", "G4String");
|
||||
ID = "PTDS";
|
||||
(*store)[ID] = G4AttDef(ID, "Process Type Defined Step", "Physics", "", "G4String");
|
||||
ID = "PreStatus";
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point status", "Physics", "", "G4String");
|
||||
ID = "PostStatus";
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point status", "Physics", "", "G4String");
|
||||
ID = "PreT";
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point global time", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PostT";
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point global time", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PreVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step Volume Path", "Physics", "", "G4String");
|
||||
ID = "PostVPath";
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step Volume Path", "Physics", "", "G4String");
|
||||
ID = "PreW";
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point weight", "Physics", "", "G4double");
|
||||
ID = "PostW";
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point weight", "Physics", "", "G4double");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
static G4String Status(G4StepStatus stps)
|
||||
{
|
||||
G4String status;
|
||||
switch (stps) {
|
||||
case fWorldBoundary:
|
||||
status = "fWorldBoundary";
|
||||
break;
|
||||
case fGeomBoundary:
|
||||
status = "fGeomBoundary";
|
||||
break;
|
||||
case fAtRestDoItProc:
|
||||
status = "fAtRestDoItProc";
|
||||
break;
|
||||
case fAlongStepDoItProc:
|
||||
status = "fAlongStepDoItProc";
|
||||
break;
|
||||
case fPostStepDoItProc:
|
||||
status = "fPostStepDoItProc";
|
||||
break;
|
||||
case fUserDefinedLimit:
|
||||
status = "fUserDefinedLimit";
|
||||
break;
|
||||
case fExclusivelyForcedProc:
|
||||
status = "fExclusivelyForcedProc";
|
||||
break;
|
||||
case fUndefined:
|
||||
status = "fUndefined";
|
||||
break;
|
||||
default:
|
||||
status = "Not recognised";
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName() << ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedRichTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
if (fpAuxiliaryPointVector != nullptr) {
|
||||
for (const auto& iAux : *fpAuxiliaryPointVector) {
|
||||
values->push_back(G4AttValue("Aux", G4BestUnit(iAux, "Length"), ""));
|
||||
}
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("TED", G4BestUnit(fTotEDep, "Energy"), ""));
|
||||
values->push_back(G4AttValue("RE", G4BestUnit(fRemainingEnergy, "Energy"), ""));
|
||||
|
||||
if (fpProcess != nullptr) {
|
||||
values->push_back(G4AttValue("PDS", fpProcess->GetProcessName(), ""));
|
||||
values->push_back(
|
||||
G4AttValue("PTDS", G4VProcess::GetProcessTypeName(fpProcess->GetProcessType()), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("PDS", "None", ""));
|
||||
values->push_back(G4AttValue("PTDS", "None", ""));
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("PreStatus", Status(fPreStepPointStatus), ""));
|
||||
|
||||
values->push_back(G4AttValue("PostStatus", Status(fPostStepPointStatus), ""));
|
||||
|
||||
values->push_back(G4AttValue("PreT", G4BestUnit(fPreStepPointGlobalTime, "Time"), ""));
|
||||
|
||||
values->push_back(G4AttValue("PostT", G4BestUnit(fPostStepPointGlobalTime, "Time"), ""));
|
||||
|
||||
if (fpPreStepPointVolume && (fpPreStepPointVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("PreVPath", Path(fpPreStepPointVolume), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("PreVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpPostStepPointVolume && (fpPostStepPointVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("PostVPath", Path(fpPostStepPointVolume), ""));
|
||||
}
|
||||
else {
|
||||
values->push_back(G4AttValue("PostVPath", "None", ""));
|
||||
}
|
||||
|
||||
std::ostringstream oss1;
|
||||
oss1 << fPreStepPointWeight;
|
||||
values->push_back(G4AttValue("PreW", oss1.str(), ""));
|
||||
|
||||
std::ostringstream oss2;
|
||||
oss2 << fPostStepPointWeight;
|
||||
values->push_back(G4AttValue("PostW", oss2.str(), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedSmoothTrajectory class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedSmoothTrajectory.hh"
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ClonedSmoothTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4ClonedSmoothTrajectory>*& aClonedSmoothTrajectoryAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedSmoothTrajectory>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedSmoothTrajectory::G4ClonedSmoothTrajectory(const G4SmoothTrajectory& 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 = (G4ClonedSmoothTrajectoryPoint*)i;
|
||||
positionRecord->push_back(new G4ClonedSmoothTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4ClonedSmoothTrajectory::~G4ClonedSmoothTrajectory()
|
||||
{
|
||||
if (positionRecord != nullptr) {
|
||||
for (auto& i : *positionRecord) {
|
||||
delete i;
|
||||
}
|
||||
positionRecord->clear();
|
||||
delete positionRecord;
|
||||
}
|
||||
}
|
||||
|
||||
void G4ClonedSmoothTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
//
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void G4ClonedSmoothTrajectory::DrawTrajectory() const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
//
|
||||
G4VTrajectory::DrawTrajectory();
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedSmoothTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4ClonedSmoothTrajectory", isNew);
|
||||
if (isNew) {
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP, "No. of points", "Physics", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedSmoothTrajectory::CreateAttValues() const
|
||||
{
|
||||
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()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
void G4ClonedSmoothTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
positionRecord->push_back(new G4ClonedSmoothTrajectoryPoint(
|
||||
aStep->GetPostStepPoint()->GetPosition(), aStep->GetPointerToVectorOfAuxiliaryPoints()));
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4ClonedSmoothTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
void G4ClonedSmoothTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
auto seco = (G4ClonedSmoothTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
|
||||
// initial point of the second trajectory should not be merged
|
||||
//
|
||||
for (G4int i = 1; i < ent; ++i) {
|
||||
positionRecord->push_back((*(seco->positionRecord))[i]);
|
||||
}
|
||||
delete (*seco->positionRecord)[0];
|
||||
seco->positionRecord->clear();
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedSmoothTrajectoryPoint class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedSmoothTrajectoryPoint.hh"
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4ClonedSmoothTrajectoryPoint>*& aClonedSmoothTrajectoryPointAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedSmoothTrajectoryPoint>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedSmoothTrajectoryPoint::G4ClonedSmoothTrajectoryPoint(
|
||||
G4ThreeVector pos, std::vector<G4ThreeVector>* auxiliaryPoints)
|
||||
: fPosition(pos), fAuxiliaryPointVector(auxiliaryPoints)
|
||||
{}
|
||||
|
||||
G4ClonedSmoothTrajectoryPoint::G4ClonedSmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right)
|
||||
: fPosition(right.fPosition), fAuxiliaryPointVector(right.fAuxiliaryPointVector)
|
||||
{}
|
||||
|
||||
G4ClonedSmoothTrajectoryPoint::~G4ClonedSmoothTrajectoryPoint() { delete fAuxiliaryPointVector; }
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedSmoothTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store =
|
||||
G4AttDefStore::GetInstance("G4ClonedSmoothTrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Step Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
G4String Aux("Aux");
|
||||
(*store)[Aux] =
|
||||
G4AttDef(Aux, "Auxiliary Point Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedSmoothTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
if (fAuxiliaryPointVector != nullptr) {
|
||||
for (const auto& iAux : *fAuxiliaryPointVector) {
|
||||
values->push_back(G4AttValue("Aux", G4BestUnit(iAux, "Length"), ""));
|
||||
}
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedTrajectory class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedTrajectory.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ClonedTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4ClonedTrajectory>*& aClonedTrajectoryAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedTrajectory>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedTrajectory::G4ClonedTrajectory(const G4Trajectory& right)
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialKineticEnergy = right.initialKineticEnergy;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new G4ClonedTrajectoryPointContainer();
|
||||
|
||||
for (auto& i : *right.positionRecord) {
|
||||
auto rightPoint = (G4ClonedTrajectoryPoint*)i;
|
||||
positionRecord->push_back(new G4ClonedTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4ClonedTrajectory::~G4ClonedTrajectory()
|
||||
{
|
||||
if (positionRecord != nullptr) {
|
||||
for (auto& i : *positionRecord) {
|
||||
delete i;
|
||||
}
|
||||
positionRecord->clear();
|
||||
delete positionRecord;
|
||||
}
|
||||
}
|
||||
|
||||
void G4ClonedTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void G4ClonedTrajectory::DrawTrajectory() const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::DrawTrajectory();
|
||||
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4Trajectory", isNew);
|
||||
if (isNew) {
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP, "No. of points", "Physics", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedTrajectory::CreateAttValues() const
|
||||
{
|
||||
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()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
void G4ClonedTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
positionRecord->push_back(new G4ClonedTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()));
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4ClonedTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
void G4ClonedTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
auto seco = (G4ClonedTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
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];
|
||||
seco->positionRecord->clear();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedTrajectoryPoint class implementation
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ClonedTrajectoryPoint.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4ClonedTrajectoryPoint>*& aClonedTrajectoryPointAllocator()
|
||||
{
|
||||
static G4Allocator<G4ClonedTrajectoryPoint>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ClonedTrajectoryPoint::G4ClonedTrajectoryPoint(const G4TrajectoryPoint& right) : fPosition(right.fPosition) {}
|
||||
|
||||
G4ClonedTrajectoryPoint::~G4ClonedTrajectoryPoint() = default;
|
||||
|
||||
const std::map<G4String, G4AttDef>* G4ClonedTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4TrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4ClonedTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
@@ -62,7 +63,7 @@ G4Allocator<G4RichTrajectoryPoint>*& aRichTrajectoryPointAllocator()
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint() = default;
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack)
|
||||
: G4TrajectoryPoint(aTrack->GetPosition()),
|
||||
: fPosition(aTrack->GetPosition()),
|
||||
fPreStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fPostStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fpPreStepPointVolume(aTrack->GetTouchableHandle()),
|
||||
@@ -72,7 +73,7 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack)
|
||||
{}
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep)
|
||||
: G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()),
|
||||
: fPosition(aStep->GetPostStepPoint()->GetPosition()),
|
||||
fpAuxiliaryPointVector(aStep->GetPointerToVectorOfAuxiliaryPoints()),
|
||||
fTotEDep(aStep->GetTotalEnergyDeposit())
|
||||
{
|
||||
@@ -108,11 +109,10 @@ const std::map<G4String, G4AttDef>* G4RichTrajectoryPoint::GetAttDefs() const
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
// Copy base class att defs...
|
||||
*store = *(G4TrajectoryPoint::GetAttDefs());
|
||||
|
||||
G4String ID;
|
||||
|
||||
ID = "Pos";
|
||||
(*store)[ID] = G4AttDef(ID, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
ID = "Aux";
|
||||
(*store)[ID] =
|
||||
G4AttDef(ID, "Auxiliary Point Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
@@ -194,7 +194,12 @@ std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
|
||||
std::vector<G4AttValue>* values = G4TrajectoryPoint::CreateAttValues();
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
if (fpAuxiliaryPointVector != nullptr) {
|
||||
for (const auto& iAux : *fpAuxiliaryPointVector) {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4ClonedSmoothTrajectory.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
@@ -41,6 +42,11 @@
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace {
|
||||
G4Mutex CloneSmoothTrajectoryMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
@@ -92,6 +98,13 @@ G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory& right)
|
||||
}
|
||||
}
|
||||
|
||||
G4VTrajectory* G4SmoothTrajectory::CloneForMaster() const
|
||||
{
|
||||
G4AutoLock lock(&CloneSmoothTrajectoryMutex);
|
||||
auto* cloned = new G4ClonedSmoothTrajectory(*this);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::~G4SmoothTrajectory()
|
||||
{
|
||||
if (positionRecord != nullptr) {
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
|
||||
#include "G4TrackingManager.hh"
|
||||
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4RichTrajectory.hh"
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -189,3 +189,11 @@ void G4TrackingManager::TrackBanner()
|
||||
<< "**************************************************" << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
void G4TrackingManager::SetStoreTrajectory(G4int value)
|
||||
//////////////////////////////////////
|
||||
{
|
||||
StoreTrajectory = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,13 @@
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "G4ClonedTrajectory.hh"
|
||||
#include "G4ClonedTrajectoryPoint.hh"
|
||||
#include "G4ClonedRichTrajectory.hh"
|
||||
#include "G4ClonedRichTrajectoryPoint.hh"
|
||||
#include "G4ClonedSmoothTrajectory.hh"
|
||||
#include "G4ClonedSmoothTrajectoryPoint.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -142,7 +149,43 @@ void G4TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
->SetTrajectoryFilter(nullptr);
|
||||
}
|
||||
trackingManager->SetStoreTrajectory(trajType);
|
||||
|
||||
// Make sure cloning works for sub-event parallel mode
|
||||
if(G4Threading::IsMasterThread() && trajType>0) {
|
||||
static G4bool traj_1 = false, traj_2 = false, traj_3 = false;
|
||||
G4VTrajectory* traj = nullptr;
|
||||
G4VTrajectoryPoint* trajp = nullptr;
|
||||
switch (trajType) {
|
||||
case 1:
|
||||
if(!traj_1) {
|
||||
traj = new G4ClonedTrajectory();
|
||||
trajp = new G4ClonedTrajectoryPoint();
|
||||
traj_1 = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(!traj_2) {
|
||||
traj = new G4ClonedSmoothTrajectory();
|
||||
trajp = new G4ClonedSmoothTrajectoryPoint();
|
||||
traj_2 = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
if(!traj_3) {
|
||||
traj = new G4ClonedRichTrajectory();
|
||||
trajp = new G4ClonedRichTrajectoryPoint();
|
||||
traj_3 = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(traj!=nullptr) delete traj;
|
||||
if(trajp!=nullptr) delete trajp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -39,8 +39,14 @@
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4ClonedTrajectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace {
|
||||
G4Mutex CloneTrajectoryMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
@@ -86,6 +92,13 @@ G4Trajectory::G4Trajectory(G4Trajectory& right)
|
||||
}
|
||||
}
|
||||
|
||||
G4VTrajectory* G4Trajectory::CloneForMaster() const
|
||||
{
|
||||
G4AutoLock lock(&CloneTrajectoryMutex);
|
||||
auto* cloned = new G4ClonedTrajectory(*this);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
G4Trajectory::~G4Trajectory()
|
||||
{
|
||||
if (positionRecord != nullptr) {
|
||||
|
||||
@@ -49,6 +49,12 @@ G4Allocator<G4TrajectoryPoint>*& aTrajectoryPointAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4Allocator<G4TrajectoryPoint>*& masterTrajectoryPointAllocator()
|
||||
{
|
||||
static G4Allocator<G4TrajectoryPoint>* master_instance = nullptr;
|
||||
return master_instance;
|
||||
}
|
||||
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(G4ThreeVector pos) { fPosition = pos; }
|
||||
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(const G4TrajectoryPoint& right) : fPosition(right.fPosition) {}
|
||||
|
||||
@@ -47,6 +47,15 @@
|
||||
|
||||
G4bool G4VTrajectory::operator==(const G4VTrajectory& right) const { return (this == &right); }
|
||||
|
||||
G4VTrajectory* G4VTrajectory::CloneForMaster() const
|
||||
{
|
||||
// Base-class method must not be invoked.
|
||||
// Each concrete class should implement its own method.
|
||||
G4Exception("G4VTrajectory::CloneForMaster()","traj0100",FatalException,
|
||||
"CloneForMaster() of G4VTrajectory base-class is invoked. Each concrete class should implement its own method.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void G4VTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Makes use of attribute values implemented in the concrete class.
|
||||
|
||||
Reference in New Issue
Block a user