KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVExcitedState.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Mar 2 10:50:41 2017
2 //Author: Diego Gruyer
3 
4 #include "KVExcitedState.h"
5 #include "TMath.h"
6 #include "TF1.h"
7 #include "Riostream.h"
8 using namespace std;
9 
11 
12 
13 
17 {
18  // Default constructor
19 }
20 
21 
22 
23 
26 
28 {
29  // Destructor
30 }
31 
32 
33 
34 
36 
38 {
39  cout << Form("%15s", fJPi.Data()) << " _____ "
40  << Form("%5d", TMath::Nint(fEnergy)) << " keV"
41  << Form("%15s", fGamma.Data())
42  << endl;
43 }
44 
45 
46 
48 
50 {
51  fEnergy = ee;
52  fWidth = ww;
53  if (jj - TMath::Nint(jj) > 0.1) {
54  fSpin = TMath::Nint(jj * 2);
55  fIsOdd = kTRUE;
56  }
57  else {
58  fSpin = TMath::Nint(jj);
59  fIsOdd = kFALSE;
60  }
61  fParity = pi;
62  fJPi = Form("%d%s", fSpin, ((fParity > 0) ? "+" : "-"));
63  fGamma = Form("%.2lf keV", ww);
64 }
65 
66 
67 
68 
70 
71 void KVExcitedState::set(Double_t ee, const char* jpi, const char* t12)
72 {
73  fEnergy = ee;
74  fJPi = jpi;
75  fGamma = t12;
76  computeParity();
77  computeSpin();
78  computeWidth();
79 }
80 
81 
82 
84 
86 {
87  TString jpi = fJPi.Data();
88  jpi.ReplaceAll("(", "");
89  jpi.ReplaceAll(")", "");
90  if (jpi.EqualTo("") || jpi.Contains("GE")) {
91  fParity = 1;
92  return;
93  }
94  if ((jpi.Contains("-")) && (jpi.Contains("+"))) {
95  if (jpi.Index("+") < jpi.Index("-")) fParity = 1;
96  else fParity = -1;
97  }
98  else if (jpi.Contains("-")) fParity = -1;
99  else fParity = 1;
100 }
101 
102 
103 
105 
107 {
108  TString jpi = fJPi.Data();
109  jpi.ReplaceAll("(", "");
110  jpi.ReplaceAll(")", "");
111  if (jpi.EqualTo("") || jpi.Contains("GE")) {
112  fSpin = 0;
113  fIsOdd = kFALSE;
114  return;
115  }
116  if (jpi.Contains("-")) jpi = jpi(0, jpi.Index("-"));
117  if (jpi.Contains("+")) jpi = jpi(0, jpi.Index("+"));
118  if (jpi.Contains("/2")) {
119  jpi = jpi(0, jpi.Index("/"));
120  fIsOdd = kTRUE;
121  }
122  else {
123  fIsOdd = kFALSE;
124  }
125  if (jpi.Contains(",")) jpi = jpi(0, jpi.Index(","));
126  fSpin = jpi.Atoi();
127 }
128 
129 
130 
132 
134 {
135  Double_t gam;
136 // Double_t dgam;
137  TString ugam;
138 
139  gam = -1;
140 // dgam = -1;
141  ugam = "";
142 
143  KVString tmp = fGamma;
145  int np = tmp.GetNValues(" ");
146  tmp.Begin(" ");
147 
148  if (np >= 1) gam = tmp.Next().Atof();
149  if (np >= 2) ugam = tmp.Next().Data();
150 // if (np >= 3) dgam = tmp.Next().Atof();
151 
152  fWidth = gam;
153 
154  ugam.ToUpper();
155  if (ugam.EqualTo("EV")) fWidth *= 1e-3;
156  else if (ugam.EqualTo("KEV")) fWidth *= 1;
157  else if (ugam.EqualTo("MEV")) fWidth *= 1e3;
158  else if (ugam.Contains("S")) fWidth *= 1e-6;
159 
160  ugam.ToLower();
161  ugam.ReplaceAll("v", "V");
162  if (!ugam.Contains("s")) ugam.ReplaceAll("m", "M");
163 
164 
165  if (gam == 0.) fGamma = Form("%.1f %3s", gam, ugam.Data());
166  else fGamma = Form("%.1f %3s", gam, ugam.Data());
167 }
168 
169 
170 
172 
174 {
175  double xx = excit;
176  double JJ = fSpin;
177  if (fIsOdd) JJ *= 0.5;
178  double yy = (2.*JJ + 1.) * fWidth / ((xx - fEnergy) * (xx - fEnergy) + 0.25 * fWidth * fWidth);
179  return 0.5 * yy / TMath::Pi();
180 }
181 
182 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define e(i)
const Bool_t kFALSE
double Double_t
const Bool_t kTRUE
char * Form(const char *fmt,...)
Excited state of atomic nucleus.
void set(Double_t ee, Double_t ww, Double_t jj, Int_t pi)
virtual ~KVExcitedState()
Destructor.
Double_t eval(Double_t excit)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
void Begin(TString delim) const
Definition: KVString.cpp:562
void RemoveAllExtraWhiteSpace()
Definition: KVString.cpp:1226
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:675
Int_t GetNValues(TString delim) const
Definition: KVString.cpp:859
void ToLower()
Int_t Atoi() const
Double_t Atof() const
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
void ToUpper()
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Int_t Nint(T x)
constexpr Double_t Pi()