diff --git a/.github/pr-badge.yml b/.github/pr-badge.yml
index bd4445de..f2954f5f 100644
--- a/.github/pr-badge.yml
+++ b/.github/pr-badge.yml
@@ -13,5 +13,5 @@
message: "Ok: $additions"
color: "green"
when: "$additions < 100"
-- imageUrl: "https://github.com/rest-for-physics/restG4/actions/workflows/validation.yml/badge.svg?branch=$branchName"
+- imageUrl: "https://github.com/rest-for-physics/restG4/actions/workflows/frameworkValidation.yml/badge.svg?branch=$branchName"
url: "https://github.com/rest-for-physics/restG4/commits/$branchName"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa01fb33..513c95f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,6 +95,7 @@ endif ()
# Add the executable
add_executable(${PROJECT_NAME} main.cxx)
+
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARY})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples
diff --git a/examples/12.Generators/CryGenerator.rml b/examples/12.Generators/CryGenerator.rml
new file mode 100644
index 00000000..78c8ab05
--- /dev/null
+++ b/examples/12.Generators/CryGenerator.rml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PrimaryGeneratorAction.cxx b/src/PrimaryGeneratorAction.cxx
index ef498b67..fdec6fed 100644
--- a/src/PrimaryGeneratorAction.cxx
+++ b/src/PrimaryGeneratorAction.cxx
@@ -271,17 +271,25 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event) {
for (int i = 0; i < restG4Metadata->GetNumberOfSources(); i++) {
vector particles = restG4Metadata->GetParticleSource(i)->GetParticles();
+ // std::cout << "Source : " << i << std::endl;
for (const auto& p : particles) {
// ParticleDefinition should be always declared first (after position).
SetParticleDefinition(i, p);
SetParticleEnergyAndDirection(i, p);
+ // p.Print();
+
if (spatialGeneratorTypeEnum == SpatialGeneratorTypes::COSMIC) {
const auto position = ComputeCosmicPosition(fParticleGun.GetParticleMomentumDirection(),
fCosmicCircumscribedSphereRadius);
fParticleGun.SetParticlePosition(position);
}
+ if (spatialGeneratorTypeEnum == SpatialGeneratorTypes::SOURCE) {
+ G4ThreeVector position = {p.GetOrigin().X(), p.GetOrigin().Y(), p.GetOrigin().Z()};
+ fParticleGun.SetParticlePosition(position);
+ }
+
fParticleGun.GeneratePrimaryVertex(event);
}
}
@@ -304,6 +312,7 @@ G4ParticleDefinition* PrimaryGeneratorAction::SetParticleDefinition(Int_t partic
}
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
+ fParticle = particleTable->FindParticle(particleName);
if (!fParticle) {
fParticle = particleTable->FindParticle(particleName);
@@ -542,6 +551,8 @@ void PrimaryGeneratorAction::SetParticlePosition() {
}
} else if (spatialGeneratorTypeEnum == SpatialGeneratorTypes::COSMIC) {
// position will be defined after direction
+ } else if (spatialGeneratorTypeEnum == SpatialGeneratorTypes::SOURCE) {
+ // position will be defined by the source generator
} else {
G4cout << "WARNING! Generator type \"" << spatialGeneratorTypeName
<< "\" was not recognized. Launching particle "