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