-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.cpp
More file actions
51 lines (51 loc) · 1.67 KB
/
base.cpp
File metadata and controls
51 lines (51 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include"potential/eckartPure.h"
#include<root/TCanvas.h>
#include<root/TF1.h>
#include<root/TAxis.h>
#include<boost/format.hpp>
#include<root/TH1.h>
#include<root/TLegend.h>
namespace{
void base(std::string const&Base,double const Factor)
{
auto base{Base=="transmitted"?&EckartPure_::TransmittedWave:&EckartPure_::ReflectedWave};
if(Base=="incident") base=&EckartPure_::IncidentWave;
TF1 graph{"",[&](auto const*variable,auto const){return std::norm(std::invoke(base,Eckart,Eckart.Mass,Factor*Eckart.BarrierHeight,variable[0]));},-Eckart.XInitial(),Eckart.XInitial(),0};
graph.SetNpx(500);
graph.SetLineColor(kBlack);
graph.SetTitle(std::data(Base+" wave ("+boost::str(boost::format("%1%")%Factor)+" barrier height)"));
graph.SetMarkerStyle(5);
using namespace std::literals;
TLegend legend{0.1+(Base=="transmitted"?0.6:0),0.7,0.3+(Base=="transmitted"?0.6:0),0.9};
legend.SetBorderSize(0);
legend.SetFillStyle(0);
legend.AddEntry(graph.DrawClone(std::data("c"s+(Base=="transmitted"?"y+":""))),"numerical","l");
graph.GetXaxis()->SetTitle("position(a.u.)");
graph.GetYaxis()->SetTitle("density");
graph.GetXaxis()->CenterTitle();
graph.GetYaxis()->CenterTitle();
graph.SetNpx(50);
legend.AddEntry(graph.GetHistogram()->DrawClone("p same"),"analytic","p");
legend.DrawClone();
gPad->Print("../base.pdf");
}
}//namespace
void base()
{
TCanvas canvas;
canvas.Print("../base.pdf[");
base("transmitted",1);
base("reflected",1);
base("incident",1);
for(auto const Factor:std::vector<double>{0.001,0.1,0.5,1.5,2,10})
{
base("transmitted",Factor);
base("reflected",Factor);
}
canvas.Print("../base.pdf]");
}
/*void base();
int main()
{
base();
}*/