From c6312802a95ec602452387d16f22aa0a1fe1525d Mon Sep 17 00:00:00 2001
From: Ziyue Zhang <Ziyue_Zhang@localhost.localdomain>
Date: Thu, 4 Mar 2021 12:25:23 -0600
Subject: [PATCH] WIP: Test on PID instead of pmass

---
 benchmarks/dvmp/analysis/dvmp.h       | 13 +++++++++++++
 benchmarks/dvmp/analysis/vm_invar.cxx |  4 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/benchmarks/dvmp/analysis/dvmp.h b/benchmarks/dvmp/analysis/dvmp.h
index 20e6b953..0c79f8cd 100644
--- a/benchmarks/dvmp/analysis/dvmp.h
+++ b/benchmarks/dvmp/analysis/dvmp.h
@@ -38,6 +38,19 @@ namespace util {
     inv_quant quantities = {nu, Q2, Q2/2./P.mass()/nu, t};
     return quantities;
   }
+  //========================================test on using pid and re-structure the function========================
+  inline auto momenta_sim_ordered(const std::vector<eic::ReconstructedParticleData>& parts, std::string_view mother, std::string_view daughter){
+    std::vector<ROOT::Math::PxPyPzMVector> momenta{7};
+    //0:e0  1:p0    2:e1    3:p1    4:recoil system (without p1)    5:l1 from 4 6:l2 from 4
+    int order_map[7] = {0, 3, 2, 6, 5, 7, 8};             
+    //for(int i = 0 ; i < 7 ; i++) order_map[i] = -1;//-1 by default, meaning absense
+    for(int i = 0 ; i < 7 ; i++){
+        momenta[i].SetXYZM(parts[order_map[i]].p.x, parts[order_map[i]].p.y, parts[order_map[i]].p.z, parts[order_map[i]].p.mass);
+    }
+    return momenta;
+  }
+  
+  
   
  //for Dummy rc
   inline inv_quant calc_inv_quant_rec(const std::vector<ROOT::Math::PxPyPzMVector>& parts, const double pdg_mass, const double daughter_mass){
diff --git a/benchmarks/dvmp/analysis/vm_invar.cxx b/benchmarks/dvmp/analysis/vm_invar.cxx
index 21be3710..73a33a80 100644
--- a/benchmarks/dvmp/analysis/vm_invar.cxx
+++ b/benchmarks/dvmp/analysis/vm_invar.cxx
@@ -74,7 +74,9 @@ int vm_invar(const std::string& config_name)
   auto calc_inv_quant_rec = [vm_mass, decay_mass](const std::vector<ROOT::Math::PxPyPzMVector>& parts) {
     return util::calc_inv_quant_rec(parts, vm_mass, decay_mass);
   };
-
+  auto momenta_sim_ordered = [vm_name, decay_name](const std::vector<eic::ReconstructedParticleData>& parts){
+    return util::momenta_sim_ordered(momenta_sim_ordered, vm_name, decay_name);
+  };
   //====================================================================
 
   // Define analysis flow
-- 
GitLab