7#include "TLegendEntry.h"
14int mn[]={2,8,20,28,50,82};
16Double_t fitfunc(Double_t *x,Double_t *par);
17TLine* get_line(
unsigned int MagicNumber);
18TLatex* get_shell(
unsigned int MagicNumber,
const char* shell);
20void set_style(TGraph* g1, TGraph* g2);
22void draw_differential_binding()
24 gROOT->SetStyle(
"tkn-histo");
26 TGraph* nuc_neqz =
new TGraph;
27 nuc_neqz->SetTitle(
"N = Z");
28 TGraph* nuc_other =
new TGraph;
29 nuc_other->SetTitle(
"N #neq Z");
31 set_style(nuc_neqz, nuc_other);
34 for(
const auto &nuc : dtm.
get_nuclei([&](
auto nuc) {return (nuc->get_z()%2==0 &&
37 dtm.known_nucleus(nuc->get_z()-2, nuc->get_a()-2)&&
38 dtm.known_nucleus(nuc->get_z(), nuc->get_a()-2)&&
39 dtm.known_nucleus(nuc->get_z()-2, nuc->get_a()-4));}))
44 double binding_diff = -0.25*(nuc->get_binding_energy_over_a()*A
45 - dtm.
get_nucleus(Z-2, A-2)->get_binding_energy_over_a()*(A-2)
46 - dtm.
get_nucleus(Z,A-2)->get_binding_energy_over_a()*(A-2)
47 + dtm.
get_nucleus(Z-2,A-4)->get_binding_energy_over_a()*(A-4));
49 if(Z==A-Z) nuc_neqz->AddPoint(Z, binding_diff);
50 else nuc_other->AddPoint(Z, binding_diff);
53 TF1* func =
new TF1(
"fit",fitfunc,2,50,5);
54 func->SetParameters(-8,-4.1,-2,-1.5,-1);
55 func->SetMarkerStyle(1);
56 func->SetMarkerColor(func->GetLineColor());
57 nuc_neqz->Fit(func,
"QN",
"",2,50);
59 TH2* hdum =
new TH2F(
"dum",
"dum",10,2,50,10,-8,0);
60 hdum->GetYaxis()->SetTitle(
"#Delta^{2}B (MeV)");
61 hdum->GetXaxis()->SetTitle(
"Proton Number");
64 for(
auto z: {1,2,3}) get_line(mn[z])->Draw();
66 const char* shells[] = {
"1p",
"2s/1d",
"1f",
"1g,1f,2p"};
67 for(
auto z: {1,2,3,4}) get_shell(mn[z],shells[z-1])->Draw();
75Double_t fitfunc(Double_t *x,Double_t *par)
77 if(x[0]<mn[0]||x[0]>mn[4])
return std::nan(
"1");
79 for(; idx<6; idx++)
if(x[0]<=mn[idx])
break;
80 return (par[idx]-par[idx-1])/(mn[idx]-mn[idx-1])*(x[0]-mn[idx-1]) + par[idx-1];
83TLine* get_line(
unsigned int MagicNumber)
85 TLine *ll =
new TLine(MagicNumber,-8+0.01,MagicNumber,-0.01);
86 ll->SetLineColor(kGray+1);
90TLatex* get_shell(
unsigned int MagicNumber,
const char* shell)
92 TLatex* tex =
new TLatex(MagicNumber-1,-7.5,shell);
93 tex->SetTextAlign(32);
94 tex->SetTextFont(132);
95 tex->SetTextColor(kGray+2);
96 tex->SetTextSize(0.0630252);
103 TLegend *leg =
new TLegend(0.747492,0.432773,0.956522,0.64916,NULL,
"brNDC");
104 leg->SetBorderSize(0);
105 leg->SetTextFont(132);
106 leg->SetLineColor(0);
107 leg->SetLineStyle(0);
108 leg->SetLineWidth(0);
109 leg->SetFillColor(0);
110 leg->SetFillStyle(1001);
112 TLegendEntry *entry = 0;
113 entry=leg->AddEntry(
"",
"N #neq Z",
"lpf");
114 entry->SetFillStyle(1000);
115 entry->SetLineStyle(0);
116 entry->SetLineColor(kWhite);
117 entry->SetLineWidth(0);
118 entry->SetMarkerColor(kAzure-3);
119 entry->SetMarkerStyle(20);
120 entry->SetMarkerSize(1);
121 entry->SetTextFont(132);
123 entry=leg->AddEntry(
"",
"N = Z",
"lpf");
124 entry->SetFillStyle(1000);
125 entry->SetLineStyle(0);
126 entry->SetLineWidth(0);
127 entry->SetLineColor(kWhite);
128 entry->SetMarkerColor(kCyan-2);
129 entry->SetMarkerStyle(21);
130 entry->SetMarkerSize(1.2);
131 entry->SetTextFont(132);
136void set_style(TGraph* g1, TGraph* g2)
138 g1->SetMarkerStyle(21);
139 g1->SetMarkerSize(1.2);
140 g1->SetMarkerColor(kCyan-2);
141 g1->SetLineColor(kWhite);
142 g1->SetTitle(
"N = Z");
144 g2->SetMarkerStyle(20);
145 g2->SetMarkerSize(1);
146 g2->SetMarkerColor(kAzure-3);
147 g2->SetLineColor(kWhite);
148 g2->SetTitle(
"N #neq Z");
Manages the database loading and provides access to the physics properties.
shared_ptr< tknucleus > get_nucleus(const tkstring &_nuc)
return a shared pointer to a nucleus from its name
vector< shared_ptr< tknucleus > > get_nuclei(std::function< bool(shared_ptr< tknucleus >)>const &_selection)
return a vector containing all the known nuclei filtered by the lambda function