From dd2ec655031b315ae57ccf9bda697a2a5fc9c675 Mon Sep 17 00:00:00 2001
From: Andrii Verbytskyi <andriish@mppui4.t2.rzg.mpg.de>
Date: Tue, 24 Mar 2020 19:36:58 +0100
Subject: [PATCH] Fixes for FourVector and added missing package

---
 .../ParticleDecayer/src/ParticleDecayer.cxx       | 15 ++++++++++-----
 Projects/AthGeneration/package_filters.txt        |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Generators/ParticleDecayer/src/ParticleDecayer.cxx b/Generators/ParticleDecayer/src/ParticleDecayer.cxx
index 354314777f3..63b637ae3d5 100644
--- a/Generators/ParticleDecayer/src/ParticleDecayer.cxx
+++ b/Generators/ParticleDecayer/src/ParticleDecayer.cxx
@@ -394,9 +394,11 @@ StatusCode ParticleDecayer::fillEvt(HepMC::GenEvent* event) {
                                     darkPhotonLVs) );
 
            //add dark photon 1
-           addParticle( genpart->end_vertex(), m_particlePDGID, darkPhotonLVs.at(0).vect(), 2);
+           auto v0=darkPhotonLVs.at(0).vect();
+           addParticle( genpart->end_vertex(), m_particlePDGID, HepMC::FourVector(v0.x(),v0.y(),v0.z(),0.0) , 2);
            //add dark photon 2
-           addParticle( genpart->end_vertex(), m_particlePDGID, darkPhotonLVs.at(1).vect(), 2);
+           auto v1=darkPhotonLVs.at(1).vect();
+           addParticle( genpart->end_vertex(), m_particlePDGID, HepMC::FourVector(v1.x(),v1.y(),v1.z(),0.0), 2);
            
            //lifetime handling of the dark photons
            HepMC::GenVertex::particles_out_const_iterator pIt    = genpart->end_vertex()->particles_out_const_begin();
@@ -451,7 +453,8 @@ void ParticleDecayer::addParticle(HepMC::GenVertex* prod_vtx, int pdg, HepMC::Fo
      {
         mass = getParticleMass(pdg);
      }
-  HepMC::GenParticle* aParticle = new HepMC::GenParticle(HepMC::FourVector(momentum.x(), momentum.y(), momentum.z(), sqrt(momentum.r()*momentum.r() + mass*mass)), 
+  double energy=std::sqrt(std::pow(momentum.x(),2)+std::pow(momentum.y(),2)+std::pow(momentum.z(),2)+mass*mass);   
+  HepMC::GenParticle* aParticle = new HepMC::GenParticle(HepMC::FourVector(momentum.x(), momentum.y(), momentum.z(), energy), 
 		                           pdg, statusCode, HepMC::Flow(), HepMC::Polarization(0, 0));
 
   prod_vtx->add_particle_out(aParticle);
@@ -519,8 +522,10 @@ StatusCode ParticleDecayer::DFTwoBodyDecay( HepMC::GenParticle* genpart, int Pol
    //Add the daughters to the pool file
    ATH_MSG_DEBUG("ParticleDecayer::fillEvt:   -- Add the daughters to the pool file");
    HepMC::GenVertex* end_vtx = genpart->end_vertex();
-   addParticle(end_vtx,  ModeOfDecay, daughterLVs.at(0).vect(),    1);
-   addParticle(end_vtx, -ModeOfDecay, daughterLVs.at(1).vect(),    1);
+   auto v0=daughterLVs.at(0).vect();
+   addParticle(end_vtx,  ModeOfDecay, HepMC::FourVector(v0.x(),v0.y(),v0.z(),0.0),    1);
+   auto v1=daughterLVs.at(1).vect();
+   addParticle(end_vtx, -ModeOfDecay, HepMC::FourVector(v1.x(),v1.y(),v1.z(),0.0),    1);
 
    return StatusCode::SUCCESS;
 }
diff --git a/Projects/AthGeneration/package_filters.txt b/Projects/AthGeneration/package_filters.txt
index b340bb9a2c0..f0c137c711a 100644
--- a/Projects/AthGeneration/package_filters.txt
+++ b/Projects/AthGeneration/package_filters.txt
@@ -155,6 +155,7 @@
 + PhysicsAnalysis/PATJobTransforms
 + PhysicsAnalysis/TruthParticleID/McParticleEvent
 + PhysicsAnalysis/TruthParticleID/McParticleKernel
++ PhysicsAnalysis/POOLRootAccess
 #+ Projects/AthGeneration
 #+ Projects/AthGeneration/.*
 #+ Reconstruction/eflowRec
-- 
GitLab