TkN 2.1
Toolkit for Nuclei

Simple ROOT macro using TkN

macro_explore.C provides a simple example ROOT macro using TkN to explore some properties of the Carbon isotopic chain.

Type tkn-root to launch the interactive C++ interpreter of ROOT with all the basic libraries of the toolkit already linked in and all necessary paths required for compilation of your code predefined:

tkn-root
_____ _ _ | Documentation: https://tkn.in2p3.fr/
(_ _) | \ | | | Source: https://gitlab.in2p3.fr/tkn/tkn-lib
| |_ _| \| | |
| | |/ / | | Version 1.0
| | <| |\ | |
|_|_|\_\_| \_| | Database: TkN_ensdf_221101_xundl_210701_v1.0.db
tkn [0]

You can then compile and execute macro_explore.C:

tkn [0] .L macro_explore.C+
Info in <TUnixSystem::ACLiC>: creating shared library tkn-install/examples/./macro_explore_C.so
tkn [1] macro_explore()

Source code :

#include "Rtypes.h"
#include "tkmanager.h"
using namespace tkn;
void macro_explore()
{
std::cout << "*******************************************" << std::endl;
std::cout << "* Excited states on Carbon isotopic chain *" << std::endl;
std::cout << "*******************************************" << std::endl;
std::cout << "* Ground state spin parity *" << std::endl;
std::cout << "*-----------------------------------------*" << std::endl;
for(const auto &nuc : gmanager->get_nuclei([](auto nuc) {return (nuc->get_z()==6);})) {
tkn::tkstring test = nuc->get_symbol();
auto lvls =nuc->get_level_scheme()->get_levels([](auto lvl) {return (lvl->get_energy()==0);});
std::cout << std::setw(5) << std::left << nuc->get_symbol();
if(!lvls.empty()) std::cout << lvls.at(0)->get_spin_parity()->get_jpi_str();
std::cout << std::endl;
}
std::cout << "*-----------------------------------------*" << std::endl;
std::cout << "* Energy of second 0+ state *" << std::endl;
std::cout << "*-----------------------------------------*" << std::endl;
for(const auto &nuc : gmanager->get_nuclei([](auto nuc) {return (nuc->get_z()==6&&!(nuc->get_a()%2));})) {
auto lvls = nuc->get_level_scheme()->get_levels([](auto lvl) {return (lvl->get_spin_parity()->get_jpi_str()=="0+");});
std::cout << std::setw(5) << std::left << nuc->get_symbol();
if(lvls.size()>1) lvls[1]->get_energy_measure()->print(false);
else std::cout << "unkown";
std::cout << std::endl;
}
std::cout << "*-----------------------------------------*" << std::endl;
std::cout << "* All positive parity states *" << std::endl;
std::cout << "*-----------------------------------------*" << std::endl;
for(const auto &nuc : gmanager->get_nuclei([](auto nuc) {return (nuc->get_z()==6);})) {
std::cout << std::setw(5) << std::left << nuc->get_symbol();
for(const auto &lvl : nuc->get_level_scheme()->get_levels([](auto lvl) {return (lvl->get_spin_parity()->get_parity().get_value()==tkparity::kParityPlus);})) {
std::cout << std::setw(5) << std::left << lvl->get_spin_parity()->get_jpi_str();
}
std::cout << std::endl;
}
}
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
Definition: tklog.cpp:39