TkN 2.1
Toolkit for Nuclei
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 * This software is governed by the CeCILL-B license under French law and *
11 * abiding by the rules of distribution of free software. You can use, *
12 * modify and/ or redistribute the software under the terms of the *
13 * CeCILL-B license as circulated by CEA, CNRS and INRIA at the following *
14 * URL \"http://www.cecill.info\". *
15 * *
16 * As a counterpart to the access to the source code and rights to copy, *
17 * modify and redistribute granted by the license, users are provided *
18 * only with a limited warranty and the software's author, the holder of *
19 * the economic rights, and the successive licensors have only limited *
20 * liability. *
21 * *
22 * In this respect, the user's attention is drawn to the risks associated *
23 * with loading, using, modifying and/or developing or reproducing the *
24 * software by the user in light of its specific status of free software, *
25 * that may mean that it is complicated to manipulate, and that also *
26 * therefore means that it is reserved for developers and experienced *
27 * professionals having in-depth computer knowledge. Users are therefore *
28 * encouraged to load and test the software's suitability as regards *
29 * their requirements in conditions enabling the security of their *
30 * systems and/or data to be ensured and, more generally, to use and *
31 * operate it in the same conditions as regards security. *
32 * *
33 * The fact that you are presently reading this means that you have had *
34 * knowledge of the CeCILL-B license and that you accept its terms. *
35 ********************************************************************************/
36
37#ifndef tkspin_parity_H
38#define tkspin_parity_H
39
40#include "tkn_config.h"
41#include "tkproperty.h"
42
43#ifdef HAS_ROOT
44#include "TClass.h"
45#endif
46
47namespace tkn {
48
49class tkspin: public tkproperty {
50
51protected:
52 int fN = 0; // numerator
53 int fD = 1; // denominator - should be 1 or 2
54
55public:
57 tkspin(int _n, int _d=1);
58 virtual ~tkspin(){}
59
61 void set(int n, int d = 1);
63 void set(double _spin) ;
64
66 double get_value() {return double(fN) / fD;}
69
71 virtual void set(const tkstring &_st) ;
72
74 virtual void clear(){tkproperty::clear() ; fN = 0;fD = 1;}
75
77 virtual void print();
78
79#ifdef HAS_ROOT
81 ClassDef(tkspin,0);
82#endif
83};
84
85class tkparity: public tkproperty {
86public:
88
89protected:
90 short fParity = kParityUnknown;
91
92public:
93 tkparity() = default;
94 tkparity(tkparity::eparity p) : fParity(p) {;}
95 virtual ~tkparity() = default;
96
98 virtual bool is_parity(tkparity::eparity _parity){ return (_parity == fParity); }
100 virtual short get_value(){ return fParity; }
101
103 virtual void set(const tkstring &_st);
105 virtual void set(tkparity::eparity _parity) { fParity = _parity;}
107 virtual void set(int _parity);
108
111
113 virtual void clear(){tkproperty::clear() ; fParity = kParityUnknown;}
114
116 void print();
117
118#ifdef HAS_ROOT
120 ClassDef(tkparity,0);
121#endif
122};
123
125protected:
126 tkstring fJpi_str{"?"};
127
128 tkspin fSpin{};
129 tkparity fParity{};
130
131public:
133 virtual ~tkspin_parity(){}
134
136 void set_from_str(const tkstring &_st);
137
139 void set_spin(double _spin);
140
142 void set_parity(int _parity);
143
145 virtual bool is_known() { return (fSpin.is_known() && fParity.is_known());}
146
148 const tkstring &get_jpi_str() const;
149
151 tkspin get_spin() {return fSpin;}
153 tkparity get_parity() {return fParity;}
154
156 void print();
157
158#ifdef HAS_ROOT
160 ClassDef(tkspin_parity,0)
161#endif
162};
163
164}
165#endif
Nuclear excited state parity.
Definition: tkspin_parity.h:85
virtual ~tkparity()=default
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)
Definition: tkspin_parity.h:94
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
Definition: tkspin_parity.h:98
virtual void set(const tkstring &_st)
define the parity from a string
Any property (data) with flags.
Definition: tkproperty.h:51
bool is_known() const
to get some information about this data
Definition: tkproperty.h:91
void clear()
clear the property
Definition: tkproperty.h:100
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
virtual ~tkspin_parity()
void set_spin(double _spin)
define the spin from a float
virtual bool is_known()
test if the spin and parity are known
const tkstring & get_jpi_str() const
returns the spin and parity string
Nuclear excited state spin.
Definition: tkspin_parity.h:49
virtual void print()
print the spin properties
double get_value()
To get the spin as a double.
Definition: tkspin_parity.h:66
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
Definition: tkspin_parity.h:74
virtual ~tkspin()
Definition: tkspin_parity.h:58
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
Definition: tklog.cpp:39