REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestWimpNucleus.cxx
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
41
42#include "TRestWimpNucleus.h"
43
44#include "TRestMetadata.h"
45#include "TRestWimpUtils.h"
46
47ClassImp(TRestWimpNucleus);
48
49TRestWimpNucleus::TRestWimpNucleus() {
50 fNucleusName = "";
51 fAnum = 0;
52 fZnum = 0;
53 fAbundance = 0;
54 fAbundanceMol = 0;
55}
56
57TRestWimpNucleus::~TRestWimpNucleus() {}
58
59void TRestWimpNucleus::PrintNucleus() {
60 RESTMetadata << "-----------------------------" << RESTendl;
61 RESTMetadata << "Nuclei name " << fNucleusName.Data() << RESTendl;
62 RESTMetadata << "Atomic number " << fAnum << RESTendl;
63 RESTMetadata << "Number of protons " << fZnum << RESTendl;
64 RESTMetadata << "Abundance " << fAbundance << RESTendl;
65 RESTMetadata << "Abundance (mol) " << fAbundanceMol << RESTendl;
66 RESTMetadata << "-----------------------------" << RESTendl;
67}
68
76 auto elementMap = TRestWimpUtils::ParseChemicalCompound(compound);
77
78 int stechiometricFactor = 0;
79 for (auto& pair : elementMap) {
80 if (pair.first == fNucleusName.Data()) {
81 stechiometricFactor = pair.second;
82 break;
83 }
84 }
85 if (stechiometricFactor == 0)
86 RESTWarning << "No nucleus " << fNucleusName.Data() << " founnd in compound " << compound << RESTendl;
87
88 return stechiometricFactor;
89}
A class to store different nucleus parameters.
Double_t fAnum
Atomic number in amus.
int GetStechiometricFactorFromCompound(const std::string &compound)
Get the stechiometric factor of this nucleus in a given compound.
TString fNucleusName
Nucleus name.
Double_t fAbundance
Abundance, in mass percentage.
Int_t fZnum
Number of protons.
Double_t fAbundanceMol
Abundance, in mole (or volume)