Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacquet lv work #582

Draft
wants to merge 118 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
e1f6234
Creation of a pseudo-transportation actor for photons
majacquet Feb 19, 2024
7758dbd
Correction of a bug linked to the russian roulette of particle weights
majacquet Feb 21, 2024
ad585c3
Merge branch 'master' into VRM_jacquet_2
majacquet Feb 21, 2024
ad4544b
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Feb 21, 2024
07779d6
Modification of users command line to use the pseudo transporation ac…
majacquet Feb 26, 2024
f065c7c
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Feb 26, 2024
af172fa
Add of a test to verify the correctness of the russian roulette and a…
majacquet Feb 27, 2024
be2ed8e
resolve conflicts
majacquet Feb 27, 2024
bbd1dbf
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Feb 27, 2024
d0ff621
Improvement of the pseudo-transportation. Each process creating gamma…
majacquet Mar 18, 2024
dd00658
Development of an actor which kill a track if this one passes through…
majacquet Mar 19, 2024
1045e37
Development of an actor which split particles at the entrance and/or …
majacquet Mar 20, 2024
1777b08
Merge branch 'master' into simple_geometrical_splitting_actor
majacquet Mar 20, 2024
71e276d
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Mar 20, 2024
d9126cf
Merge branch 'master' into kill_actor_particle_condition
majacquet Mar 20, 2024
01041fa
Update of the test name
majacquet Mar 20, 2024
1483f92
Update of the test name
majacquet Mar 20, 2024
f135ad4
Merge with remote branch
majacquet Mar 20, 2024
93786e4
Merge branch 'kill_actor_particle_condition' into VRM_jacquet_2
majacquet Mar 21, 2024
2111366
Merge branch 'simple_geometrical_splitting_actor' into VRM_jacquet_2
majacquet Mar 21, 2024
32ae380
work update
majacquet Apr 19, 2024
8abfb78
Update of work
majacquet Apr 19, 2024
77b01d3
Merge branch 'master' into VRM_jacquet_2
majacquet Apr 19, 2024
ecf35b3
correction of a bug after the merge
majacquet Apr 20, 2024
8921335
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Apr 20, 2024
9447e82
Actor killing a particle at the volume exit if interaction
majacquet May 14, 2024
c1ebb72
Add a test to verify the killing actor
majacquet May 14, 2024
77d16f5
Actor creation which split an exiting particle at its last vertex
majacquet May 24, 2024
f81bbbb
improvement of the method, adding a unbiased splitting method for the…
majacquet Jun 13, 2024
d5eb52c
Add angular RR for all processes + Bug corrections on postponed pair …
majacquet Jun 18, 2024
098094f
Add of a pecularity to handle exiting positron
majacquet Jun 19, 2024
244e6d9
change the way to split, the old one being biased, work in progress
majacquet Jun 25, 2024
c71c7d6
Correction of Russian roulette bug
majacquet Jun 25, 2024
ca0de09
Add russian roulette for annihilation photons
majacquet Jun 25, 2024
101d021
supression of rayleigh biasing
majacquet Jun 25, 2024
f3a0575
Merge branch 'VRM_jacquet_2' of github.com:OpenGATE/opengate into VRM…
majacquet Jun 25, 2024
e6c0b5b
Modification of Rayleigh behaviour
majacquet Jun 27, 2024
5503679
Correction of generation bug implying brem and pair production
majacquet Jul 2, 2024
de79965
Correction of a memory leak implying secondary particles handling
majacquet Jul 5, 2024
c208c4a
Merge remote-tracking branch 'remotes/origin/access_to_source_manager…
majacquet Sep 10, 2024
1f51419
Refactoring of last vertex splitting actor, combining a data tree str…
majacquet Sep 25, 2024
957103f
Add a particle kill according to its direction relative to a specifie…
majacquet Sep 27, 2024
b464966
Merge branch 'kill_actor_interacting_particles' into last_vertex_inte…
majacquet Sep 30, 2024
06eae5b
bug correction according exiting particle coming back to the biased v…
majacquet Oct 3, 2024
6174555
Modif of container structure to optimize time simulation
majacquet Oct 15, 2024
ce16241
Bug correction and time optimization of splitting process
majacquet Oct 17, 2024
fb57f71
speed up of Russian roulette calculation
majacquet Oct 17, 2024
102b624
Dev of a batching method to create splitted tracks
majacquet Oct 23, 2024
2dfaea5
bug correction
majacquet Oct 29, 2024
21f148a
Add of a security break in case of infinite loop
majacquet Nov 4, 2024
1ae3493
Add C++ code of the kill actor
majacquet Nov 8, 2024
051d05a
modify the python code to retrieve volumes_tree
majacquet Nov 8, 2024
03e7c40
Add of a test to verify if killed or not
majacquet Nov 8, 2024
00abcd5
test name modification
majacquet Nov 8, 2024
33b7a48
Add a short header at the beginning of the actor
majacquet Nov 8, 2024
2115b1f
actor adaptation for particle generated within the actorified volume
majacquet Nov 8, 2024
220932b
Add of an output actor retrieving the number of particles killed
majacquet Nov 12, 2024
ca6dd87
Merge branch 'master' into new_kill_non_interacting_particle
majacquet Nov 12, 2024
53fc393
Removal of conditionnal kill actors
majacquet Nov 12, 2024
003e94b
Merge branch 'master' into last_vertex_interaction_splitting
majacquet Nov 12, 2024
b9600a5
files deletion
majacquet Nov 13, 2024
4e1d204
Code adaptation for gate10.09
majacquet Nov 13, 2024
326d94b
Test creation for last vertex splitting method
majacquet Nov 13, 2024
80fdf2c
Merge branch 'master' into last_vertex_interaction_splitting
majacquet Nov 13, 2024
7be2414
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 13, 2024
79184da
Merge with last_vertex_spliting_actor
majacquet Nov 13, 2024
a80cb77
Merge branch 'new_kill_non_interacting_particle' into jacquet_LV_work
majacquet Nov 13, 2024
0294cf0
Add err dose map to TLE actor
majacquet Nov 13, 2024
2be6bf4
Merge branch 'master' into jacquet_LV_work
majacquet Nov 13, 2024
915f8b0
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 13, 2024
d0c5a72
TLE correction
majacquet Nov 17, 2024
12eaa31
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 17, 2024
954027d
Merge branch 'master' into last_vertex_interaction_splitting
majacquet Nov 19, 2024
ed907cd
actor adaptation regarding latest modif
majacquet Nov 19, 2024
f57492f
old files deletion
majacquet Nov 19, 2024
20fa7cb
source refactoring according to latest opengate release
majacquet Nov 19, 2024
52a8a57
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 19, 2024
c0c0fb2
Merge branch 'master' into last_vertex_interaction_splitting
majacquet Nov 19, 2024
19b58df
Merge branch 'last_vertex_interaction_splitting' into jacquet_LV_work
majacquet Nov 19, 2024
210647a
file deletion
majacquet Nov 19, 2024
46045ec
Merge branch 'fix_tle' into jacquet_LV_work
majacquet Nov 19, 2024
7778df8
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Nov 19, 2024
922ea82
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 19, 2024
7dbeacc
Merge branch 'new_kill_interacting_particle' into jacquet_LV_work
majacquet Nov 25, 2024
0d62fd4
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Nov 25, 2024
4edbfd1
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 25, 2024
d1c0124
Merge branch 'master' into last_vertex_interaction_splitting
majacquet Nov 25, 2024
8b36ea6
Add a user parameter to limit the maximum number of batch to generate
majacquet Nov 25, 2024
97e7198
Merge branch 'last_vertex_interaction_splitting' into jacquet_LV_work
majacquet Nov 25, 2024
fd92241
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Nov 25, 2024
a64a11e
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Nov 25, 2024
9ed46c6
modif leaf design
majacquet Nov 28, 2024
84a074f
Merge branch 'master' into jacquet_LV_work
majacquet Dec 6, 2024
839a185
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Dec 6, 2024
adefc8e
Update of LV according to exitong and non interacting particles
majacquet Dec 11, 2024
e8bbd58
actor killing particle according its name
majacquet Dec 12, 2024
c350f9c
update miscactors
majacquet Dec 12, 2024
590bbcd
code update
majacquet Dec 12, 2024
7725145
Merge branch 'kill_actor_according_particle_name' into jacquet_LV_work
majacquet Dec 12, 2024
a8b4964
condition added to not try split fluo gamma
majacquet Dec 12, 2024
839056d
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Dec 12, 2024
59d539e
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Dec 12, 2024
12e35a0
correction on the phot exclusion mechanism
majacquet Dec 12, 2024
66c062f
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Dec 12, 2024
56b0250
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Dec 12, 2024
9468792
slight modif of batch method
majacquet Dec 17, 2024
c65a8fb
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Dec 17, 2024
82ea325
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Dec 17, 2024
7368b8c
Merge branch 'master' into jacquet_LV_work
majacquet Dec 20, 2024
18fdac7
created bug with G4 new version correction
majacquet Dec 20, 2024
399252e
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Dec 20, 2024
64d2fd4
subsequent header modif of the container class
majacquet Jan 6, 2025
0438b63
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Jan 6, 2025
878d118
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Jan 6, 2025
d54ea85
emory leak correction
majacquet Jan 7, 2025
e3968bb
Merge branch 'jacquet_LV_work' of github.com:OpenGATE/opengate into j…
majacquet Jan 7, 2025
2fd5ba8
Merge branch 'master' into jacquet_LV_work
majacquet Jan 7, 2025
c9401ed
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/opengate_core/opengate_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ void init_GateKillActor(py::module &);

