TkN 2.4
Toolkit for Nuclei
Loading...
Searching...
No Matches
tkensdf_record.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
40
41#ifndef tkensdf_record_H
42#define tkensdf_record_H
43
44#include <iostream>
45
46#include "tkdb_table.h"
47#include "tkstring.h"
48
49namespace tkn {
50
52
53public:
54
56
57 static const int RSIZE = 81; // a record size is 81 bytes (80 data + \n)
58 static std::string BLANK;
59
61
62protected:
63
66
67 tkstring frecord = "";
68 tkstring fid = "";
69
70 record_type ftype = kunknown;
71 bool f_is_continuation_record = false;
72
73 tkstring fcontinuation_record = "";
74 tkstring fcomment_record = "";
75
76 tkstring fUncertain_record = "";
77
78 bool fisknown_woth_offset = false;
79 tkstring fOffset="";
80
81public:
82
85
87 virtual bool set_record(const tkstring &_record);
88
90 virtual void analyse_record() {;}
91
93 virtual void add_continuation_record(const tkstring &_continuation_record);
94
96 virtual tkstring get_continuation_record() { return fcontinuation_record;}
97
99 virtual void analyse_continuation_record() {;}
100
102 virtual void add_comment_record(const tkstring &_comment_record, bool _is_continuation=false);
103
105 virtual const tkstring &get_comment_record() const { return fcomment_record;}
106
108 virtual void analyse_comment_record() {;}
109
111 void check_record_type();
112
114 const tkstring &get_record() {return frecord;}
115
117 record_type get_record_type() {return ftype;}
118
120 bool is_continuation_record() {return f_is_continuation_record;}
121
123 bool is_comment() {return (ftype==kcomment);}
124
126 tkstring get_energy_str(const tkstring &_record) const {return _record.substr(9,12);}
127
129 tkstring get_lifetime_str(const tkstring &_record) const {return _record.substr(39,16);}
130
132 tkstring get_lifetime_metastable_str(const tkstring &_record) const {return _record.substr(77,2);}
133
135 bool decode_energy(const tkstring &_st);
136
138 bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms);
139
141 bool is_uncertain() const {return !fUncertain_record.is_empty();}
142
144 const tkstring &get_uncertain_record() const {return fUncertain_record;}
145
147 void set_offset(tkstring _offset) {fisknown_woth_offset=true; fOffset=_offset;}
148
150 bool is_energy_offset() {return fisknown_woth_offset;}
151
153 tkstring get_energy_offset() { return fOffset;}
154
155
156 virtual void clear();
157 virtual void print(std::ostream &) const;
158
159// const double &get_energy() const {return fenergy;}
160// const double &get_energy_error() const {return fenergy_error;}
161// const int &get_energy_precision() const {return fenergy_precision;}
162
163 const tkdb_table::measure_data_struct &get_lifetime() const {return flifetime;}
164 const tkdb_table::measure_data_struct &get_energy() const {return fenergy;}
165
166};
167
168
169}
170
171#endif
bool is_uncertain() const
check if the record is uncertain
bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms)
decode a lifetime record
bool decode_energy(const tkstring &_st)
decode an anergy record
const tkstring & get_uncertain_record() const
get the record uncertain type
virtual void analyse_record()
analyse the record content, to be re implemented in all daughter classes
tkstring get_lifetime_metastable_str(const tkstring &_record) const
extract the lifetime part
static std::string BLANK
void check_record_type()
check record type from its string
const tkstring & get_record()
get record
virtual void print(std::ostream &) const
virtual void add_comment_record(const tkstring &_comment_record, bool _is_continuation=false)
add a continuation record from a string
bool is_energy_offset()
to now if the energy is given with an offset
tkstring get_energy_str(const tkstring &_record) const
extract the energy part
virtual bool set_record(const tkstring &_record)
define the record from a string. Option false only checks if the record is an identification record
bool is_continuation_record()
to now if the record is a continuation record or not
virtual const tkstring & get_comment_record() const
get the continuation record
tkstring get_lifetime_str(const tkstring &_record) const
extract the lifetime part
const tkdb_table::measure_data_struct & get_energy() const
virtual void analyse_continuation_record()
analyse the continuation record
virtual void analyse_comment_record()
analyse the continuation record
const tkdb_table::measure_data_struct & get_lifetime() const
tkstring get_energy_offset()
get_energy_offset
virtual void add_continuation_record(const tkstring &_continuation_record)
add a continuation record from a string
record_type get_record_type()
get record type
static const int RSIZE
virtual tkstring get_continuation_record()
get the continuation record
void set_offset(tkstring _offset)
set_energy_offset
bool is_comment()
to now if the record is a comment
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:31
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
Definition tkstring.h:156
Definition tklog.cpp:16
data structure used to fill a tkmeasure object from the sqlite database
Definition tkdb_table.h:49