GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TNucleus.h
Go to the documentation of this file.
1#ifndef TNUCLEUS_H
2#define TNUCLEUS_H
3
4#include <cmath>
5#include <cstring>
6#include <cstdlib>
7#include <string>
8
9#include "TTransition.h"
10
11#include "TNamed.h"
12#include "TSortedList.h"
13
14/////////////////////////////////////////////////////////////////
15///
16/// \class TNucleus
17///
18/// This class builds a nucleus and sets all the basic information
19/// (mass, Z, symbol, radius, etc.)
20///
21/////////////////////////////////////////////////////////////////
22
23class TNucleus : public TNamed {
24public:
25 TNucleus() = default; ///< Should not be used, here so we can write things to a root file.
26 explicit TNucleus(const char* name); ///< Creates a nucleus based on symbol and sets all parameters from mass.dat
27 TNucleus(int charge, int neutrons, double mass, const char* symbol); ///< Creates a nucleus with Z, N, mass, and symbol
28 TNucleus(int charge, int neutrons, const char* MassFile = nullptr); ///< Creates a nucleus with Z, N using mass table (default MassFile = "mass.dat")
29 TNucleus(const TNucleus&) = delete;
30 TNucleus(TNucleus&&) noexcept = delete;
31 TNucleus& operator=(const TNucleus&) = delete;
32 TNucleus& operator=(TNucleus&&) noexcept = delete;
33
34 ~TNucleus();
35
36 static void ParseName(const char* name, std::string& symbol, int& number, std::string& element)
37 {
38 ParseName(std::string(name), symbol, number, element);
39 }
40 static void ParseName(std::string name, std::string& symbol, int& number, std::string& element);
41 static std::string SortName(const char* input)
42 {
43 std::string tmp(input);
44 return SortName(tmp);
45 }
46 static std::string SortName(std::string input);
47 void SetZ(int); ///< Sets the Z (# of protons) of the nucleus
48 void SetN(int); ///< Sets the N (# of neutrons) of the nucleus
49 void SetMassExcess(double); ///< Sets the mass excess of the nucleus (in MeV)
50 void SetMass(double); ///< Sets the mass manually (in MeV)
51 void SetMass(); ///< Sets the mass based on the A and mass excess of nucleus (in MeV)
52 void SetSymbol(const char*); ///< Sets the atomic symbol for the nucleus
53
54 void AddTransition(Double_t energy, Double_t intensity, Double_t energy_uncertainty = 0.0, Double_t intensity_uncertainty = 0.0);
55 void AddTransition(TTransition* tran);
56
57 int GetZ() const { return fZ; } ///< Gets the Z (# of protons) of the nucleus
58 int GetN() const { return fN; } ///< Gets the N (# of neutrons) of the nucleus
59 int GetA() const { return fN + fZ; } ///< Gets the A (Z + N) of the nucleus
60 double GetMassExcess() const { return fMassExcess; } ///< Gets the mass excess of the nucleus (in MeV)
61 double GetMass() const { return fMass; } ///< Gets the mass of the nucleus (in MeV)
62 const char* GetSymbol() const { return fSymbol.c_str(); } ///< Gets the atomic symbol of the nucleus
63
64 // Returns total kinetic energy in MeV
65 double GetEnergyFromBeta(double beta) const;
66 double GetBetaFromEnergy(double energy_MeV) const;
67
71
72 Int_t NTransitions() const { return fTransitionListByIntensity.GetSize(); };
73 Int_t GetNTransitions() const { return fTransitionListByIntensity.GetSize(); };
74 double GetRadius() const;
75 int GetZfromSymbol(char*);
76
77 void Print(Option_t* opt = "") const override;
78 void WriteSourceFile(const std::string& outfilename = "");
79
80 const TSortedList* GetTransitionList() const { return GetTransitionListByIntensity(); }
81 const TSortedList* GetTransitionListByIntensity() const { return &fTransitionListByIntensity; }
82 const TSortedList* GetTransitionListByEnergy() const { return &fTransitionListByEnergy; }
83
84 bool operator==(const TNucleus& rhs) const { return ((fA == rhs.fA) && (fN == rhs.fN) && (fZ == rhs.fZ)); }
85 bool operator!=(const TNucleus& rhs) const { return !(*this == rhs); }
86
87private:
88 static std::string& Massfile(); ///< Returns the massfile to be used, which includes Z, N, atomic symbol, and mass excess
89 void SetName(const char* name = "") override;
90
91 int fA{0}; ///< Number of nucleons (Z + N)
92 int fN{0}; ///< Number of neutrons (N)
93 int fZ{0}; ///< Number of protons (Z)
94 double fMass{0.}; ///< Mass (in MeV)
95 double fMassExcess{0.}; ///< Mass excess (in MeV)
96 std::string fSymbol; ///< Atomic symbol (ex. Ba, C, O, N)
97
100 bool LoadTransitionFile();
101
102 /// \cond CLASSIMP
103 ClassDefOverride(TNucleus, 2) // NOLINT(readability-else-after-return)
104 /// \endcond
105};
106
107#endif
int GetZ() const
Gets the Z (# of protons) of the nucleus.
Definition TNucleus.h:57
void SetMass()
Sets the mass based on the A and mass excess of nucleus (in MeV)
Definition TNucleus.cxx:220
TSortedList fTransitionListByIntensity
Definition TNucleus.h:98
int GetA() const
Gets the A (Z + N) of the nucleus.
Definition TNucleus.h:59
void SetName(const char *name="") override
Definition TNucleus.cxx:123
double fMassExcess
Mass excess (in MeV)
Definition TNucleus.h:95
Int_t NTransitions() const
Definition TNucleus.h:72
void SetZ(int)
Sets the Z (# of protons) of the nucleus.
Definition TNucleus.cxx:198
void AddTransition(Double_t energy, Double_t intensity, Double_t energy_uncertainty=0.0, Double_t intensity_uncertainty=0.0)
Definition TNucleus.cxx:262
TTransition * GetTransitionByIntensity(Int_t idx)
Definition TNucleus.cxx:282
void Print(Option_t *opt="") const override
Definition TNucleus.cxx:302
double fMass
Mass (in MeV)
Definition TNucleus.h:94
TNucleus()=default
Should not be used, here so we can write things to a root file.
double GetEnergyFromBeta(double beta) const
Definition TNucleus.cxx:383
const TSortedList * GetTransitionListByEnergy() const
Definition TNucleus.h:82
bool LoadTransitionFile()
Definition TNucleus.cxx:329
bool operator==(const TNucleus &rhs) const
Definition TNucleus.h:84
double GetBetaFromEnergy(double energy_MeV) const
Definition TNucleus.cxx:389
int GetN() const
Gets the N (# of neutrons) of the nucleus.
Definition TNucleus.h:58
int fN
Number of neutrons (N)
Definition TNucleus.h:92
TNucleus(const TNucleus &)=delete
int fZ
Number of protons (Z)
Definition TNucleus.h:93
void SetN(int)
Sets the N (# of neutrons) of the nucleus.
Definition TNucleus.cxx:203
const TSortedList * GetTransitionListByIntensity() const
Definition TNucleus.h:81
double GetRadius() const
Definition TNucleus.cxx:255
void SetSymbol(const char *)
Sets the atomic symbol for the nucleus.
Definition TNucleus.cxx:226
Int_t GetNTransitions() const
Definition TNucleus.h:73
TTransition * GetTransitionByEnergy(Int_t idx)
Definition TNucleus.cxx:292
double GetMass() const
Gets the mass of the nucleus (in MeV)
Definition TNucleus.h:61
static std::string & Massfile()
Returns the massfile to be used, which includes Z, N, atomic symbol, and mass excess.
Definition TNucleus.cxx:13
static void ParseName(const char *name, std::string &symbol, int &number, std::string &element)
Definition TNucleus.h:36
TNucleus(TNucleus &&) noexcept=delete
void WriteSourceFile(const std::string &outfilename="")
Definition TNucleus.cxx:314
static std::string SortName(const char *input)
Definition TNucleus.h:41
int fA
Number of nucleons (Z + N)
Definition TNucleus.h:91
TTransition * GetTransition(Int_t idx)
Definition TNucleus.h:68
const TSortedList * GetTransitionList() const
Definition TNucleus.h:80
TSortedList fTransitionListByEnergy
Definition TNucleus.h:99
double GetMassExcess() const
Gets the mass excess of the nucleus (in MeV)
Definition TNucleus.h:60
void SetMassExcess(double)
Sets the mass excess of the nucleus (in MeV)
Definition TNucleus.cxx:208
std::string fSymbol
Atomic symbol (ex. Ba, C, O, N)
Definition TNucleus.h:96
const char * GetSymbol() const
Gets the atomic symbol of the nucleus.
Definition TNucleus.h:62
bool operator!=(const TNucleus &rhs) const
Definition TNucleus.h:85
int GetZfromSymbol(char *)
Definition TNucleus.cxx:232