void init_GateKillAccordingProcessesActor(py::module &);

void init_GateKillNonInteractingParticleActor(py::module &);

void init_GateKillAccordingParticleNameActor(py::module &);

void init_GateAttenuationImageActor(py::module &);

void init_itk_image(py::module &);
Expand All @@ -340,6 +344,8 @@ void init_GatePhaseSpaceActor(py::module &);

void init_GateOptrComptSplittingActor(py::module &m);

void init_GateLastVertexInteractionSplittingActor(py::module &m);

void init_GateBOptrBremSplittingActor(py::module &m);

void init_GateOptrFreeFlightActor(py::module &m);
Expand Down Expand Up @@ -378,6 +384,8 @@ void init_GateVolumeDepthID(py::module &m);
// Gate source
void init_GateVSource(py::module &);

void init_GateLastVertexSource(py::module &);

void init_GateSourceManager(py::module &);

void init_GateGenericSource(py::module &);
Expand Down Expand Up @@ -569,6 +577,7 @@ PYBIND11_MODULE(opengate_core, m) {
init_GateImageNestedParameterisation(m);
init_GateRepeatParameterisation(m);
init_GateVSource(m);
init_GateLastVertexSource(m);
init_GateSourceManager(m);
init_GateGenericSource(m);
init_GateTreatmentPlanPBSource(m);
Expand All @@ -592,6 +601,7 @@ PYBIND11_MODULE(opengate_core, m) {
init_GatePhaseSpaceActor(m);
init_GateBOptrBremSplittingActor(m);
init_GateOptrComptSplittingActor(m);
init_GateLastVertexInteractionSplittingActor(m);
init_GateOptrFreeFlightActor(m);
init_GateHitsCollectionActor(m);
init_GateVDigitizerWithOutputActor(m);
Expand All @@ -606,6 +616,8 @@ PYBIND11_MODULE(opengate_core, m) {
init_GateARFTrainingDatasetActor(m);
init_GateKillActor(m);
init_GateKillAccordingProcessesActor(m);
init_GateKillNonInteractingParticleActor(m);
init_GateKillAccordingParticleNameActor(m);
init_GateAttenuationImageActor(m);
init_GateDigiAttributeManager(m);
init_GateVDigiAttribute(m);
Expand Down
1 change: 0 additions & 1 deletion core/opengate_core/opengate_lib/GateGenericSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ double GateGenericSource::PrepareNextTime(double current_simulation_time) {
return fStartTime;
if (ll.fEffectiveEventTime >= fEndTime)
return -1;

// get next time according to current fActivity
double next_time = CalcNextTime(ll.fEffectiveEventTime);
if (next_time >= fEndTime)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
------------------------------------ -------------- */

#include "GateKillAccordingParticleNameActor.h"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4TransportationManager.hh"
#include "G4ios.hh"
#include "GateHelpers.h"
#include "GateHelpersDict.h"

G4Mutex SetNbKillAcordingParticleMutex = G4MUTEX_INITIALIZER;

GateKillAccordingParticleNameActor::GateKillAccordingParticleNameActor(
py::dict &user_info)
: GateVActor(user_info, false) {}

void GateKillAccordingParticleNameActor::InitializeUserInfo(
py::dict &user_info) {
GateVActor::InitializeUserInfo(user_info);
fParticlesNameToKill = DictGetVecStr(user_info, "particles_name_to_kill");
}

void GateKillAccordingParticleNameActor::PreUserTrackingAction(
const G4Track *track) {
auto &l = fThreadLocalData.Get();
l.fIsAParticleToKill = false;

G4String particleName = track->GetParticleDefinition()->GetParticleName();
if (std::find(fParticlesNameToKill.begin(), fParticlesNameToKill.end(),
particleName) != fParticlesNameToKill.end()) {
l.fIsAParticleToKill = true;
}
}

void GateKillAccordingParticleNameActor::SteppingAction(G4Step *step) {

if (step->GetPostStepPoint()->GetStepStatus() == 1) {
G4String logicalVolumeNamePostStep = step->GetPostStepPoint()
->GetPhysicalVolume()
->GetLogicalVolume()
->GetName();
if (std::find(fListOfVolumeAncestor.begin(), fListOfVolumeAncestor.end(),
logicalVolumeNamePostStep) != fListOfVolumeAncestor.end()) {
auto &l = fThreadLocalData.Get();
if (l.fIsAParticleToKill) {
step->GetTrack()->SetTrackStatus(fStopAndKill);
G4AutoLock mutex(&SetNbKillAcordingParticleMutex);
fNbOfKilledParticles++;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#ifndef GateKillAccordingParticleNameActor_h
#define GateKillAccordingParticleNameActor_h

#include "G4Cache.hh"
#include "GateVActor.h"
#include <pybind11/stl.h>

namespace py = pybind11;

class GateKillAccordingParticleNameActor : public GateVActor {

public:
// Constructor
GateKillAccordingParticleNameActor(py::dict &user_info);
struct threadLocalT {
G4bool fIsAParticleToKill = false;
};
G4Cache<threadLocalT> fThreadLocalData;
std::vector<std::string> fParticlesNameToKill;
std::vector<G4String> fListOfVolumeAncestor;

// Main function called every step in attached volume
void PreUserTrackingAction(const G4Track *) override;
void SteppingAction(G4Step *) override;
void InitializeUserInfo(py::dict &user_info) override;

inline long GetNumberOfKilledParticles() { return fNbOfKilledParticles; }

private:
long fNbOfKilledParticles = 0;
};

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
------------------------------------ -------------- */

#include "GateKillNonInteractingParticleActor.h"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4TransportationManager.hh"
#include "G4ios.hh"
#include "GateHelpers.h"
#include "GateHelpersDict.h"

GateKillNonInteractingParticleActor::GateKillNonInteractingParticleActor(
py::dict &user_info)
: GateVActor(user_info, false) {}

void GateKillNonInteractingParticleActor::StartSimulationAction() {
fNbOfKilledParticles = 0;
}

void GateKillNonInteractingParticleActor::PreUserTrackingAction(
const G4Track *track) {
fIsFirstStep = true;
fKineticEnergyAtTheEntrance = 0;
ftrackIDAtTheEntrance = 0;
fPassedByTheMotherVolume = false;
}

void GateKillNonInteractingParticleActor::SteppingAction(G4Step *step) {
G4Navigator *navigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();

G4String logNameMotherVolume = G4LogicalVolumeStore::GetInstance()
->GetVolume(fAttachedToVolumeName)
->GetName();
G4String physicalVolumeNamePreStep = "None";
if (step->GetPreStepPoint()->GetPhysicalVolume() != 0)
physicalVolumeNamePreStep =
step->GetPreStepPoint()->GetPhysicalVolume()->GetName();
// if (((step->GetTrack()->GetLogicalVolumeAtVertex()->GetName() !=
// logNameMotherVolume) && (fIsFirstStep)) || ((fIsFirstStep) &&
// (step->GetTrack()->GetParentID() == 0))) {
if ((step->GetTrack()->GetLogicalVolumeAtVertex()->GetName() !=
logNameMotherVolume) &&
(fIsFirstStep)) {
// if ((fPassedByTheMotherVolume == false) &&
// (((step->GetPreStepPoint()->GetStepStatus() == 1) &&
// (physicalVolumeNamePreStep == fAttachedToVolumeName)) || ((fIsFirstStep)
// && (step->GetTrack()->GetParentID() == 0)))) {
if ((fPassedByTheMotherVolume == false) &&
(((step->GetPreStepPoint()->GetStepStatus() == 1) &&
(physicalVolumeNamePreStep == fAttachedToVolumeName)))) {
fPassedByTheMotherVolume = true;
fKineticEnergyAtTheEntrance = step->GetPreStepPoint()->GetKineticEnergy();
ftrackIDAtTheEntrance = step->GetTrack()->GetTrackID();
}
}

G4String logicalVolumeNamePostStep = step->GetPostStepPoint()
->GetPhysicalVolume()
->GetLogicalVolume()
->GetName();
if ((fPassedByTheMotherVolume) &&
(step->GetPostStepPoint()->GetStepStatus() == 1)) {
if (std::find(fListOfVolumeAncestor.begin(), fListOfVolumeAncestor.end(),
logicalVolumeNamePostStep) != fListOfVolumeAncestor.end()) {
if ((step->GetTrack()->GetTrackID() == ftrackIDAtTheEntrance) &&
(step->GetPostStepPoint()->GetKineticEnergy() ==
fKineticEnergyAtTheEntrance)) {
auto track = step->GetTrack();
track->SetTrackStatus(fStopAndKill);
fNbOfKilledParticles++;
}
}
}

fIsFirstStep = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#ifndef GateKillNonInteractingParticleActor_h
#define GateKillNonInteractingParticleActor_h

#include "G4Cache.hh"
#include "GateVActor.h"
#include <pybind11/stl.h>

namespace py = pybind11;

class GateKillNonInteractingParticleActor : public GateVActor {

public:
// Constructor
GateKillNonInteractingParticleActor(py::dict &user_info);

void StartSimulationAction() override;

// Main function called every step in attached volume
void SteppingAction(G4Step *) override;

void PreUserTrackingAction(const G4Track *) override;

std::vector<G4String> fParticlesTypeToKill;
G4bool fPassedByTheMotherVolume = false;
G4double fKineticEnergyAtTheEntrance = 0;
G4int ftrackIDAtTheEntrance = 0;
G4bool fIsFirstStep = true;
std::vector<std::string> fListOfVolumeAncestor;

long fNbOfKilledParticles{};
};

#endif
Loading
Loading