Index: classes/DelphesHepMC3Reader.cc
===================================================================
--- classes/DelphesHepMC3Reader.cc	(revision 400689320e11ad8a71d4c2d6f0a6b6c06efcb35c)
+++ classes/DelphesHepMC3Reader.cc	(revision 1ad8ecafa851b71ae0e4d2c2ddf5b92c73c0c41e)
@@ -326,11 +326,10 @@
     }
 
-    AnalyzeParticle(factory, allParticleOutputArray,
-      stableParticleOutputArray, partonOutputArray);
+    AnalyzeParticle(factory);
   }
 
   if(EventReady())
   {
-    FinalizeParticles(allParticleOutputArray);
+    FinalizeParticles(allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
   }
 
@@ -374,11 +373,11 @@
 {
   Weight *element;
-  vector<double>::const_iterator itWeight;
-
-  for(itWeight = fWeights.begin(); itWeight != fWeights.end(); ++itWeight)
+  vector<double>::const_iterator itWeights;
+
+  for(itWeights = fWeights.begin(); itWeights != fWeights.end(); ++itWeights)
   {
     element = static_cast<Weight *>(branch->NewEntry());
 
-    element->Weight = *itWeight;
+    element->Weight = *itWeights;
   }
 }
@@ -406,5 +405,4 @@
     array = factory->NewArray();
     position->SetXYZT(0.0, 0.0, 0.0, 0.0);
-    array->Clear();
     fVertices.push_back(make_pair(position, array));
   }
@@ -432,53 +430,34 @@
 //---------------------------------------------------------------------------
 
-void DelphesHepMC3Reader::AnalyzeParticle(DelphesFactory *factory,
-  TObjArray *allParticleOutputArray,
+void DelphesHepMC3Reader::AnalyzeParticle(DelphesFactory *factory)
+{
+  Candidate *candidate;
+
+  candidate = factory->NewCandidate();
+
+  candidate->PID = fPID;
+
+  candidate->Status = fParticleStatus;
+
+  candidate->Mass = fMass;
+
+  candidate->Momentum.SetPxPyPzE(fPx, fPy, fPz, fE);
+
+  candidate->D1 = fParticleCode;
+
+  AnalyzeVertex(factory, fOutVertexCode, candidate);
+}
+
+//---------------------------------------------------------------------------
+
+void DelphesHepMC3Reader::FinalizeParticles(TObjArray *allParticleOutputArray,
   TObjArray *stableParticleOutputArray,
   TObjArray *partonOutputArray)
 {
+  TLorentzVector *position;
+  TObjArray *array;
   Candidate *candidate;
   TParticlePDG *pdgParticle;
   int pdgCode;
-
-  candidate = factory->NewCandidate();
-
-  candidate->PID = fPID;
-  pdgCode = TMath::Abs(candidate->PID);
-
-  candidate->Status = fParticleStatus;
-
-  pdgParticle = fPDG->GetParticle(fPID);
-  candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999;
-  candidate->Mass = fMass;
-
-  candidate->Momentum.SetPxPyPzE(fPx, fPy, fPz, fE);
-  if(fMomentumCoefficient != 1.0)
-  {
-    candidate->Momentum *= fMomentumCoefficient;
-  }
-
-  candidate->D1 = fParticleCode;
-
-  AnalyzeVertex(factory, fOutVertexCode, candidate);
-
-  if(!pdgParticle) return;
-
-  if(fParticleStatus == 1)
-  {
-    stableParticleOutputArray->Add(candidate);
-  }
-  else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
-  {
-    partonOutputArray->Add(candidate);
-  }
-}
-
-//---------------------------------------------------------------------------
-
-void DelphesHepMC3Reader::FinalizeParticles(TObjArray *allParticleOutputArray)
-{
-  TLorentzVector *position;
-  TObjArray *array;
-  Candidate *candidate;
   map<int, int >::iterator itVertexMap;
   map<int, pair<int, int> >::iterator itMotherMap;
@@ -500,4 +479,9 @@
       {
         candidate->Position *= fPositionCoefficient;
+      }
+
+      if(fMomentumCoefficient != 1.0)
+      {
+        candidate->Momentum *= fMomentumCoefficient;
       }
 
@@ -541,4 +525,21 @@
 
       ++counter;
+
+      pdgParticle = fPDG->GetParticle(candidate->PID);
+
+      candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999;
+
+      if(!pdgParticle) continue;
+
+      pdgCode = TMath::Abs(candidate->PID);
+
+      if(candidate->Status == 1)
+      {
+        stableParticleOutputArray->Add(candidate);
+      }
+      else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
+      {
+        partonOutputArray->Add(candidate);
+      }
     }
   }
Index: classes/DelphesHepMC3Reader.h
===================================================================
--- classes/DelphesHepMC3Reader.h	(revision 400689320e11ad8a71d4c2d6f0a6b6c06efcb35c)
+++ classes/DelphesHepMC3Reader.h	(revision 1ad8ecafa851b71ae0e4d2c2ddf5b92c73c0c41e)
@@ -65,10 +65,9 @@
   void AnalyzeVertex(DelphesFactory *factory, int code, Candidate *candidate = 0);
 
-  void AnalyzeParticle(DelphesFactory *factory,
-    TObjArray *allParticleOutputArray,
+  void AnalyzeParticle(DelphesFactory *factory);
+
+  void FinalizeParticles(TObjArray *allParticleOutputArray,
     TObjArray *stableParticleOutputArray,
     TObjArray *partonOutputArray);
-
-  void FinalizeParticles(TObjArray *allParticleOutputArray);
 
   FILE *fInputFile;
