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

Changes related to restG4 MT #59

Merged
merged 109 commits into from
Sep 14, 2022
Merged

Changes related to restG4 MT #59

merged 109 commits into from
Sep 14, 2022

Conversation

lobis
Copy link
Member

@lobis lobis commented Jul 7, 2022

lobis Large: 2076

Data Containers

Data containers (Event, Track, Steps) have been updated: some member names have been changed for consistency and others deemed redundant have been removed (such as TRestGeant4Tracks::fNTracks, same as fTracks.size() etc.). Many unused or redundant methods have also been removed for simplicity. Class version have been updated.

Data containers now have references to other containers as members. This references are not stored on the root file (//!) and are initialized dynamically by TRestRun::GetEntry. The allow things like accessing the event from a track, getting the pointer to the parent track directly from the child track etc.

Data containers initialization is handled by restG4 with a constructor taking a const reference to the corresponding geant4 construct as argument. Geant4lib purpose is to perform analysis on simulation events, we don't need to create the data using Geant4lib.

The way subevent primary information is stored has been rethinked:

Now you can access the subevent primary information (position, energy, particle...) and the event primary information. For example for a nuclear decay subevent you can get the position of the primary decay particle via GetSubEventPrimaryEventOrigin and access the original primary position via GetEventPrimaryEventOrigin.

Also the member fSubEventPrimaryParticleName automatically serves to store the decay particle name (if it exists) so we no longer need to use the event tag to store this information.

Metadata

TRestGeant4Metadata has been simplified and now longer directly contains primary generator information. This is now contained in the new class TRestGeant4PrimaryGeneratorInfo. The RML declaration remains the same. The only change is regarding the getters for generator info: previously you could do things like TRestGeant4Metadata::GetGeneratorPosition(), now you need to do something like TRestGeant4Metadata::GetGeant4PrimaryGeneratorInfo().GetGeneratorPosition().

TRestGeant4PrimaryGeneratorInfo contains the same logic previously present on TRestGeant4Metadata and some other functions have been implemented. Better validation using enums to make sure a correct option has been selected, and to store a consistent string name for the options.

energyDist and angularDist rml keywords have been replaced by energy and angular. The previous names also work so both are supported and this should not break anything. All examples have been updated.

A new type of distribution has been introduced called Formula which can be used on angular and energy distributions. Currently it only supports predefined formulas but it can support used defined formulas with little change.

For example: <angular type="TH1D" file="CosmicAngles.root" spctName="Theta2" direction="(0,0,-1)"/> now can also be <angular type="formula" name="Cos2" direction="(0,0,-1)"/> with does not require referencing a file. It should also have more precission since its sampling the mathematical formula directly. The TF1 is stored in the particle source and can be retrieved and plotted directly.

In the case of energy distributions they are defined in a predefined range (one where the formula is valid) and the user can choose a different range with the usual range= xml syntax. A validation logic has been introduced to make sure that the final range is always the intersection with the formula validity range, so we cannot use a energy distribution ranging from 1 MeV to 100 MeV to sample from 100 keV to 20 MeV for example. The final range would be from 1MeV to 20MeV automatically without giving error (the range can be consulted on the metadata as usual).

lobis added 30 commits June 20, 2022 10:42
inc/TRestGeant4Metadata.h Outdated Show resolved Hide resolved
@lobis lobis requested a review from juanangp September 12, 2022 15:19
@juanangp
Copy link
Member

Remember to change the pipeline @master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geant4 metadata print not showing some values
2 participants