GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NuclearLevel.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_NuclearLevel
24 #include "NuclearLevel.h"
25 #endif
26 
27 #include <iostream>
28 #include <iomanip>
29 
30 using namespace std;
31 using namespace Gw;
32 
34 
35 //__________________________________________________________
36 NuclearLevel::NuclearLevel(): Level()
37 {
38 }
39 
40 //__________________________________________________________
42 {
43 
44 }
45 
46 //__________________________________________________________
48 {
49  const char* p = fParity.IsParity(Parity::kPlus) ? "+" : "-";
50  return Form("%s%s",fSpin.GetString(), p);
51 }
52 
53 //__________________________________________________________
54 void NuclearLevel::SetLabels(const char *l0, const char *l1, const char *l2, const char *l3)
55 {
56  TString spin(GetLabel0());
57 
58  if ( spin.Contains("+") ) {
60  spin.Remove(spin.First("+"), 1);
61  } else if ( spin.Contains("-") ) {
63  spin.Remove(spin.First("-"), 1);
64  } else
65  fParity.Set(l1);
66 
67  fSpin.Set(l0);
68  fT.Set(l2);
69  fEnergy.Set(l3);
70 
71  Int_t pos;
72  TString tau(l2);
73  pos = tau.Last(' ');
74  tau[pos] = '\0';
75 
76  TString en(l3);
77  pos = en.Last(' ');
78  en[pos] = '\0';
79 
80  Level::SetLabels(l0, l1, tau.Data(), en.Data());
81 }
82 
83 
84 
85 //__________________________________________________________
86 void NuclearLevel::ls(Option_t* o) const
87 {
88 
89  TString opt = o; string sep1, sep2;
90 
91  if ( opt.Contains("header") ) std::cout<< " Level energy (keV), \t spin (hbar), \t parity, \t half-life (s)" << std::endl;
92 
93  sep1 = sep2 = "";
94  if ( fEnergy.IsData(InfoData::kTentative) ) { sep1 = '('; sep2 = ')'; }
95  if ( fEnergy.IsData(InfoData::kTheo) ) { sep1 = '['; sep2 = ']'; }
96  if ( fEnergy.IsData(InfoData::kAbout) ) { sep1 = '~'; sep2 = ""; }
97 
98  if ( fEnergy.GetValue() == 0 )
99  cout << sep1 << "GROUND STATE" << sep2 << "\t\t" << fSpin << "\t" << fParity ;
100  else
101  cout << sep1 << fEnergy.GetValue() << " <" << fEnergy.GetError() << ">" << sep2 << "\t\t"
102  << fSpin << "\t" << fParity ;
103 
104  if ( fT.GetValue() != 0 ) {
105  sep1 = sep2 = "";
106  if ( fT.IsData(InfoData::kTentative) ) { sep1 = '('; sep2 = ')'; }
107  if ( fT.IsData(InfoData::kTheo) ) { sep1 = '['; sep2 = ']'; }
108  if ( fT.IsData(InfoData::kAbout) ) { sep1 = '~'; sep2 = ""; }
109  cout << "\t" << sep1 << fT.GetValue() << " <" << fT.GetError() << ">" << sep2 << endl;
110  }
111  else cout << endl;
112 
113  if ( gDebug > 0 ) TLine::ls(o);
114 }
115 
116 //void NuclearLevel::Set(Double_t Energy, Double_t errEnergy){
117 
118  //printf("Energy = %f ; error = %f \n",Energy,errEnergy);
119 // fE = Energy; fErrE = errEnergy;
120 //}
121 
122 /*
123 void NuclearLevel::Print() const {
124  printf("Energy = %f \n",fE);
125  printf("Error = %f \n",fdE);
126 }
127 
128 void NuclearLevel::SetEnergyBebert(Double_t E, Double_t dE) {
129  fE = E;
130  fdE = dE;
131 }
132 
133 Double_t NuclearLevel::GetEnergyBebert() {
134  return fE;
135 }
136 */
137 
138 
virtual Data_T GetError() const
return the error on the measured value
Definition: Measure.h:109
virtual void Set(Data_T data)
set the measure and its error (default err=0)
Definition: Measure.h:66
virtual bool IsData(UShort_t) const
to get some information about this data
Definition: InfoData.h:82
void Set(Int_t n, Int_t d=1)
To set the spin.
Definition: Spin.cpp:124
header file for a NuclearLevel
A nuclear level.
Definition: NuclearLevel.h:66
virtual void ls(Option_t *option="") const
ClassImp(NuclearLevel)
Measure< Float_t > fEnergy
Definition: NuclearLevel.h:71
Measure< Float_t > fT
Definition: NuclearLevel.h:72
const Char_t * GetString() const
To get the spin as a string.
Definition: Spin.cpp:55
bool IsParity(Parity::EParity) const
Definition: Parity.h:78
void Set(Parity::EParity)
Definition: Parity.h:77
virtual void SetLabels(const char *l0, const char *l1, const char *l2, const char *l3)
set label titles
Definition: Level.cpp:224
ADF::LogMessage & endl(ADF::LogMessage &log)
virtual ~NuclearLevel()
virtual void SetLabels(const char *l0, const char *l1, const char *l2, const char *l3)
set labels and modify the attributes of this nuclear level
const char * GetLabel0()
overload function for specified used in this class.
Data_T GetValue() const
get the value, cannot be overloaded
Definition: Data.h:114
Base class describing a general level.
Definition: Level.h:53