From 35b263acd77f3f0c5d3196fb96f9d088758f4af1 Mon Sep 17 00:00:00 2001
From: Chris Hays <Chris.Hays@cern.ch>
Date: Mon, 23 Apr 2018 11:11:46 +0200
Subject: [PATCH] Pythia fixes for MG2.61 update

---
 Generators/Pythia8_i/Pythia8_i/Pythia8_i.h |  5 ++++-
 Generators/Pythia8_i/src/Pythia8_i.cxx     | 17 +++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h b/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h
index 820e763424f..101697c36a2 100644
--- a/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h
+++ b/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h
@@ -99,6 +99,8 @@ private:
   double m_version;
   
   std::vector<std::string> m_commands;
+  std::vector<std::string> m_userParams;
+  std::vector<std::string> m_userModes;
   
   enum PDGID {PROTON=2212, ANTIPROTON=-2212, NEUTRON=2112, ANTINEUTRON=-2112, MUON=13, ANTIMUON=-13, ELECTRON=11, POSITRON=-11, INVALID=0};
   
@@ -131,7 +133,8 @@ private:
   
   std::string m_userHook;
   
-  std::vector<Pythia8::UserHooks*> m_userHooksPtrs;
+  Pythia8::UserHooks *m_userHookPtr;
+  //std::vector<Pythia8::UserHooks*> m_userHooksPtrs;
   
   std::string m_userResonances;
   
diff --git a/Generators/Pythia8_i/src/Pythia8_i.cxx b/Generators/Pythia8_i/src/Pythia8_i.cxx
index ac4236b5d9b..a87462771e3 100644
--- a/Generators/Pythia8_i/src/Pythia8_i.cxx
+++ b/Generators/Pythia8_i/src/Pythia8_i.cxx
@@ -83,10 +83,11 @@ Pythia8_i::~Pythia8_i() {
   delete m_atlasRndmEngine;
   
   if(m_procPtr != 0)     delete m_procPtr;
-  
-  for(Pythia8::UserHooks *ptr: m_userHooksPtrs){
-    delete ptr;
-  }
+  if(m_userHookPtr != 0) delete m_userHookPtr;
+
+  //  for(Pythia8::UserHooks *ptr: m_userHooksPtrs){
+  // delete ptr;
+  //}
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -467,13 +468,13 @@ StatusCode Pythia8_i::fillEvt(HepMC::GenEvent *evt){
 
   size_t firstWeight = (m_doLHE3Weights)? 1: 0;
   
-  for(int iw = firstWeight; iw != m_pythia.info.nWeights(); ++iw){
+  for(int iw = firstWeight; iw != m_pythia->info.nWeights(); ++iw){
     
-    std::string wtName = ((int)m_showerWeightNames.size() == m_pythia.info.nWeights())? m_showerWeightNames[iw]: "ShowerWt_" + std::to_string(iw);
+    std::string wtName = ((int)m_showerWeightNames.size() == m_pythia->info.nWeights())? m_showerWeightNames[iw]: "ShowerWt_" + std::to_string(iw);
     
-    if(m_pythia.info.nWeights() != 1){
+    if(m_pythia->info.nWeights() != 1){
       if(m_internal_event_number == 1) m_weightIDs.push_back(wtName);
-      evt->weights()[wtName] = mergingWeight*m_pythia.info.weight(iw);
+      evt->weights()[wtName] = mergingWeight*m_pythia->info.weight(iw);
     }else{
       evt->weights().push_back(eventWeight);
     }
-- 
GitLab