1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-29 21:48:51 -05:00
catima/examples/dedx.cpp

33 lines
833 B
C++
Raw Normal View History

2018-01-29 07:38:54 -05:00
#include "catima/catima.h"
#include <iostream>
using std::cout;
using std::endl;
2019-10-08 13:50:45 -04:00
int main(){
2018-01-29 07:38:54 -05:00
catima::Material water({ // material with 2 atoms
{1,1,2}, // 1H - two atoms
{16,8,1} // 16O - 1 atom
});
water.density(1.0).thickness(2.0);
2019-10-08 13:50:45 -04:00
2018-01-29 07:38:54 -05:00
catima::Material water2({ // material with 2 atoms
{1,1,2}, // 1H - two atoms
{16,8,1} // 16O - 1 atom
2019-10-08 13:50:45 -04:00
}, 1.0,78.); // density and custom ionization potential
2018-01-29 07:38:54 -05:00
water2.thickness(2.0);
2019-10-08 13:50:45 -04:00
2018-01-29 07:38:54 -05:00
catima::Projectile p(12,6); // define projectile, ie 12C
2019-10-08 13:50:45 -04:00
2018-01-29 07:38:54 -05:00
cout<<"C->H2O\n";
for(double T=0; T<11000;T+=50){
auto result = catima::calculate(p,water,T/12);
auto result2 = catima::calculate(p,water2,T/12);
cout<<"T = "<<T<<" MeV, dEdx1 = "<<result.dEdxi<<", dEdx2 = "<<result2.dEdxi<<" MeV/g/cm2"<<endl;
}
return 0;
}