GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseENSDF.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef GW_BASEENSDF_H
24 #include "BaseENSDF.h"
25 #endif
26 
27 #include <math.h>
28 #include <iostream>
29 #include <sstream>
30 #include <cstring>
31 
32 using namespace std;
33 using namespace Gw;
34 
35 string BaseENSDF::BLANK = " \n";
36 
37 BaseENSDF::DataSetKey::DataSetKey(const DataSetKey &key)
38 {
39  Nuclide = key.Nuclide;
40  Dsid = key.Dsid;
41  Dsref = key.Dsref;
42  Pub = key.Pub;
43  Date = key.Date;
44  Position.first = key.Position.first;
45  Position.second = key.Position.second;
46 
47  CurrentPosition = key.CurrentPosition;
48  }
49 
50 void BaseENSDF::DataSetKey::Clear()
51 {
52  Nuclide = " ";
53  Dsid = " ";
54  Dsref = " ";
55  Pub = " ";
56  Date = " ";
57  Position.first = Position.second = CurrentPosition = 0;
58 }
59 
60 void BaseENSDF::DataSetKey::Print(std::ostream &out) const
61 {
62  out << "Nuclide " << Nuclide << " with id " << Dsid
63  << " at position " << Position.first << " " << Position.second << endl;
64 }
65 
66 BaseENSDF::BaseENSDF()
67 {
68 }
69 
70 BaseENSDF::~BaseENSDF() { Close(); }
71 
72 bool BaseENSDF::IsRecord(const char *r, const char *t) const
73 {
74  string id, type, record; bool ok;
75 
76  ok = false;
77  for (int i = 0; i < RSIZE; i++ ) record += r[i]; // cannot use just record = r ... it doesn't work !
78 
79  id = record.substr(5,4); type = t;
80 
81  if ( type == "IDENT" && (id == " " || id == "1 ") ) {
82  if ( record != BLANK ) ok = true;
83  }
84 
85  if ( type == "Q-VALUE" && id == " Q " ) { ok = true; }
86  if ( type == "LEVEL" && id == " L " ) { ok = true; }
87  if ( type == "BETA" && id == " B " ) { ok = true; }
88  if ( type == "EC" && id == " E " ) { ok = true; }
89  if ( type == "ALPHA" && id == " A " ) { ok = true; }
90  if ( type == "GAMMA" && id == " G " ) { ok = true; }
91 
92  if ( type == "END" && record == BLANK ) { ok = true; }
93  return ok;
94 }
95 
96 string BaseENSDF::Nuclide(const char *r) const
97 {
98  string tmp;
99  for (int i = 0; i < 5; i++ ) tmp += r[i]; return tmp;
100 }
101 string BaseENSDF::Dsid(const char *r) const
102 {
103  string tmp;
104  for (int i = 9; i < 39; i++ ) tmp += r[i]; return tmp;
105 }
106 string BaseENSDF::Dsref(const char *r) const
107 {
108  string tmp;
109  for (int i = 39; i < 65; i++ ) tmp += r[i]; return tmp;
110 }
111 string BaseENSDF::Pub(const char *r) const
112 {
113  string tmp;
114  for (int i = 65; i < 74; i++ ) tmp += r[i]; return tmp;
115 }
116 
117 string BaseENSDF::Date(const char *r) const
118 {
119  string tmp;
120  for (int i = 74; i < 80; i++ ) tmp += r[i]; return tmp;
121 }
122 
123 unsigned int BaseENSDF::IsDataSet(const char *nuclide, const char *datasetid) const
124 {
125  unsigned int which = 0;
126  for ( unsigned int i = 0; i < fDataSets.size(); i++ ) {
127  if ( fDataSets[i].Dsid.find(datasetid) != string::npos
128  && fDataSets[i].Nuclide.find(nuclide) != string::npos ) which = i + 1;
129  }
130  return which;
131 }
132 
133 bool BaseENSDF::NextRecord(unsigned int whichdataset, char *record)
134 {
135  bool ok = true; unsigned int realwhich;
136 
137  Input.clear(); //
138  if ( (0 < whichdataset) && (whichdataset < (fDataSets.size()+1)) ) {
139 
140  realwhich = whichdataset - 1;
141 
142  fDataSets[realwhich].CurrentPosition++;
143  if ( fDataSets[realwhich].CurrentPosition >= fDataSets[realwhich].Position.second )
144  { ok = false; }
145  else {
146  Input.seekg(fDataSets[realwhich].CurrentPosition * RSIZE,ios::beg);
147  // Input.read(record,RSIZE);
148  for (int i = 0; i < RSIZE; i++) Input.get(record[i]);
149  ok = Input.good();
150  }
151  }
152  else { ok = false; }
153 
154  return ok;
155 }
156 
157 bool BaseENSDF::FirstRecord(unsigned int whichdataset, char *record)
158 {
159  bool ok = true; unsigned int realwhich;
160 
161  Input.clear(); //
162  if ( (0 < whichdataset) && (whichdataset < (fDataSets.size()+1)) ) {
163 
164  realwhich = whichdataset - 1;
165 
166  fDataSets[realwhich].CurrentPosition = fDataSets[realwhich].Position.first;
167  Input.seekg(fDataSets[realwhich].CurrentPosition * RSIZE,ios::beg);
168 
169  // Input.read(record,RSIZE);
170  for (int i = 0; i < RSIZE; i++) Input.get(record[i]);
171  ok = Input.good();
172  }
173  else { ok = false; }
174 
175  return ok;
176 }
177 
178 bool BaseENSDF::Open(const char *filename)
179 {
180  DataSetKey tmpkey;
181  char record[RSIZE]; int read_record, read_good_record; bool anew;
182 
183  if ( IsOpen() ) {
184  Close() ;
185  }
186  Input.open(filename);
187 
188  anew = false; read_record = read_good_record = 0;
189  if ( Input.is_open() ) { // the file is open, read it and creat the list of data sets.
190 
191  while( 1 ) { //
192 
193  ::memset(record,'\0',81); std::string aline; getline(Input,aline);
194  if ( !Input && anew == true ) {
195 
196  tmpkey.Position.second = read_record;
197  fDataSets.push_back(tmpkey);
198 
199  tmpkey.Clear();
200  anew = false;
201  break;
202  }
203  //
204  if ( aline.size() != 80 ) {
205  for (size_t i = 0; i < RSIZE; i++)
206  record[i] = BLANK[i];
207  if ( aline.size() )
208  cerr << " NOT a record, break " << aline.size() << endl;
209  }
210  else {
211  for (size_t i = 0; i < aline.size(); i++)
212  record[i] = aline[i];
213  }
214  record[80] = '\n'; read_record++;
215 
216  //cerr << " NEW: " ;
217  // for (int i = 0; i < RSIZE; i++)
218  // cerr << record[i] ;
219 
220  if ( Input ) {
221 
222  if ( IsRecord(record,"IDENT") && anew == false ) {
223 
224  cerr << " A new Record is expected : " << endl;;
225 
226  tmpkey.Nuclide = Nuclide(record);
227  tmpkey.Dsid = Dsid(record);
228  tmpkey.Dsref = Dsref(record);
229  tmpkey.Pub = Pub(record);
230  tmpkey.Date = Date(record);
231  tmpkey.Position.first = tmpkey.CurrentPosition = read_record;
232 
233  tmpkey.Print(cout);
234  anew = true;
235  }
236  if ( IsRecord(record,"END") && anew == true ) {
237 
238  tmpkey.Position.second = read_record; fDataSets.push_back(tmpkey);
239 
240  tmpkey.Clear(); anew = false;
241  }
242  read_good_record++;
243  }
244  else { break; } // something goes wrong during the reading
245  } // while reading
246  } // is_open
247  cout << fDataSets.size() << " datasets have been found in the ENSDF file " << filename << endl;
248 
249  return Input.is_open();
250 
251  /*
252  old version buggy because solarisCC ifstream.read doesn't work properly !!
253 
254  DataSetKey tmpkey;
255  char record[RSIZE]; int nb_record; bool anew;
256 
257  if ( IsOpen() ) { Close() ; }
258 
259  Input.open(filename);
260 
261  anew = false; nb_record = 0;
262  if ( Input.is_open() ) { // the file is open, read it and creat the list of data sets.
263  // read the file and determine the number of identiciation records.
264 
265  Input.seekg(0,ios::beg);
266 
267  while( Input.read(record,RSIZE) ) {
268 
269  if ( IsRecord(record,"IDENT") && anew == false ) {
270 
271  tmpkey.Nuclide = Nuclide(record);
272  tmpkey.Dsid = Dsid(record);
273  tmpkey.Dsref = Dsref(record);
274  tmpkey.Pub = Pub(record);
275  tmpkey.Date = Date(record);
276  tmpkey.Position.first = tmpkey.CurrentPosition = nb_record;
277 
278  anew = true;
279  }
280  if ( IsRecord(record,"END") && anew == true ) {
281 
282  tmpkey.Position.second = nb_record; fDataSets.push_back(tmpkey);
283 
284  tmpkey.Clear();
285  anew = false;
286  }
287  nb_record++;
288  }
289  }
290  cout << fDataSets.size() << " datasets have been found in the ENSDF file " << filename << endl;
291 
292  return Input.is_open(); */
293 }
294 
295 void BaseENSDF::Close()
296 {
297  fDataSets.clear(); Input.close(); Input.clear();
298 }
299 
300 void BaseENSDF::ls(std::ostream &out) const
301 {
302 
303 // out << " Nuclide |" << " Dataset identification |" << " Date | " << "[first,last] line " << " Current Record " << endl;
304  for (unsigned int i = 0; i < fDataSets.size(); i++) {
305  out << fDataSets[i].Nuclide << " "
306  << fDataSets[i].Dsid << " "
307 // << fDataSets[i].Date << ""
308  << "from line " << fDataSets[i].Position.first << " to " << fDataSets[i].Position.second << " Current: "
309  << fDataSets[i].CurrentPosition << endl;
310  }
311 }
312 
313 float BaseENSDF::GetCC(const char *r)
314 {
315  string tmp;
316 
317  tmp = "";
318  for (int i = 55; i < 62; i++ )
319  if ( r[i] != ' ' ) tmp += r[i]; // copy only the interesting part
320 
321  float c;
322  if (tmp.size() > 0 ) { istringstream estring(tmp); estring >> c; }
323  else c = 0.0;
324 
325  return c;
326 }
327 
328 float BaseENSDF::GetDCC(const char *r)
329 {
330  float dvalue, precision; unsigned int i; string tmp1, tmp2;
331 
332  // copy the cc string in tm1 to look for the precision
333  tmp1 = "";
334  for (i = 55; i < 62; i++)
335  if ( r[i] != ' ' ) tmp1 += r[i];
336 
337  if ( tmp1.size() > 0 )
338  precision = GetPrecision(tmp1);
339  else
340  precision = 0.0;
341 
342  // copy the dcc string in tmp2
343  tmp2 = "";
344  for (i = 62; i < 64; i++)
345  if ( r[i] != ' ' ) tmp2 += r[i];
346 
347  if ( tmp2.size() == 0 ||
348  tmp2 == "LT" || tmp2 == "GT" || tmp2 == "LE" ||
349  tmp2 == "GE" || tmp2 == "AP" || tmp2 == "CA" || tmp2 == "SY" ) dvalue = 0;
350  else {
351  istringstream estring(tmp2);
352  estring >> dvalue; dvalue *= precision;
353  }
354  return dvalue;
355 }
356 
357 float BaseENSDF::GetMR(const char *r)
358 {
359  string tmp;
360 
361  tmp = "";
362  for (int i = 41; i < 49; i++ )
363  if ( r[i] != ' ' ) tmp += r[i]; // copy only the interesting part
364 
365  float c;
366  if (tmp.size() > 0 ) { istringstream estring(tmp); estring >> c; }
367  else c = 0.0;
368 
369  return c;
370 }
371 
372 // aym a faire
373 float BaseENSDF::GetDMR(const char *r)
374 {
375  float dvalue, precision; unsigned int i; size_t l; string tmp1, tmp2;
376 
377  // MR to get the precision
378  tmp1 = "";
379  for (i = 41; i < 49; i++ )
380  if ( r[i] != ' ' ) tmp1 += r[i]; // copy only the interesting part
381 
382  if ( tmp1.size() > 0 )
383  precision = GetPrecision(tmp1);
384  else
385  precision = 0.0;
386 
387  tmp2 = "";
388  for (i = 49; i < 55; i++ )
389  if ( r[i] != ' ' ) tmp2 += r[i]; // copy only the interesting part
390 
391  if ( (l = tmp2.find('+', 0 ) ) != string::npos
392  && (l = tmp2.find('-', 0 ) != string::npos ) ) { // aymetric error
393  dvalue = 0.0; //for the moment ..
394  }
395  else {
396  if ( tmp2.size() > 0 ) {
397  istringstream estring(tmp2); estring >> dvalue;
398  }
399  else dvalue = 0.0;
400  }
401  return dvalue*precision;
402 }
403 
404 
405 float BaseENSDF::GetRI(const char *r, std::string &s)
406 {
407  float value; unsigned int i; size_t l; string tmp;
408 
409  // copy the good part string in tmp
410  tmp = "";
411  for (i = 21; i < 29; i++)
412  if ( r[i] != ' ' ) tmp += r[i]; // copy only the interesting part
413 
414  // tentative value
415  if ( (l = tmp.find('(', 0 ) ) != string::npos )
416  { s.insert(s.begin(),'?'); tmp.erase(l,1); }
417  if ( (l = tmp.find(')', 0 ) ) != string::npos )
418  { s.insert(s.begin(),'?'); tmp.erase(l,1); }
419 
420  if ( tmp.size() > 0 ) {
421  istringstream vstring(tmp); vstring >> value;
422  }
423  else value = 0;
424 
425  return value;
426 }
427 
428 float BaseENSDF::GetDRI(const char *r)
429 {
430  float dvalue, precision; unsigned int i; string tmp1, tmp2;
431 
432  // copy the cc string in tm1 to look for the precision
433  tmp1 = "";
434  for (i = 21; i < 29; i++)
435  if ( r[i] != ' ' && r[i] != '(' && r[i] != ')' ) tmp1 += r[i];
436 
437  if ( tmp1.size() > 0 )
438  precision = GetPrecision(tmp1);
439  else
440  precision = 0.0;
441 
442  // copy the dcc string in tmp2
443  tmp2 = "";
444  for (i = 29; i < 31; i++)
445  if ( r[i] != ' ' ) tmp2 += r[i];
446 
447  if ( tmp2.size() == 0 ||
448  tmp2 == "LT" || tmp2 == "GT" || tmp2 == "LE" ||
449  tmp2 == "GE" || tmp2 == "AP" || tmp2 == "CA" || tmp2 == "SY" ) dvalue = 0;
450  else {
451  istringstream estring(tmp2);
452  estring >> dvalue; dvalue *= precision;
453  }
454  return dvalue;
455 }
456 
457 float BaseENSDF::GetTI(const char *r, std::string &s)
458 {
459  float value; unsigned int i; size_t l; string tmp;
460 
461  // copy the good part string in tmp
462  tmp = "";
463  for (i = 64; i < 74; i++)
464  if ( r[i] != ' ' ) tmp += r[i]; // copy only the interesting part
465 
466  // tentative value
467  if ( (l = tmp.find('(', 0 ) ) != string::npos )
468  { s.insert(s.begin(),'?'); tmp.erase(l,1); }
469  if ( (l = tmp.find(')', 0 ) ) != string::npos )
470  { s.insert(s.begin(),'?'); tmp.erase(l,1); }
471 
472  if ( tmp.size() > 0 ) {
473  istringstream vstring(tmp); vstring >> value;
474  }
475  else value = 0;
476 
477  return value;
478 }
479 
480 float BaseENSDF::GetDTI(const char *r)
481 {
482  float dvalue, precision; unsigned int i; string tmp1, tmp2;
483 
484  // copy the cc string in tm1 to look for the precision
485  tmp1 = "";
486  for (i = 64; i < 74; i++)
487  if ( r[i] != ' ' && r[i] != '(' && r[i] != ')' ) tmp1 += r[i];
488 
489  if ( tmp1.size() > 0 )
490  precision = GetPrecision(tmp1);
491  else
492  precision = 0.0;
493 
494  // copy the dcc string in tmp2
495  tmp2 = "";
496  for (i = 74; i < 76; i++)
497  if ( r[i] != ' ' ) tmp2 += r[i];
498 
499  if ( tmp2.size() == 0 ||
500  tmp2 == "LT" || tmp2 == "GT" || tmp2 == "LE" ||
501  tmp2 == "GE" || tmp2 == "AP" || tmp2 == "CA" || tmp2 == "SY" ) dvalue = 0;
502  else {
503  istringstream estring(tmp2);
504  estring >> dvalue; dvalue *= precision;
505  }
506  return dvalue;
507 }
508 
509 float BaseENSDF::GetE(const char *r, std::string &offset)
510 {
511  static char whichoffset[] = "XYZUVWABCDEFGHIJKLMNOPQRST";
512 
513  float energy; unsigned int i; size_t l; string tmp;
514 
515  // copy the E string in tmp
516  tmp = "";
517  for (i = 9; i < 19; i++) tmp += r[i]; // copy only the interesting part
518 
519  offset = " ";
520  // check out if there is an offset
521  for (i = 0; i < 26; i++) {
522  if ( (l = tmp.find(whichoffset[i],0 ) ) != string::npos )
523  { offset.insert(offset.begin(),whichoffset[i]); tmp.erase(l,1); break; }
524  }
525  // check out if it has been deduced or taken from other experiment
526  if ( (l = tmp.find('(', 0 ) ) != string::npos )
527  { offset.insert(offset.begin()+1,'?'); tmp.erase(l,1); }
528  if ( (l = tmp.find(')', 0 ) ) != string::npos )
529  { offset.insert(offset.begin()+1,'?'); tmp.erase(l,1); }
530  // remove + in case of offset
531  if ( (l = tmp.find('+', 0 ) ) != string::npos ) { tmp.erase(l,1); }
532 
533  // to get the energy
534  if ( tmp.size() > 0 ) {
535  istringstream estring(tmp); estring >> energy;
536  // check out if it has been correctly read. if bad returns 0
537  if ( estring.fail() ) energy = 0.0;
538  }
539  else energy = 0.0;
540 
541  return energy;
542 }
543 
544 float BaseENSDF::GetPrecision(std::string st)
545 {
546  float precision = 1.0; int expo; size_t l1,l2;
547 
548  l1 = st.find('.'); l2 = st.find('E'); if ( l2 == string::npos ) l2 = st.find('e');
549  if ( l1 == string::npos ) { // no point
550  if ( l2 == string::npos ) // no exponant
551  precision = 1.0;
552  else { // exponant
553  st.erase(0,l2+1);
554  istringstream out(st); out >> expo; precision = pow(10.0,expo);
555  }
556  } else { // one point
557  if ( l2 == string::npos ) { // no exponant
558  int e = - (st.size() - l1 - 1); precision = pow(10.0,e);
559  }
560  else { // exponant
561  st.erase(0,l2+1);
562  istringstream out(st); out >> expo;
563 
564  int e = - (l2 - l1 - 1) + expo; precision = pow(10.0,e);
565  }
566  }
567  if ( precision < 0 ) precision = -1.0 * precision;
568 
569  return precision;
570 }
571 
572 float BaseENSDF::GetDE(const char *r)
573 {
574  static char whichoffset[] = "XYZUVWABCDEFGHIJKLMNOPQRST";
575 
576  float denergy, precision; unsigned int i; size_t l; string tmp1, tmp2;
577 
578  // copy the E string in tmpe to look for the precision
579  tmp1 = "";
580  for (i = 9; i < 19; i++)
581  if ( r[i] != ' ' ) tmp1 += r[i];
582 
583  // check out if there is an offset
584  for (i = 0; i < 26; i++) {
585  if ( (l = tmp1.find(whichoffset[i],0 ) ) != string::npos )
586  { tmp1.erase(l,1); break; }
587  }
588  // check out if it has been deduced or taken from other experiment
589  if ( (l = tmp1.find('(', 0 ) ) != string::npos )
590  { tmp1.erase(l,1); }
591  if ( (l = tmp1.find(')', 0 ) ) != string::npos )
592  { tmp1.erase(l,1); }
593  // remove + in case of offset
594  if ( (l = tmp1.find('+', 0 ) ) != string::npos ) { tmp1.erase(l,1); }
595 
596  if ( tmp1.size() > 0 )
597  precision = GetPrecision(tmp1);
598  else
599  precision = 0.0;
600 
601  // copy the DE string in tmpde
602  tmp2 = "";
603  for (i = 19; i < 21; i++)
604  if ( r[i] != ' ' ) tmp2 += r[i];
605 
606  if ( tmp2.size() == 0 ||
607  tmp2 == "LT" || tmp2 == "GT" || tmp2 == "LE" ||
608  tmp2 == "GE" || tmp2 == "AP" || tmp2 == "CA" || tmp2 == "SY" ) denergy = 0;
609  else {
610  istringstream estring(tmp2);
611  estring >> denergy; denergy *= precision;
612  }
613  return denergy;
614 }
615 
616 float BaseENSDF::GetT(const char *r, float &unit, std::string &option)
617 {
618  float t; unsigned int i; size_t l; string tmp;
619 
620  t = 0;
621  tmp = "";
622  for (i = 39; i < 49; i++) tmp += r[i];
623 
624  option = "";
625  if ( (l = tmp.find('?', 0 ) ) != string::npos ) { tmp.erase(l,1); option = "?"; }
626 
627  if ( tmp.find("STABLE") != string::npos ) { t = 3.2E23; unit = 1; }
628  else {
629  if ( tmp.find("Y") != string::npos ) { unit = 31622400; }
630  if ( tmp.find("D") != string::npos ) { unit = 86400; }
631  if ( tmp.find("H") != string::npos ) { unit = 3600; }
632  if ( tmp.find("M") != string::npos ) { unit = 60; }
633  if ( tmp.find("S") != string::npos ) { unit = 1; }
634  if ( tmp.find("MS") != string::npos ) { unit = 1E-3; }
635  if ( tmp.find("US") != string::npos ) { unit = 1E-6; }
636  if ( tmp.find("NS") != string::npos ) { unit = 1E-9; }
637  if ( tmp.find("PS") != string::npos ) { unit = 1E-12; }
638  if ( tmp.find("FS") != string::npos ) { unit = 1E-15; }
639  if ( tmp.find("AS") != string::npos ) { unit = 1E-18; }
640 
641  if ( tmp.size() > 0 ) {
642  istringstream tmpstring(tmp);
643  tmpstring >> t; t *= unit;
644  if ( tmpstring.fail() ) { option = "?"; t = 0.0; unit = 0.0; }
645  }
646  else { t = 0.0; unit = 0.0; }
647  }
648 
649  return t;
650 }
651 
652 float BaseENSDF::GetDT(const char *r)
653 {
654  float dt, precision, unit; unsigned int i; size_t l; string tmp1, tmp2;
655 
656  // copy the T string in tmp1 to look for the precision
657  unit = 1; tmp1 = "";
658  if ( BaseENSDF::GetT(r,unit,tmp1) == 3.2E23 ) return 0.0; // stable nucleus
659 
660  tmp1 = "";
661  for (i = 39; i < 49; i++) {
662  if ( r[i] != ' ' ) tmp1 += r[i];
663  }
664  if ( ( l = tmp1.find("MS")) != string::npos ) { tmp1.erase(l,2); }
665  if ( ( l = tmp1.find("US")) != string::npos ) { tmp1.erase(l,2); }
666  if ( ( l = tmp1.find("NS")) != string::npos ) { tmp1.erase(l,2); }
667  if ( ( l = tmp1.find("PS")) != string::npos ) { tmp1.erase(l,2); }
668  if ( ( l = tmp1.find("FS")) != string::npos ) { tmp1.erase(l,2); }
669  if ( ( l = tmp1.find("AS")) != string::npos ) { tmp1.erase(l,2); }
670  if ( ( l = tmp1.find("Y") ) != string::npos ) { tmp1.erase(l,1); }
671  if ( ( l = tmp1.find("D") ) != string::npos ) { tmp1.erase(l,1); }
672  if ( ( l = tmp1.find("H") ) != string::npos ) { tmp1.erase(l,1); }
673  if ( ( l = tmp1.find("M") ) != string::npos ) { tmp1.erase(l,1); }
674  if ( ( l = tmp1.find("S") ) != string::npos ) { tmp1.erase(l,1); }
675 
676  if ( (l = tmp1.find('?', 0 ) ) != string::npos ) { tmp1.erase(l,1); }
677 
678  if ( tmp1.size() > 0 )
679  precision = GetPrecision(tmp1);
680  else
681  precision = 0.0;
682 
683 
684  // copy the DT string in tmp2
685  tmp2 = "";
686  for (i = 49; i < 55; i++)
687  if ( r[i] != ' ' ) tmp2 += r[i];
688 
689  if ( tmp2.size() == 0 ||
690  tmp2 == "LT" || tmp2 == "GT" || tmp2 == "LE" ||
691  tmp2 == "GE" || tmp2 == "AP" || tmp2 == "CA" || tmp2 == "SY" ) dt = 0;
692  else {
693  istringstream estring(tmp2); estring >> dt; dt = dt * precision * unit;
694  }
695  return dt;
696 }
697 
698 string BaseENSDF::GetJPI(const char *r)
699 {
700  string tmp;
701  for (int i = 21; i < 39; i++)
702  if ( r[i] != ' ' ) tmp += r[i];
703 
704  return tmp;
705 }
706 
707 
708 
709 
710 
711 
712 
UInt_t value[MaxValue]
Definition: ReadDaqAlone.C:29
friend LogMessage & clear(LogMessage &)
others
void Print(std::ostream &) const
Definition: BaseENSDF.cpp:60
base classe to interface ENSDF (Evaluated Nuclear Structure Data File)
ADF::LogMessage & endl(ADF::LogMessage &log)
std::pair< int, int > Position
Definition: BaseENSDF.h:71