-
Notifications
You must be signed in to change notification settings - Fork 5
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
Dev/coordinate transforms #45
Conversation
The latest commits fix an issue in the DIS cross section that was causing generated events to look like they fell below the Q^2 threshold. |
This should now sort out all the issues I was having with Alex's ATLAS example script. |
…e and properly integrate by trapezoidal rule
…no/LeptonInjector into dev/coordinate_transforms
…clip infinite points to bounds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last commits get the DarkNews examples working again (as in, they generate events and there don't seem to be any coordinate system mismatches). Borrows some commits from the feature/examples branch. I think this branch is now ready to merge into main
In this PR we are trying to more strictly enforce which coordinate system is used in which part of the code. The main upshot is that coordinate transformation bugs in the distributions project will be much much much harder to make.
We are going about this by having the "Earth coordinates" only be used internally by the
DetectorModel
class.This is implemented in two ways:
DetectorModel
class only uses the "Detector coordinates", with few exceptions.DetectorModel
class that accept coordinates of some form use named "strong types" (implemented withfluent::NamedType<T>
) for dispatch, so that the particular method being called is clear at the invocation.There are three exceptions to this division of the coordinate systems:
IntersectionList
still contains "Earth coordinates"Path
class internally uses "Earth coordinates"DetectorModel
has methods for setting and getting the detector origin, which by construction must be in "Earth coordinates"The first two exceptions exist so that we can avoid copious coordinate transformations in regular usage of the
Path
andDetectorModel
classes, and are fine since we do not expect users to ever interact with theIntersectionsList
internals. A consequence of this is that theSamplePairProduction
method of theInjector
class had to be removed (which was going to happen for other reasons in any case).Ideally we do not want users on the python side to have to think about two coordinate systems, so the pybindings will be changed to only use the parts of the interface that accept
DetectorPositions
andDetectorDirections
(with the exception of getting or setting the detector origin), and to perform the conversion fromVector3D
to these tagged types automatically.This PR may also solve the issue presented in #44
I have already come across several instances where the coordinate transformations were not correctly applied within the distributions project.