-
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
New record types and new injector inheritance #49
Conversation
… Maybe we should redirect the logging stream instead?
…s mutable. Add additional ostream operators
…tly (need to set the mass still)
…assing secondary record to primary distributions
@nickkamp1 this PR should be good to go now. The weighting/assertion issue was caused by a mistake I made in adding the secondary particle records to the |
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.
This PR looks mostly good to go up to the handful of comments I left. Once those are addressed, I think this is ready to merge
projects/distributions/private/secondary/vertex/SecondaryBoundedVertexDistribution.cxx
Outdated
Show resolved
Hide resolved
… secondary particle properties in the parent InteractionRecord. Use the SecondaryParticleRecord::Finalize within CrossSectionDistributionRecord::Finalize
@nickkamp1 the new commits have a few fixes related to your comments which should all be addressed now. The only other change I made is removing the Particle interface from |
Looks good, approving! |
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.
thanks for the last updates, approved!
Apologies in advance because this is another one of those (unfathomably large) PRs.
The original goal of this PR was to add serialization tests.
PR goals
The goal of this PR is to add new record types that:
InteractionRecord
to be less restricted in what order they are set by injection distributionsNew record classes
This resulted in the creation of four new record classes:
PrimaryDistributionRecord
: passed toSample
method of primary injection distributionsSecondaryParticleRecord
: to be used within the next record typeCrossSectionDistributionRecord
: to be passed to theSampleFinalState
method of the cross section and decay classesSecondaryDistributionRecord
: to be passed to theSample
method of secondary injection distributionsThese classes provide methods to set the appropriate properties of
InteractionRecord
at each stage of the injection.For example:
PrimaryDistributionRecord
is constructed with a primary particle type, and has methods for setting various properties of the primary particlePrimaryDistributionRecord
first check if that property has been set previously, attempt to compute the property from other set properties, and finally throw an error if the property has not been set and cannot be computedThis behavior allows primary injection distributions to be ordered irrespective of the internal representation used by
InteractionRecord
, and now throws an error when un-available information is requested instead of silently returning uninitialized data.Injection distribution inheritance
Originally the primary and secondary injection distribution both inherited from
WeightableDistribution
hadSample
methods that accepted anInteractionRecord
to modify directly. Switching to the new record types (PrimaryDistributionRecord
andSecondaryDistributionRecord
) requires changing this inheritance structure to enforce theSample
methods accepting the new record types.Primary and secondary injection distributions now inherit from
PrimaryInjectionDistribution
andSecondaryInjectionDistribution
, respectively, which require the implementation ofSample
methods that accept the correct types.Process changes
Splitting the inheritance structure for the injection distributions also required splitting other types:
InjectionProcess
-->PrimaryInjectionProcess
+SecondaryInjectionProcess
LeptonProcessWeighter
-->PrimaryProcessWeighter
+SecondaryProcessWeighter
The primary_type set in
PrimaryInjectionProcess
is now used to set the primary type inPrimaryDistributionRecord
Injection changes
Other small changes have been made to the
Injector
classInteractionTreeDatum
and an integer corresponding to the proposed secondaryInjector
constructs new record classes before passing them to primary/secondary injection distributions and CrossSection/Decay classesInjector
calls theFinalize
method of the new record classes to copy information from the new record classes into theInteractionRecord
SampleNeutrissimoDecay
Cross section changes
The
CrossSection
class now implements aTotalCrossSectionAllFinalStates
method to support cross section instances that have multiple final statesDistribution changes
SecondaryVertexDistribution
moved and split intoSecondaryPhysicalVertexDistribution
andSecondaryBoundedVertexDistribution
which inherit fromSecondaryInjectionDistribution
andSecondaryVertexPositionDistribution
SamplePosition
method of the primaryVertexPositionDistribution
now returns both the initial position and vertex of the primary particle so they can both be set in theSample
methodPrimaryInjector
removed in favor of aPrimaryMass
distribution. We might want to consider changing the generation probability to always return 1.0 so we can support weighting between mass dependent cross sections.Particle changes
Particle
class has been re-written to store information in a useful format, and is now used as an interface forSecondaryParticleRecord
ParticleType
enum is now defined outside of theParticle
class so it is not necessary to writeLI::dataclasses::Particle::ParticleType
ParticleType
enum is now defined using X-macros so that the enum definition, pybindings, and convenience maps are always consistentParticleID
class to uniquely identify particles and added a particle id field toInteractionRecord
Record changes
DecayRecord
ParticleID id;
andstd::array<double, 3> primary_initial_position;
toInteractionRecord