From 2d9943e0e45faaf86b8bcae185a56ae75cd77d38 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi <averbyts@cern.ch> Date: Mon, 28 Sep 2020 19:48:55 +0200 Subject: [PATCH] Migrate McEventCollectionFilter.cxx to HepMC3 --- .../src/McEventCollectionFilter.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx b/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx index 173e660195c5..29ed3a489040 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx @@ -9,6 +9,9 @@ // #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Flow.h" +#include "AtlasHepMC/Polarization.h" // #include "InDetSimEvent/SiHit.h" #include "MuonSimEvent/TGCSimHit.h" @@ -203,8 +206,13 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ const HepMC::FourVector& pmvxpos=hScatVx->position(); genVertex->set_position(pmvxpos); //to set geantino kinematic phi=eta=0, E=p=E_hard_scat +#ifdef HEPMC3 + auto itrp = hScatVx->particles_in().begin(); + if (hScatVx->particles_in().size()==2){ +#else HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin(); if (hScatVx->particles_in_size()==2){ +#endif HepMC::FourVector mom1=(*itrp)->momentum(); HepMC::FourVector mom2=(*(++itrp))->momentum(); HepMC::FourVector vxmom; @@ -217,6 +225,9 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ } } +#ifdef HEPMC3 + if(!evt->vertices().empty()) for (auto vtx: evt->vertices()) evt->remove_vertex(vtx); +#else if(!evt->vertices_empty()){ HepMC::GenEvent::vertex_iterator itvtx = evt->vertices_begin(); for (;itvtx != evt ->vertices_end(); ++itvtx ) { @@ -225,6 +236,7 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ delete vtx; } } +#endif //-------------------------------------- if(m_IsKeepTRTElect){ -- GitLab