GRSISort "v4.1.1.0"
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 enum class EFlag : uint8_t { kDefault,
40 kObserved };
41
46
47 bool Observed() { return fFlag == EFlag::kObserved; }
48 bool Unobserved() { return fFlag == EFlag::kUnobserved; }
49 bool Inferred() { return fFlag == EFlag::kInferred; }
50 bool Tentative() { return fFlag == EFlag::kTentative; }
51
52 static void ParseName(const char* name, std::string& symbol, int& number, std::string& element)
53 {
54 ParseName(std::string(name), symbol, number, element);
55 }
56 static void ParseName(std::string name, std::string& symbol, int& number, std::string& element);
57 static std::string SortName(const char* input)
58 {
59 std::string tmp(input);
60 return SortName(tmp);
61 }
62 static std::string SortName(std::string input);
63 void SetZ(int); ///< Sets the Z (# of protons) of the nucleus
64 void SetN(int); ///< Sets the N (# of neutrons) of the nucleus
65 void SetMassExcess(double); ///< Sets the mass excess of the nucleus (in MeV)
66 void SetMass(double); ///< Sets the mass manually (in MeV)
67 void SetMass(); ///< Sets the mass based on the A and mass excess of nucleus (in MeV)
68 void SetSymbol(const char*); ///< Sets the atomic symbol for the nucleus
69
70 void AddTransition(Double_t energy, Double_t intensity, Double_t energy_uncertainty = 0.0, Double_t intensity_uncertainty = 0.0);
71 void AddTransition(TTransition* tran);
72
73 int GetZ() const { return fZ; } ///< Gets the Z (# of protons) of the nucleus
74 int GetN() const { return fN; } ///< Gets the N (# of neutrons) of the nucleus
75 int GetA() const { return fN + fZ; } ///< Gets the A (Z + N) of the nucleus
76 double GetMassExcess() const { return fMassExcess; } ///< Gets the mass excess of the nucleus (in MeV)
77 double GetMass() const { return fMass; } ///< Gets the mass of the nucleus (in MeV)
78 const char* GetSymbol() const { return fSymbol.c_str(); } ///< Gets the atomic symbol of the nucleus
79
80 // Returns total kinetic energy in MeV
81 double GetEnergyFromBeta(double beta) const;
82 double GetBetaFromEnergy(double energy_MeV) const;
83
87
88 Int_t NTransitions() const { return fTransitionListByIntensity.GetSize(); };
89 Int_t GetNTransitions() const { return fTransitionListByIntensity.GetSize(); };
90 double GetRadius() const;
91 int GetZfromSymbol(char*);
92
93 void Print(Option_t* opt = "") const override;
94 void WriteSourceFile(const std::string& outfilename = "");
95
96 const TSortedList* GetTransitionList() const { return GetTransitionListByIntensity(); }
97 const TSortedList* GetTransitionListByIntensity() const { return &fTransitionListByIntensity; }
98 const TSortedList* GetTransitionListByEnergy() const { return &fTransitionListByEnergy; }
99
100 bool operator==(const TNucleus& rhs) const { return ((fA == rhs.fA) && (fN == rhs.fN) && (fZ == rhs.fZ)); }
101 bool operator!=(const TNucleus& rhs) const { return !(*this == rhs); }
102
103 static std::string& SourceDirectory(); /// < Returns the directory with the .sou files and the mass file
104
105private:
106 static std::string& Massfile(); ///< Returns the massfile to be used, which includes Z, N, atomic symbol, and mass excess
107 void SetName(const char* name = "") override;
108
109 static std::string fSourceDirectory; //!<! path of directory with .sou files
110 static bool fSourceDirectoryChecked; //!<! flag to indicate whetehr the source directory path has been checked
111
112 int fA{0}; ///< Number of nucleons (Z + N)
113 int fN{0}; ///< Number of neutrons (N)
114 int fZ{0}; ///< Number of protons (Z)
115 double fMass{0.}; ///< Mass (in MeV)
116 double fMassExcess{0.}; ///< Mass excess (in MeV)
117 std::string fSymbol; ///< Atomic symbol (ex. Ba, C, O, N)
118 EFlag fFlag{EFlag::kDefault}; ///< Flag indicating if nucleus is observed, unobserved, inferred, or tentative
119
122 bool LoadTransitionFile();
123
124 /// \cond CLASSIMP
125 ClassDefOverride(TNucleus, 2) // NOLINT(readability-else-after-return)
126 /// \endcond
127};
128
129#endif
int GetZ() const
Gets the Z (# of protons) of the nucleus.
Definition TNucleus.h:73
void SetMass()
Sets the mass based on the A and mass excess of nucleus (in MeV)
Definition TNucleus.cxx:241
TSortedList fTransitionListByIntensity
Definition TNucleus.h:120
int GetA() const
Gets the A (Z + N) of the nucleus.
Definition TNucleus.h:75
void SetTentative()
Definition TNucleus.h:45
void SetName(const char *name="") override
Definition TNucleus.cxx:144
double fMassExcess
Mass excess (in MeV)
Definition TNucleus.h:116
Int_t NTransitions() const
Definition TNucleus.h:88
void SetZ(int)
Sets the Z (# of protons) of the nucleus.
Definition TNucleus.cxx:219
void SetObserved()
Definition TNucleus.h:42
void AddTransition(Double_t energy, Double_t intensity, Double_t energy_uncertainty=0.0, Double_t intensity_uncertainty=0.0)
Definition TNucleus.cxx:283
TTransition * GetTransitionByIntensity(Int_t idx)
Definition TNucleus.cxx:303
void Print(Option_t *opt="") const override
Definition TNucleus.cxx:323
double fMass
Mass (in MeV)
Definition TNucleus.h:115
TNucleus()=default
Should not be used, here so we can write things to a root file.
EFlag fFlag
Flag indicating if nucleus is observed, unobserved, inferred, or tentative.
Definition TNucleus.h:118
double GetEnergyFromBeta(double beta) const
Definition TNucleus.cxx:403
static std::string fSourceDirectory
! path of directory with .sou files
Definition TNucleus.h:109
static std::string & SourceDirectory()
Definition TNucleus.cxx:19
const TSortedList * GetTransitionListByEnergy() const
Definition TNucleus.h:98
bool LoadTransitionFile()
Definition TNucleus.cxx:350
bool operator==(const TNucleus &rhs) const
Definition TNucleus.h:100
double GetBetaFromEnergy(double energy_MeV) const
Definition TNucleus.cxx:409
int GetN() const
Gets the N (# of neutrons) of the nucleus.
Definition TNucleus.h:74
int fN
Number of neutrons (N)
Definition TNucleus.h:113
TNucleus(const TNucleus &)=delete
int fZ
Number of protons (Z)
Definition TNucleus.h:114
void SetN(int)
Sets the N (# of neutrons) of the nucleus.
Definition TNucleus.cxx:224
void SetInferred()
Definition TNucleus.h:44
const TSortedList * GetTransitionListByIntensity() const
Definition TNucleus.h:97
double GetRadius() const
Definition TNucleus.cxx:276
void SetSymbol(const char *)
Sets the atomic symbol for the nucleus.
Definition TNucleus.cxx:247
Int_t GetNTransitions() const
Definition TNucleus.h:89
TTransition * GetTransitionByEnergy(Int_t idx)
Definition TNucleus.cxx:313
static bool fSourceDirectoryChecked
! flag to indicate whetehr the source directory path has been checked
Definition TNucleus.h:110
double GetMass() const
Gets the mass of the nucleus (in MeV)
Definition TNucleus.h:77
static std::string & Massfile()
< Returns the directory with the .sou files and the mass file
Definition TNucleus.cxx:35
static void ParseName(const char *name, std::string &symbol, int &number, std::string &element)
Definition TNucleus.h:52
TNucleus(TNucleus &&) noexcept=delete
bool Unobserved()
Definition TNucleus.h:48
void WriteSourceFile(const std::string &outfilename="")
Definition TNucleus.cxx:335
bool Inferred()
Definition TNucleus.h:49
static std::string SortName(const char *input)
Definition TNucleus.h:57
int fA
Number of nucleons (Z + N)
Definition TNucleus.h:112
TTransition * GetTransition(Int_t idx)
Definition TNucleus.h:84
bool Observed()
Definition TNucleus.h:47
const TSortedList * GetTransitionList() const
Definition TNucleus.h:96
TSortedList fTransitionListByEnergy
Definition TNucleus.h:121
double GetMassExcess() const
Gets the mass excess of the nucleus (in MeV)
Definition TNucleus.h:76
void SetMassExcess(double)
Sets the mass excess of the nucleus (in MeV)
Definition TNucleus.cxx:229
bool Tentative()
Definition TNucleus.h:50
std::string fSymbol
Atomic symbol (ex. Ba, C, O, N)
Definition TNucleus.h:117
const char * GetSymbol() const
Gets the atomic symbol of the nucleus.
Definition TNucleus.h:78
bool operator!=(const TNucleus &rhs) const
Definition TNucleus.h:101
int GetZfromSymbol(char *)
Definition TNucleus.cxx:253
void SetUnobserved()
Definition TNucleus.h:43