4 #include "KVLevelScheme.h"
5 #include "KVExcitedState.h"
13 #include "tknucleus.h"
38 fCompNuc->SetExcitEnergy(0);
44 fFuncErel->SetNpx(5000);
57 if (fFunc)
delete fFunc;
69 tknucleus nuc(fCompNuc->GetSymbol());
70 auto levels = nuc.get_level_scheme()->get_levels();
71 for(
auto &lev : levels)
74 ll->
set(lev->get_energy(),
75 lev->is_stable() ? 0 : lev->get_lifetime(tkunit_manager::units_keys::keV),
76 lev->get_spin_parity()->get_spin().get_value(), lev->get_spin_parity()->get_parity().get_value());
88 cout <<
" n." <<
" Jpi" <<
" E" <<
" T1/2" << endl;
90 for (
Int_t ii = (
int)fLevels.GetSize() - 1; ii >= 0; ii--) {
92 cout <<
Form(
"%3d", ii) <<
".";
96 cout <<
" " <<
Form(
"%5s", fCompNuc->GetSymbol()) << endl;
104 double KVLevelScheme::func(
double xx,
double tt)
107 for (
Int_t ii = 0; ii < fLevels.GetSize(); ii++) {
119 double KVLevelScheme::getWidth(
double gam,
TString unit)
122 if (unit.
EqualTo(
"EV")) gam *= 1
e-3;
123 else if (unit.
EqualTo(
"KEV")) gam *= 1;
124 else if (unit.
EqualTo(
"MEV")) gam *= 1e3;
125 else if (unit.
Contains(
"S")) gam *= 1
e-6;
133 int KVLevelScheme::getJ(
TString jpi)
141 if (jpi.
EqualTo(
"GE"))
return 0;
158 if (il > (
int)fLevels.GetSize())
return 0;
168 if (il > (
int)fLevels.GetSize())
return 0;
178 if (il > (
int)fLevels.GetSize())
return 0;
188 if (il > (
int)fLevels.GetSize())
return 0;
198 if (il > (
int)fLevels.GetSize())
return "";
207 if (il > (
int)fLevels.GetSize())
return 0;
218 int KVLevelScheme::getPI(
TString jpi)
227 if (jpi.
EqualTo(
"GE"))
return 0;
234 else if (jpi.
Contains(
"-")) pi = -1;
260 return func(xx - fQvalue * 1000,
tt);
274 double e1 = (m2 / (m1 + m2)) * erel;
275 double e2 = (m1 / (m1 + m2)) * erel;
311 GetParticlesFromErel(nuc1, nuc2, erel + qq, randAngle, vsrc);
320 if (!fLevels.GetSize()) cout <<
"KVLevelScheme::GetRandomParticles: please initialize the level scheme firts..." << endl;
321 fFunc->SetParameter(0,
T);
322 double excit = fFunc->GetRandom();
324 GetParticlesFromExci(n1, n2, excit, randAngle, vsrc);
349 for (
int ic = 0; ic < 20; ic++) cols[ic] = 0;
350 cols[0] = GetLevelEnergy(0);
352 for (
int ii = 0; ii < GetNLevels(); ii++) {
353 for (
int ic = 0; ic <
TMath::Max(ii, 20); ic++) {
354 if ((GetLevelEnergy(ii) - cols[ic] > dy)) {
355 cols[ic] = GetLevelEnergy(ii);
357 if (icol + 1 > ncol) ncol = icol + 1;
363 double max = GetLevelEnergy(GetNLevels() - 1);
365 hh =
new TH2F(
Form(
"dumhist%s", fCompNuc->GetSymbol()),
"", 1, 0, ncol * dx + 0.5 * dx, 1000, -200,
max + 200);
371 cc =
new TCanvas(
Form(
"levels%s", fCompNuc->GetSymbol()),
Form(
"levels%s", fCompNuc->GetSymbol()), (ncol) * (dx) * 0.4 * 400, 800);
374 cc->SetTopMargin(0.02);
375 cc->SetBottomMargin(0.02);
376 cc->SetRightMargin(0.02);
377 cc->SetLeftMargin(0.02);
379 hh->GetXaxis()->SetAxisColor(0);
380 hh->GetYaxis()->SetAxisColor(0);
382 hh->GetXaxis()->SetLabelSize(0);
383 hh->GetYaxis()->SetNdivisions(0);
388 for (
int ic = 0; ic < 20; ic++) cols[ic] = 0;
389 cols[0] = GetLevelEnergy(0);
392 for (
int ii = 0; ii < GetNLevels(); ii++) {
393 for (
int ic = 0; ic <
TMath::Max(ii, 20); ic++) {
394 if ((GetLevelEnergy(ii) - cols[ic] > dy)) {
395 cols[ic] = GetLevelEnergy(ii);
401 TLine* ll =
new TLine(0.5 + dx * icol, GetLevelEnergy(ii), ddx + .5 + dx * icol, GetLevelEnergy(ii));
412 tex =
new TLatex(ddx + .6 + dx * icol, GetLevelEnergy(ii),
Form(
"%d",
TMath::Nint(GetLevelEnergy(ii))));
419 TLatex* tte =
new TLatex(0.5, 0.95,
Form(
"^{%d}%s", fCompNuc->GetA(), fCompNuc->GetSymbol(
"EL")));
426 hh->GetXaxis()->SetLimits(0, dx * (ncol + 0.5));
446 tte =
new TLatex(0.5 + (0.5 * ddx) + dx * (ncol - 1), qa * 1000 - 100, decay.
Data());
454 lq =
new TLine(0.5, qa * 1000, 0.5 + dx * (ncol - 1), qa * 1000);
460 lq =
new TLine(0.5 + dx * (ncol - 1), qa * 1000, 0.5 + ddx + dx * (ncol - 1), qa * 1000);
470 a.SetExcitEnergy(
ex / 1000.);
475 lq =
new TLine(0.5, qa * 1000, 0.5 + dx * (ncol - 1), qa * 1000);
481 lq =
new TLine(0.5 + dx * (ncol - 1), qa * 1000, 0.5 + ddx + dx * (ncol - 1), qa * 1000);
489 cc->SetWindowSize((ncol) * (dx) * 0.35 * 400, 800);
490 hh->GetXaxis()->SetLimits(0, dx * (ncol + 0.5));
499 if (!strcmp(outnuc,
"")) outnuc =
"1H";
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Excited state of atomic nucleus.
void set(Double_t ee, Double_t ww, Double_t jj, Int_t pi)
Double_t eval(Double_t excit)
Tool to simulate nucleus multi-particle decay.
Int_t GetLevelParity(int il)
double EvaluateErel(double *x, double *p)
void SetDrawStyle(double deMin=300., double fullWidth=1.3, double lineWidth=0.6, int textSize=22)
const char * GetEGammaStr(int il)
void DrawThreshold(const char *symb, Option_t *option="", double ex=0.)
double GetThreshold(const char *outnuc="")
static void GetParticlesFromExci(KVNucleus *n1, KVNucleus *n2, double erel, bool randAngle=0, TVector3 *vsrc=0)
virtual ~KVLevelScheme()
Destructor.
static void GetParticlesFromErel(KVNucleus *n1, KVNucleus *n2, double erel, bool randAngle=0, TVector3 *vsrc=0)
Double_t GetLevelEnergy(int il)
Int_t GetLevelSpin(int il)
void ReadLevels()
Add all known levels for current isotope to internal list.
void SetDecayProduct(KVNucleus *nuc, double excit_energy=0)
void Draw(Option_t *option="")
double Evaluate(double *x, double *p)
const char * GetJPiStr(int il)
void GetRandomParticles(KVNucleus *n1, KVNucleus *n2, double T, bool randAngle=0, TVector3 *vsrc=0)
Double_t GetLevelWidth(int il)
Description of properties and kinematics of atomic nuclei.
const Char_t * GetSymbol(Option_t *opt="") const
void SetExcitEnergy(Double_t e)
Double_t GetExcitEnergy() const
Int_t GetZ() const
Return the number of proton / atomic number.
void SetTheta(Double_t theta)
void SetVelocity(const TVector3 &)
Set velocity of particle (in cm/ns units)
void SetKE(Double_t ecin)
void SetFrame(const Char_t *frame, const KVFrameTransform &)
KVParticle const * GetFrame(const Char_t *frame, Bool_t warn_and_return_null_if_unknown=kTRUE) const
TVector3 GetVelocity() const
returns velocity vector in cm/ns units
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void RemoveAllExtraWhiteSpace()
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextFont(Font_t tfont=62)
virtual void SetTextSize(Float_t tsize=1)
virtual void Draw(Option_t *option="")
TRotation & SetXEulerAngles(Double_t phi, Double_t theta, Double_t psi)
const char * Data() const
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) 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
void SetOptStat(Int_t stat=1)
virtual void SetNDC(Bool_t isNDC=kTRUE)
double max(double x, double y)
Double_t Max(Double_t a, Double_t b)