From 0bcbf1637ce79168cd80b7351cbe0b14da293830 Mon Sep 17 00:00:00 2001
From: Alexander Jentsch <ajentsch@bnl.gov>
Date: Wed, 11 Aug 2021 11:42:19 -0400
Subject: [PATCH] Add crossing angle to gen_particle script.

---
 benchmarks/b0_tracker/scripts/gen_forward_protons.cxx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/benchmarks/b0_tracker/scripts/gen_forward_protons.cxx b/benchmarks/b0_tracker/scripts/gen_forward_protons.cxx
index ef69220f..cb1705f9 100644
--- a/benchmarks/b0_tracker/scripts/gen_forward_protons.cxx
+++ b/benchmarks/b0_tracker/scripts/gen_forward_protons.cxx
@@ -21,11 +21,13 @@ void gen_forward_protons(int n_events = 1000,
                      const char* out_fname = "forward_protons.hepmc")
 {
   
+  double crossingAngle = -0.025; //radiansc
+
   // generate protons in B0 acceptance - roughly 5 - 20 mrad
   double cos_theta_min = 0.005; //std::cos(0.005*(M_PI/180.0));
   double cos_theta_max = 0.020; //std::cos(0.020*(M_PI/180.0));
 
-  
+   
 
   double partEnergyMin = 270.0; // xL 0.98
   double partEnergyMax = 275.0; // top beam energy
@@ -62,6 +64,10 @@ void gen_forward_protons(int n_events = 1000,
     // sphere of given radius, in this case momentum.
     // r1->Sphere(px, py, pz, p);
 
+    //rotate vector by crossing angle
+	pz = pz*std::cos(crossingAngle) - px*std::sin(crossingAngle);
+	px = pz*std::sin(crossingAngle) + px*std::cos(crossingAngle);
+
     //std::cout << std::sqrt(px*px + py*py + pz*pz) - p << " is zero? \n";
 
     // type 1 is final state
-- 
GitLab