IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 5845823f authored by Felix Riehn's avatar Felix Riehn
Browse files

added injection of primary particle with zentith and azimuth angle, fixed rotation in azimuth

parent 112eb225
No related branches found
No related tags found
1 merge request!42Resolve "missing rotation between corsika stack and sibyll stack"
...@@ -226,12 +226,22 @@ int main() { ...@@ -226,12 +226,22 @@ int main() {
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
stack.Clear(); stack.Clear();
const hep::EnergyType E0 = 100_GeV; const hep::EnergyType E0 = 1000_GeV;
double theta = 45.;
double phi = 20.;
{ {
auto particle = stack.NewParticle(); auto particle = stack.NewParticle();
particle.SetPID(Code::Proton); particle.SetPID(Code::Proton);
hep::MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV); hep::MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV);
auto plab = stack::super_stupid::MomentumVector(rootCS, 0_GeV, 0_GeV, -P0); auto momentumComponents = [](double theta, double phi, MomentumType&ptot)
{
return std::make_tuple( ptot*sin(theta)*cos(phi), ptot*sin(theta)*sin(phi), ptot*cos(theta) );
};
auto const [px, py, pz] = momentumComponents( theta / 180.* M_PI, phi / 180.* M_PI, P0);
// auto plab = stack::super_stupid::MomentumVector(rootCS, 0_GeV, 0_GeV, -P0);
auto plab = stack::super_stupid::MomentumVector(rootCS, {px, py, pz});
cout << "input angles: theta=" << theta << " phi=" << phi << endl;
cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl;
particle.SetEnergy(E0); particle.SetEnergy(E0);
particle.SetMomentum(plab); particle.SetMomentum(plab);
particle.SetTime(0_ns); particle.SetTime(0_ns);
......
...@@ -135,14 +135,23 @@ namespace corsika::process::sibyll { ...@@ -135,14 +135,23 @@ namespace corsika::process::sibyll {
// sibyll CS has z along particle momentum // sibyll CS has z along particle momentum
// FOR NOW: hard coded z-axis for corsika frame // FOR NOW: hard coded z-axis for corsika frame
QuantityVector<length_d> const zAxis{0_m, 0_m, 1_m}; QuantityVector<length_d> const zAxis{0_m, 0_m, 1_m};
QuantityVector<length_d> const xAxis{1_m, 0_m, 0_m}; QuantityVector<length_d> const yAxis{0_m, 1_m, 0_m};
auto pt = []( MomentumVector p ){ auto rotation_angles = [](MomentumVector const &pin)
return sqrt(p.GetComponents()[0] * p.GetComponents()[0] + p.GetComponents()[1] * p.GetComponents()[1]); {
}; const auto p = pin.GetComponents();
double theta = acos( p.GetMomentum().GetComponents()[2] / p.GetMomentum().norm()); const auto th = acos( p[2] / p.norm() );
cout << "ProcessSibyll: polar angle between sibyllCS and rootCS: " << theta << endl; const auto ph = atan2( p[1]/1_GeV, p[0]/1_GeV );//acos( p[0] / sqrt(p[0]*p[0]+p[1]*p[1] ) );
double phi = asin( p.GetMomentum().GetComponents()[0]/pt(p.GetMomentum() ) ); return std::make_tuple(th, ph);
CoordinateSystem sibyllCS = rootCS.rotate(xAxis, theta); };
// auto pt = []( MomentumVector &p ){
// return sqrt(p.GetComponents()[0] * p.GetComponents()[0] + p.GetComponents()[1] * p.GetComponents()[1]);
// };
// double theta = acos( p.GetMomentum().GetComponents()[2] / p.GetMomentum().norm());
auto const [theta, phi] = rotation_angles( p.GetMomentum() );
cout << "ProcessSibyll: zenith angle between sibyllCS and rootCS: " << theta / M_PI * 180. << endl;
cout << "ProcessSibyll: azimuth angle between sibyllCS and rootCS: " << phi / M_PI * 180. << endl;
//double phi = asin( p.GetMomentum().GetComponents()[0]/pt(p.GetMomentum() ) );
CoordinateSystem sibyllCS = rootCS.rotate(zAxis,phi).rotate(yAxis, theta);
/* /*
the target should be defined by the Environment, the target should be defined by the Environment,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment