-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
Should we start adding some docstrings to the important functions? Can you give it a try? https://www.doxygen.nl/manual/docblocks.html Please also add a link to the paper. |
I agree but there seems to be many options, maybe lets pick one ? |
The number of PDF produced by the tests is now large. I think we should consider how to organise better the various confinement tests but also perhaps a strategy to merge the figures into one document? |
Yes, point in the +Z direction, then rotate about y by theta then about Z
by phi to get a vector in the direction theta phi.
…-------------------------------------
Jason Detwiler
Department of Physics, Box 351560
University of Washington
Seattle, WA 98195
(206) 543-4054
On Mon, Jan 13, 2025 at 2:13 AM Toby Dixon ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/RMGVertexConfinement.cc
<https://urldefense.com/v3/__https://github.com/legend-exp/remage/pull/226*discussion_r1912952060__;Iw!!K-Hz7m0Vt54!g2nRwyep0alWPCTbEBvCf7Z6zpV6nuymOClJ84_Yp9zvDyxvbnEsJ3hjo_8rA-xl9ZAFDddM1ITDfR7hEDtkJxM$>
:
> +
+ // start on z-axis, pointing down.
+ pos = G4ThreeVector(0.0, 0.0, bounding_radius);
+ dir = G4ThreeVector(0.0, 0.0, -1.0);
+
+ // push in rho direction by some impact parameter
+ G4double diskPhi = 2.0 * CLHEP::pi * G4UniformRand();
+ G4double diskR = sqrt(G4UniformRand()) * bounding_radius;
+
+ pos += G4ThreeVector(cos(diskPhi) * diskR, sin(diskPhi) * diskR, 0);
+
+ // now rotate pos and dir by some random direction
+ G4double theta = acos(2.0 * G4UniformRand() - 1.0);
+ G4double phi = 2.0 * CLHEP::pi * G4UniformRand();
+
+ pos.rotateY(theta);
I took this from Mage we should check if it works well and also test it
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/legend-exp/remage/pull/226*discussion_r1912952060__;Iw!!K-Hz7m0Vt54!g2nRwyep0alWPCTbEBvCf7Z6zpV6nuymOClJ84_Yp9zvDyxvbnEsJ3hjo_8rA-xl9ZAFDddM1ITDfR7hEDtkJxM$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AARCTXUS22UGIH3FLIXDVZL2KOGTPAVCNFSM6AAAAABVBREJ4OVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNBWGIYDMNBYGQ__;!!K-Hz7m0Vt54!g2nRwyep0alWPCTbEBvCf7Z6zpV6nuymOClJ84_Yp9zvDyxvbnEsJ3hjo_8rA-xl9ZAFDddM1ITDfR7h1NZaiw0$>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, please feel free to reorganize things. If you come up with a proposal on how to merge things, I can implement something quick |
I like the first one:
|
What about making a LaTex document with all the plots, although then of course we need some compiler in the container, and to constantly update that template. But I think it would be very nice to have the plots organised by test type. |
Depends on how you want this report document to look like. If it's just a collection of plots then we can do something more simple than LaTeX... |
Well I think it would also be good to have some headings. And maybe also some text / captions could be included (eg. for geant4 vis where I havent been able to add text directly) |
@jasondet Your algorithm generates N intersections and then picks one (or zero). |
My geant4 visualisations don't work properly in CI, fine locally... |
Co-authored-by: Manuel Huber <[email protected]>
@tdixon97 it is indeed probably not necessary to pick one of the N crossings at random -- at high stats you still get distribution that is essentially uniform over any surface, the only price you pay is that some consecutive points have some hint of a correlation (they lie along the same ray). That kind of correlation is probably irrelevant for our application (rad sims). However inputting N_max is not difficult. We would just set it to something that seemed reasonable (like 16 or 32 or something) and then bumped it up by a factor of 2 and re-ran if we ever saw the error message that it was too small. Then we didn't have to worry about arguing whether the faint correlation was okay or not. So we opted to do that. |
This implements the generic surface sampling following the algorithm of @jasondet et. al's paper [link].
No geantino are used instead only the methods
G4VSolid::DistanceToIn(G4ThreeVector &p,G4ThreeVector &v)
andDistanceToOut
are needed. These essentially track the distance to the next surface along a line and so can give us the number of intersections.I started on testing.
The last test is implemented but for some reason fails for the Union of 2 G4Box, in addition I find some generated points not on the surface, I will investigate.
Update : This was related to the origin of the bounding sphere which wasn't accounted for - is now fixed.
Once we have this sorted we should think how to speed it up for difficult to sample solids, one idea is to check whether its impossible for a direction vector to intersect with the solid (eg. it points the wrong way) and then avoid tracking.