TkN 2.4
Toolkit for Nuclei
Loading...
Searching...
No Matches
tkspin_parity.h
1/********************************************************************************
2 * Copyright (c) : Université de Lyon 1, CNRS/IN2P3, UMR5822, *
3 * IP2I, F-69622 Villeurbanne Cedex, France *
4 * Normandie Université, ENSICAEN, UNICAEN, CNRS/IN2P3, *
5 * LPC Caen, F-14000 Caen, France *
6 * Contibutor(s) : *
7 * Jérémie Dudouet jeremie.dudouet@cnrs.fr [2020] *
8 * Diego Gruyer diego.gruyer@cnrs.fr [2020] *
9 * *
10 * Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11 * SPDX-License-Identifier: MIT *
12 ********************************************************************************/
13
14#ifndef tkspin_parity_H
15#define tkspin_parity_H
16
17#include "tkn_config.h"
18#include "tkproperty.h"
19
20#ifdef HAS_ROOT
21#include "TClass.h"
22#endif
23
24namespace tkn {
25
26class tkspin: public tkproperty {
27
28protected:
29 int fN = 0; // numerator
30 int fD = 1; // denominator - should be 1 or 2
31
32public:
34 tkspin(int _n, int _d=1);
35 virtual ~tkspin() override = default;
36
38 void set(int n, int d = 1);
40 void set(double _spin) ;
41
43 double get_value() {return double(fN) / fD;}
46
48 virtual void set(const tkstring &_st) ;
49
51 virtual void clear(){tkproperty::clear() ; fN = 0;fD = 1;}
52
54 virtual void print();
55
56#ifdef HAS_ROOT
58 ClassDefOverride(tkspin,0);
59#endif
60};
61
62class tkparity: public tkproperty {
63public:
65
66protected:
67 short fParity = kParityUnknown;
68
69public:
70 tkparity() = default;
71 tkparity(tkparity::eparity p) : fParity(p) {;}
72 virtual ~tkparity() override = default;
73
75 virtual bool is_parity(tkparity::eparity _parity){ return (_parity == fParity); }
77 virtual short get_value(){ return fParity; }
78
80 virtual void set(const tkstring &_st);
82 virtual void set(tkparity::eparity _parity) { fParity = _parity;}
84 virtual void set(int _parity);
85
88
90 virtual void clear(){tkproperty::clear() ; fParity = kParityUnknown;}
91
93 void print();
94
95#ifdef HAS_ROOT
97 ClassDefOverride(tkparity,0);
98#endif
99};
100
102protected:
103 tkstring fJpi_str{"?"};
104
105 tkspin fSpin{};
106 tkparity fParity{};
107
108public:
110 virtual ~tkspin_parity() = default;
111
113 void set_from_str(const tkstring &_st);
114
116 void set_spin(double _spin);
117
119 void set_parity(int _parity);
120
122 virtual bool is_known() { return (fSpin.is_known() && fParity.is_known());}
123
125 const tkstring &get_jpi_str() const;
126
128 tkspin get_spin() {return fSpin;}
130 tkparity get_parity() {return fParity;}
131
133 void print();
134
135#ifdef HAS_ROOT
137 ClassDef(tkspin_parity,0)
138#endif
139};
140
141}
142#endif
Nuclear excited state parity.
virtual short get_value()
returns the parity value as a tkparity::eparity
virtual void set(tkparity::eparity _parity)
define the parity from tkparity::eparity
void print()
print the spin properties
tkparity()=default
tkparity(tkparity::eparity p)
tkstring get_string()
returns the parity as a string
virtual void clear()
to clear the content
virtual bool is_parity(tkparity::eparity _parity)
test the parity value
virtual void set(const tkstring &_st)
define the parity from a string
virtual ~tkparity() override=default
void clear()
clear the property
Definition tkproperty.h:77
Nuclear excited state spin-parity.
tkspin get_spin()
returns the spin object
void set_from_str(const tkstring &_st)
define the spin parity from a string
void print()
print the spin and parity properties
tkparity get_parity()
returns the parity object
void set_parity(int _parity)
define the parity from an integer
void set_spin(double _spin)
define the spin from a float
virtual bool is_known()
test if the spin and parity are known
virtual ~tkspin_parity()=default
const tkstring & get_jpi_str() const
returns the spin and parity string
Nuclear excited state spin.
virtual void print()
print the spin properties
virtual ~tkspin() override=default
double get_value()
To get the spin as a double.
tkstring get_string()
returns the spin as a string
void set(int n, int d=1)
define the spin value
virtual void clear()
to clear the content
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:31
Definition tklog.cpp:16