-
Notifications
You must be signed in to change notification settings - Fork 0
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
Functionality for setting nuclei targets abundances in mol (volume) and as chemical compound #11
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ol/volume and chemical compounds
juanangp
reviewed
Nov 30, 2023
Comment on lines
-48
to
+55
TRestWimpNucleus::TRestWimpNucleus() {} | ||
TRestWimpNucleus::TRestWimpNucleus() { | ||
fNucleusName = ""; | ||
fAnum = 0; | ||
fZnum = 0; | ||
fAbundance = 0; | ||
fAbundanceMol = 0; | ||
} |
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.
In general is a better practise to initialize these variables in the header.
juanangp
reviewed
Nov 30, 2023
@@ -161,23 +169,123 @@ void TRestWimpSensitivity::InitFromConfigFile() { | |||
/// | |||
void TRestWimpSensitivity::ReadNuclei() { |
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.
Perhaps it would be better to move this function inside TRestWimpNucleus
.
juanangp
approved these changes
Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding other ways to define the target material. Now it is possible to define (chemical) compounds. Also, the abundances can be given in mol (or volume) using the parameter abundanceInMol instead of abundance. Examples for an Ar+Isobutane mixture at 99% in volume can be found inside the files 'REST_PATH/source/libraries/wimp/examples/WIMP_compound_1.rml' and 'REST_PATH/source/libraries/wimp/examples/WIMP_compound_2.rml'.
So now, there are three ways of setting the abundance with rml files:
fAbundanceInMol
is justfAbundance/fAnum
fAbundance
will be the relative amount of mass of each nucleus (normalized to 1).fAbundance
is normalized, so thefAbundance
of each nucleus is the relative amount of mass of that nucleus.The new addCompound structure
Compounds are meant to be written in the following way
Where compoundName is the chemical formula and abundance or abundanceInMol the corresponding abundance of the whole compound. Inside the addCompound structure, there must be defined each element of the chemical formula, where the nucleusName must match with the one of the chemical formula and their anum and znum must be provided (even if there have been previously given in other compounds or standalone elements).
There is no problem on adding the same nucleus within different addElement or addCompound. If there are several
TRestWimpNucleus
with the samefNucleusName
,fAnum
andfZnum
, they will be merged by summing theirfAbundance
andfAbundanceInMol
.The new abundanceInMol parameter
To add the possibility of descrbing the gas mixture in volume terms, the abundanceInMol parameter should be use. For this, the new member
fAbundanceInMol
of TRestWimpNucleus is proposed. The purpose of this member is double:It is important to notice that for all calculations,
fAbundance
remains the member to be used in the sensitivity (and recoil spectra) functions.Although
fAbundance
meaning is the relative amount of mass of the corresponding nucleus in the mixture, it is useful to do not normalize it, so it can be used as absolute mass (in kg) of that nucleus inside the function GetRecoilSpectra() to generate the independent spectrum of several nuclei ( idem, in units of c/keV/day/kg where kg is kg of each nucleus and not of the mixture of all the nuclei). To mantain this option available,fAbundance
is not normalize if ALL the abundances in the rml file are set through the abundance paremeter. If any element or compound has abundanceInMol, thenanyGivenAbundanceInMol=true
insideTRestWimpSensitivity::ReadNuclei()
andfAbundance
will be normalized.