读取He4在Si中能损文件(Lise++计算得到)

In [1]:
%jsroot on
In [2]:
ifstream in_he4("He4elossinSi.txt");
string ss_he4;
double a_he4, b_he4, e_he4, dedx_he4;
auto *g_he4 = new TGraph;
TCanvas c_he4;
if(!in_he4.is_open())
{
    cout<<"Data File about He4 does noet exist!"<<endl;
    return 0;
}
getline(in_he4,ss_he4);
int i_he4=0;
while(!in_he4.eof())
{
    in_he4>>a_he4>>b_he4>>e_he4>>dedx_he4>>a_he4>>b_he4>>a_he4>>b_he4>>a_he4>>b_he4>>a_he4>>b_he4;
   
    if(e_he4*4>=0&&e_he4*4<=200)
    {
         //g_he4->SetPoint(i_he4,e_he4*4,dedx_he4*1000);//number,MeV,MeV/mm
        g_he4->SetPoint(i_he4,e_he4,dedx_he4*1000);//number,MeV/u,MeV/mm
    }
    i_he4++;
}
g_he4->SetTitle("dE/dx (Mev/mm) vs. MeV/u for He4 in Silicon");
g_he4->SetLineColor(kGreen);
g_he4->Draw();
gPad->SetLogy();
gPad->SetLogx();
c_he4.Draw();
in_he4.close();

读取He6在Si中能损文件(Lise++计算得到)

In [3]:
//%jsroot on //
ifstream in_he6("He6elossinSi.txt");
string ss_he6;
double a_he6, b_he6, e_he6, dedx_he6;
auto *g_he6 = new TGraph;
TCanvas c_he6;
if(!in_he6.is_open())
{
    cout<<"Data File about He6 does noet exist!"<<endl;
    return 0;
}
getline(in_he6,ss_he6);
int i_he6=0;
while(!in_he6.eof())
{
    in_he6>>a_he6>>b_he6>>e_he6>>dedx_he6>>a_he6>>b_he6>>a_he6>>b_he6>>a_he6>>b_he6>>a_he6>>b_he6;
    if(e_he6*6>=0&&e_he6*6<=200)
    {
    //g_he6->SetPoint(i_he6,e_he6*6,dedx_he6*1000);//number,MeV,MeV/mm
    g_he6->SetPoint(i_he6,e_he6,dedx_he6*1000);//number,MeV/u,MeV/mm    
    }
    i_he6++;
}
g_he6->SetTitle("dE/dx (Mev/mm) vs. MeV/u for He6 in Silicon");
g_he6->SetLineColor(kRed);
g_he6->Draw();
gPad->SetLogy();
gPad->SetLogx();
c_he6.Draw();
in_he6.close();

读取He8在Si中能损文件(Lise++计算得到)

In [4]:
ifstream in_he8("He8elossinSi.txt");
string ss_he8;
double a_he8, b_he8, e_he8, dedx_he8;
auto *g_he8 = new TGraph;
TCanvas c_he8;
if(!in_he8.is_open())
{
    cout<<"Data File about He8 does noet exist!"<<endl;
    return 0;
}
getline(in_he8,ss_he8);
int i_he8=0;
while(!in_he8.eof())
{
    in_he8>>a_he8>>b_he8>>e_he8>>dedx_he8>>a_he8>>b_he8>>a_he8>>b_he8>>a_he8>>b_he8>>a_he8>>b_he8;
    if(e_he8*8>=0&&e_he8*8<=200)
    {
    //g_he8->SetPoint(i_he8,e_he8*8,dedx_he8*1000);//number,MeV,MeV/mm
    g_he8->SetPoint(i_he8,e_he8,dedx_he8*1000);//number,MeV/u,MeV/mm
    }
    i_he8++;
}
g_he8->SetTitle("dE/dx (Mev/mm) vs. MeV/u for He8 in Silicon");
g_he8->SetLineColor(kBlue);
g_he8->Draw();
gPad->SetLogy();
gPad->SetLogx();
c_he8.Draw();
in_he8.close();

叠图比较

In [5]:
//%jsroot on
TCanvas c_t;
g_he4->SetTitle("dE/dx (Mev/mm) vs. MeV/u for He4,6,8 in Silicon");
g_he4->Draw();//how to use commond of SetXRange(0,200);
g_he4->GetXaxis()->SetRangeUser(0,100);
g_he4->GetXaxis()->SetTitle("E/A (MeV/u)");
g_he4->GetYaxis()->SetRangeUser(1,1000);
g_he4->GetYaxis()->SetTitle("dE/dx (MeV/mm)");
g_he6->Draw("same");
g_he8->Draw("same");
gPad->SetLogy();
gPad->SetLogx();
c_t.Draw();
In [6]:
!jupyter nbconvert 1.checkdedxvsA.ipynb --to html
[NbConvertApp] Converting notebook 1.checkdedxvsA.ipynb to html

[NbConvertApp] Writing 337723 bytes to 1.checkdedxvsA.html