Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
+71 -113
View File
@@ -37,18 +37,19 @@
// --------------------------------------------------------------------
#include "G4RichTrajectory.hh"
#include "G4RichTrajectoryPoint.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4PhysicsModelCatalog.hh"
#include "G4RichTrajectoryPoint.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4VProcess.hh"
#include "G4PhysicsModelCatalog.hh"
//#define G4ATTDEBUG
// #define G4ATTDEBUG
#ifdef G4ATTDEBUG
#include "G4AttCheck.hh"
# include "G4AttCheck.hh"
#endif
#include <sstream>
@@ -59,10 +60,6 @@ G4Allocator<G4RichTrajectory>*& aRichTrajectoryAllocator()
return _instance;
}
G4RichTrajectory::G4RichTrajectory()
{
}
G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
: G4Trajectory(aTrack) // Note: this initialises the base class data
// members and, unfortunately but never mind,
@@ -92,8 +89,7 @@ G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aTrack));
}
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right)
: G4Trajectory(right)
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right) : G4Trajectory(right)
{
fpInitialVolume = right.fpInitialVolume;
fpInitialNextVolume = right.fpInitialNextVolume;
@@ -104,21 +100,17 @@ G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right)
fpEndingProcess = right.fpEndingProcess;
fFinalKineticEnergy = right.fFinalKineticEnergy;
fpRichPointsContainer = new RichTrajectoryPointsContainer;
for(std::size_t i=0; i<right.fpRichPointsContainer->size(); ++i)
{
G4RichTrajectoryPoint* rightPoint =
(G4RichTrajectoryPoint*)((*(right.fpRichPointsContainer))[i]);
for (auto& i : *right.fpRichPointsContainer) {
auto rightPoint = (G4RichTrajectoryPoint*)i;
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(*rightPoint));
}
}
G4RichTrajectory::~G4RichTrajectory()
{
if (fpRichPointsContainer)
{
for(std::size_t i=0; i<fpRichPointsContainer->size(); ++i)
{
delete (*fpRichPointsContainer)[i];
if (fpRichPointsContainer != nullptr) {
for (auto& i : *fpRichPointsContainer) {
delete i;
}
fpRichPointsContainer->clear();
delete fpRichPointsContainer;
@@ -134,24 +126,22 @@ void G4RichTrajectory::AppendStep(const G4Step* aStep)
//
const G4Track* track = aStep->GetTrack();
const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
if (track->GetCurrentStepNumber() > 0)
{
if (track->GetCurrentStepNumber() > 0) {
fpFinalVolume = track->GetTouchableHandle();
fpFinalNextVolume = track->GetNextTouchableHandle();
fpEndingProcess = postStepPoint->GetProcessDefinedStep();
fFinalKineticEnergy = aStep->GetPreStepPoint()->GetKineticEnergy()
- aStep->GetTotalEnergyDeposit();
fFinalKineticEnergy =
aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetTotalEnergyDeposit();
}
}
void G4RichTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
{
if(secondTrajectory == nullptr) return;
if (secondTrajectory == nullptr) return;
G4RichTrajectory* seco = (G4RichTrajectory*)secondTrajectory;
auto seco = (G4RichTrajectory*)secondTrajectory;
G4int ent = seco->GetPointEntries();
for(G4int i=1; i<ent; ++i)
{
for (G4int i = 1; i < ent; ++i) {
// initial point of the second trajectory should not be merged
//
fpRichPointsContainer->push_back((*(seco->fpRichPointsContainer))[i]);
@@ -178,13 +168,11 @@ void G4RichTrajectory::DrawTrajectory() const
// ... or override with your own code here.
}
const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
const std::map<G4String, G4AttDef>* G4RichTrajectory::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4RichTrajectory",isNew);
if (isNew)
{
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectory", isNew);
if (isNew) {
// Get att defs from base class...
//
*store = *(G4Trajectory::GetAttDefs());
@@ -192,48 +180,37 @@ const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
G4String ID;
ID = "IVPath";
(*store)[ID] = G4AttDef(ID,"Initial Volume Path",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Initial Volume Path", "Physics", "", "G4String");
ID = "INVPath";
(*store)[ID] = G4AttDef(ID,"Initial Next Volume Path",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Initial Next Volume Path", "Physics", "", "G4String");
ID = "CPN";
(*store)[ID] = G4AttDef(ID,"Creator Process Name",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Creator Process Name", "Physics", "", "G4String");
ID = "CPTN";
(*store)[ID] = G4AttDef(ID,"Creator Process Type Name",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Creator Process Type Name", "Physics", "", "G4String");
ID = "CMID";
(*store)[ID] = G4AttDef(ID,"Creator Model ID",
"Physics","","G4int");
(*store)[ID] = G4AttDef(ID, "Creator Model ID", "Physics", "", "G4int");
ID = "CMN";
(*store)[ID] = G4AttDef(ID,"Creator Model Name",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Creator Model Name", "Physics", "", "G4String");
ID = "FVPath";
(*store)[ID] = G4AttDef(ID,"Final Volume Path",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Final Volume Path", "Physics", "", "G4String");
ID = "FNVPath";
(*store)[ID] = G4AttDef(ID,"Final Next Volume Path",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Final Next Volume Path", "Physics", "", "G4String");
ID = "EPN";
(*store)[ID] = G4AttDef(ID,"Ending Process Name",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Ending Process Name", "Physics", "", "G4String");
ID = "EPTN";
(*store)[ID] = G4AttDef(ID,"Ending Process Type Name",
"Physics","","G4String");
(*store)[ID] = G4AttDef(ID, "Ending Process Type Name", "Physics", "", "G4String");
ID = "FKE";
(*store)[ID] = G4AttDef(ID,"Final kinetic energy",
"Physics","G4BestUnit","G4double");
(*store)[ID] = G4AttDef(ID, "Final kinetic energy", "Physics", "G4BestUnit", "G4double");
}
return store;
@@ -243,10 +220,8 @@ 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);
for (G4int i = depth; i >= 0; --i) {
oss << th->GetVolume(i)->GetName() << ':' << th->GetCopyNumber(i);
if (i != 0) oss << '/';
}
return oss.str();
@@ -257,80 +232,63 @@ std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
// Create base class att values...
std::vector<G4AttValue>* values = G4Trajectory::CreateAttValues();
if (fpInitialVolume && fpInitialVolume->GetVolume())
{
values->push_back(G4AttValue("IVPath",Path(fpInitialVolume),""));
if (fpInitialVolume && (fpInitialVolume->GetVolume() != nullptr)) {
values->push_back(G4AttValue("IVPath", Path(fpInitialVolume), ""));
}
else
{
values->push_back(G4AttValue("IVPath","None",""));
else {
values->push_back(G4AttValue("IVPath", "None", ""));
}
if (fpInitialNextVolume && fpInitialNextVolume->GetVolume())
{
values->push_back(G4AttValue("INVPath",Path(fpInitialNextVolume),""));
if (fpInitialNextVolume && (fpInitialNextVolume->GetVolume() != nullptr)) {
values->push_back(G4AttValue("INVPath", Path(fpInitialNextVolume), ""));
}
else
{
values->push_back(G4AttValue("INVPath","None",""));
else {
values->push_back(G4AttValue("INVPath", "None", ""));
}
if (fpCreatorProcess != nullptr)
{
values->push_back
(G4AttValue("CPN",fpCreatorProcess->GetProcessName(),""));
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,""));
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",""));
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())
{
values->push_back(G4AttValue("FVPath",Path(fpFinalVolume),""));
if (fpFinalVolume && (fpFinalVolume->GetVolume() != nullptr)) {
values->push_back(G4AttValue("FVPath", Path(fpFinalVolume), ""));
}
else
{
values->push_back(G4AttValue("FVPath","None",""));
else {
values->push_back(G4AttValue("FVPath", "None", ""));
}
if (fpFinalNextVolume && fpFinalNextVolume->GetVolume())
{
values->push_back(G4AttValue("FNVPath",Path(fpFinalNextVolume),""));
if (fpFinalNextVolume && (fpFinalNextVolume->GetVolume() != nullptr)) {
values->push_back(G4AttValue("FNVPath", Path(fpFinalNextVolume), ""));
}
else
{
values->push_back(G4AttValue("FNVPath","None",""));
else {
values->push_back(G4AttValue("FNVPath", "None", ""));
}
if (fpEndingProcess != nullptr)
{
values->push_back(G4AttValue("EPN",fpEndingProcess->GetProcessName(),""));
if (fpEndingProcess != nullptr) {
values->push_back(G4AttValue("EPN", fpEndingProcess->GetProcessName(), ""));
G4ProcessType type = fpEndingProcess->GetProcessType();
values->push_back(G4AttValue("EPTN",G4VProcess::GetProcessTypeName(type),""));
values->push_back(G4AttValue("EPTN", G4VProcess::GetProcessTypeName(type), ""));
}
else
{
values->push_back(G4AttValue("EPN","None",""));
values->push_back(G4AttValue("EPTN","None",""));
else {
values->push_back(G4AttValue("EPN", "None", ""));
values->push_back(G4AttValue("EPTN", "None", ""));
}
values->push_back
(G4AttValue("FKE",G4BestUnit(fFinalKineticEnergy,"Energy"),""));
values->push_back(G4AttValue("FKE", G4BestUnit(fFinalKineticEnergy, "Energy"), ""));
#ifdef G4ATTDEBUG
G4cout << G4AttCheck(values,GetAttDefs());
G4cout << G4AttCheck(values, GetAttDefs());
#endif
return values;