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

Generic surface sampler #226

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8dd3883
implement generic surface sampling
tdixon97 Jan 9, 2025
8b0fa2e
[tests] add some basic tests for surface generator
tdixon97 Jan 11, 2025
2072046
[tests] add a more sophisticated test - but ... it fails for the unions
tdixon97 Jan 13, 2025
7d9151e
[docs] add new macro commands
tdixon97 Jan 13, 2025
de50cb9
[tests] try to fix the tests in CI
tdixon97 Jan 13, 2025
81c5d9b
some formatting fixes
tdixon97 Jan 13, 2025
443dbb3
[fix] adjust sampling sphere to have the correct center
tdixon97 Jan 13, 2025
3478a24
formatting
tdixon97 Jan 13, 2025
12bb478
[tests] fix the test of the bounding sphere
tdixon97 Jan 14, 2025
f459e8d
fix linking
tdixon97 Jan 14, 2025
577a391
style: pre-commit fixes
pre-commit-ci[bot] Jan 14, 2025
3e18805
[tests] a bit of reformatting
tdixon97 Jan 14, 2025
257ac05
add some more comments
tdixon97 Jan 14, 2025
b613494
[docs] adding docstrings for some functions
tdixon97 Jan 14, 2025
3eed479
[docs] add some docstrings for generic surface sampling objects
tdixon97 Jan 14, 2025
5a41343
fix merge from pre-commit changes
tdixon97 Jan 14, 2025
8cd6965
fix cmake
tdixon97 Jan 14, 2025
913bba7
more fixes to cmake
tdixon97 Jan 14, 2025
ce8b2d8
Update tests/confinement/CMakeLists.txt
tdixon97 Jan 14, 2025
a795ac3
[docs] adding more documentation
tdixon97 Jan 14, 2025
887eb72
Merge branch 'main' of github.com:tdixon97/remage into main
tdixon97 Jan 14, 2025
5678c73
[docs] small changes
tdixon97 Jan 14, 2025
2751f06
[tests] first attempt to organise all the test outputs into a LaTeX d…
tdixon97 Jan 15, 2025
7a2a1d7
update github actions to save the .tex
tdixon97 Jan 15, 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
10 changes: 10 additions & 0 deletions docs/rmg-commands.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions include/RMGVertexConfinement.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class RMGVertexConfinement : public RMGVVertexGenerator {
kGeometrical,
kUnset,
};


RMGVertexConfinement();

void BeginOfRunAction(const G4Run* run) override;
Expand Down Expand Up @@ -96,20 +98,30 @@ class RMGVertexConfinement : public RMGVVertexGenerator {
SampleableObject() = default;
SampleableObject(const SampleableObject&) = default;
SampleableObject(G4VPhysicalVolume* v, G4RotationMatrix r, G4ThreeVector t, G4VSolid* s,
bool cc = true);
bool ns = false, bool ss = false);
// NOTE: G4 volume/solid pointers should be fully owned by G4, avoid trying to delete them
~SampleableObject() = default;
[[nodiscard]] bool IsInside(const G4ThreeVector& vertex) const;
[[nodiscard]] bool Sample(G4ThreeVector& vertex, int max_attempts, bool sample_on_surface,
[[nodiscard]] bool Sample(G4ThreeVector& vertex, int max_attempts,
bool force_containment_check, long int& n_trials) const;
[[nodiscard]] bool GenerateSurfacePoint(G4ThreeVector& vertex, int max_samples,
int n_max) const;

// methods for the generic surface sampling
std::vector<G4ThreeVector> GetIntersections(const G4ThreeVector start,
const G4ThreeVector dir) const;
void GetDirection(G4ThreeVector& dir, G4ThreeVector& pos) const;


G4VPhysicalVolume* physical_volume = nullptr;
G4VSolid* sampling_solid = nullptr;
G4RotationMatrix rotation;
G4ThreeVector translation;
double volume = -1;
double surface = -1;
bool containment_check = true;
bool surface_sample = false;
bool native_sample = false;
int max_num_intersections = -1;
};

struct SampleableObjectCollection {
Expand Down Expand Up @@ -179,6 +191,7 @@ class RMGVertexConfinement : public RMGVVertexGenerator {
bool fOnSurface = false;
bool fForceContainmentCheck = false;
bool fLastSolidExcluded = false;
int fMaxNumIntersections = -1;
// counters used for the current run.
long fTrials = 0;
std::chrono::nanoseconds fVertexGenerationTime;
Expand Down
Loading
Loading