Index: modules/BTagging.cc
===================================================================
--- modules/BTagging.cc	(revision c1ce3fea879c763e18da0cb50ebce00718f4d770)
+++ modules/BTagging.cc	(revision c627b071e8b44d21fe65b226c3ff42071a03709b)
@@ -34,8 +34,4 @@
 #include "classes/DelphesFormula.h"
 
-#include "ExRootAnalysis/ExRootResult.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootClassifier.h"
-
 #include "TMath.h"
 #include "TString.h"
@@ -55,38 +51,7 @@
 //------------------------------------------------------------------------------
 
-class BTaggingPartonClassifier : public ExRootClassifier
+BTagging::BTagging() :
+  fItJetInputArray(0)
 {
-public:
-
-  BTaggingPartonClassifier() {}
-
-  Int_t GetCategory(TObject *object);
-
-  Double_t fEtaMax, fPTMin;
-};
-
-//------------------------------------------------------------------------------
-
-Int_t BTaggingPartonClassifier::GetCategory(TObject *object)
-{
-  Candidate *parton = static_cast<Candidate*>(object);
-  const TLorentzVector &momentum = parton->Momentum;
-  Int_t pdgCode;
-
-  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
-
-  pdgCode = TMath::Abs(parton->PID);
-  if(pdgCode != 21 && pdgCode > 5) return -1;
-
-  return 0;
-}
-
-//------------------------------------------------------------------------------
-
-BTagging::BTagging() :
-  fClassifier(0), fFilter(0),
-  fItPartonInputArray(0), fItJetInputArray(0)
-{
-  fClassifier = new BTaggingPartonClassifier;
 }
 
@@ -95,5 +60,4 @@
 BTagging::~BTagging()
 {
-  if(fClassifier) delete fClassifier;
 }
 
@@ -108,9 +72,4 @@
 
   fBitNumber = GetInt("BitNumber", 0);
-
-  fDeltaR = GetDouble("DeltaR", 0.5);
-
-  fClassifier->fPTMin = GetDouble("PartonPTMin", 1.0);
-  fClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
 
   // read efficiency formulas
@@ -139,9 +98,4 @@
   // import input array(s)
 
-  fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
-  fItPartonInputArray = fPartonInputArray->MakeIterator();
-
-  fFilter = new ExRootFilter(fPartonInputArray);
-
   fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
   fItJetInputArray = fJetInputArray->MakeIterator();
@@ -155,7 +109,5 @@
   DelphesFormula *formula;
 
-  if(fFilter) delete fFilter;
   if(fItJetInputArray) delete fItJetInputArray;
-  if(fItPartonInputArray) delete fItPartonInputArray;
 
   for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
@@ -172,15 +124,6 @@
   Candidate *jet;
   Double_t pt, eta, phi, e;
-  TObjArray *partonArray;
   map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   DelphesFormula *formula;
-
-  // select quark and gluons
-  fFilter->Reset();
-  partonArray = fFilter->GetSubArray(fClassifier, 0);
-
-  if(partonArray == 0) return;
-
-  TIter itPartonArray(partonArray);
 
   // loop over all input jets
Index: modules/BTagging.h
===================================================================
--- modules/BTagging.h	(revision c1ce3fea879c763e18da0cb50ebce00718f4d770)
+++ modules/BTagging.h	(revision c627b071e8b44d21fe65b226c3ff42071a03709b)
@@ -37,7 +37,4 @@
 class DelphesFormula;
 
-class ExRootFilter;
-class BTaggingPartonClassifier;
-
 class BTagging: public DelphesModule
 {
@@ -55,19 +52,9 @@
   Int_t fBitNumber;
 
-  Double_t fDeltaR;
-
 #if !defined(__CINT__) && !defined(__CLING__)
   std::map< Int_t, DelphesFormula * > fEfficiencyMap; //!
 #endif
 
-  BTaggingPartonClassifier *fClassifier; //!
-  
-  ExRootFilter *fFilter;
-
-  TIterator *fItPartonInputArray; //!
-  
   TIterator *fItJetInputArray; //!
-
-  const TObjArray *fPartonInputArray; //!
   
   const TObjArray *fJetInputArray; //!
Index: modules/JetFlavorAssociation.cc
===================================================================
--- modules/JetFlavorAssociation.cc	(revision c1ce3fea879c763e18da0cb50ebce00718f4d770)
+++ modules/JetFlavorAssociation.cc	(revision c627b071e8b44d21fe65b226c3ff42071a03709b)
@@ -151,13 +151,23 @@
   fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
   fItPartonInputArray = fPartonInputArray->MakeIterator();
+  fPartonFilter = new ExRootFilter(fPartonInputArray);
 
   fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles"));
   fItParticleInputArray = fParticleInputArray->MakeIterator();
 
-  fParticleLHEFInputArray = ImportArray(GetString("ParticleLHEFInputArray", "Delphes/allParticlesLHEF"));
-  fItParticleLHEFInputArray = fParticleLHEFInputArray->MakeIterator();
-
-  fPartonFilter = new ExRootFilter(fPartonInputArray);
-  fParticleLHEFFilter = new ExRootFilter(fParticleLHEFInputArray);
+  try
+  {
+    fParticleLHEFInputArray = ImportArray(GetString("ParticleLHEFInputArray", "Delphes/allParticlesLHEF"));
+  }
+  catch(runtime_error &e)
+  {
+    fParticleLHEFInputArray = 0;
+  }
+
+  if(fParticleLHEFInputArray)
+  {
+    fItParticleLHEFInputArray = fParticleLHEFInputArray->MakeIterator();
+    fParticleLHEFFilter = new ExRootFilter(fParticleLHEFInputArray);
+  }
 
   fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
@@ -183,20 +193,17 @@
 
   Candidate *jet;
-  TObjArray *partonArray;
-  TObjArray *partonLHEFArray;
-
-  // select quark && gluons
+  TObjArray *partonArray = 0;
+  TObjArray *partonLHEFArray = 0;
+
+  // select quark and gluons
   fPartonFilter->Reset();
   partonArray = fPartonFilter->GetSubArray(fPartonClassifier, 0); // get the filtered parton array
-
   if(partonArray == 0) return;
-  TIter itPartonArray(partonArray);
-
-  fParticleLHEFFilter->Reset();
-  partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array
-
-  if(partonLHEFArray == 0) return;
-  TIter itPartonLHEFArray(partonLHEFArray);
-
+
+  if(fParticleLHEFInputArray) 
+  {
+    fParticleLHEFFilter->Reset();
+    partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array
+  }
   // loop over all input jets
   fItJetInputArray->Reset();
@@ -204,6 +211,6 @@
   {
     // get standard flavor
-    GetAlgoFlavor(jet, itPartonArray, itPartonLHEFArray);
-    GetPhysicsFlavor(jet, itPartonArray, itPartonLHEFArray);
+    GetAlgoFlavor(jet, partonArray, partonLHEFArray);
+    if(fParticleLHEFInputArray) GetPhysicsFlavor(jet, partonArray, partonLHEFArray);
   }
 }
@@ -213,12 +220,14 @@
 // https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc?v=CMSSW_7_3_0_pre1
 
-void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray)
+void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray)
 {
   float maxPt = 0;
-  bool isGoodParton = true;
   int daughterCounter = 0;
   Candidate *parton, *partonLHEF;
   Candidate *tempParton = 0, *tempPartonHighestPt = 0;
   int pdgCode, pdgCodeMax = -1;
+  
+  TIter itPartonArray(partonArray);
+  TIter itPartonLHEFArray(partonLHEFArray);
 
   itPartonArray.Reset();
@@ -232,6 +241,7 @@
       if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
     }
-
-    isGoodParton = true;
+ 
+    if(!fParticleLHEFInputArray) continue;
+ 
     itPartonLHEFArray.Reset();
     while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
@@ -240,10 +250,7 @@
          parton->PID == partonLHEF->PID &&
          partonLHEF->Charge == parton->Charge)
-      {
-         isGoodParton = false;
+      {      
          break;
       }
-
-      if(!isGoodParton) continue;
 
       // check the daugheter
@@ -285,5 +292,5 @@
 //------------------------------------------------------------------------------
 
-void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray)
+void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray)
 {
   int partonCounter = 0;
@@ -298,4 +305,7 @@
   vector<Candidate *>::iterator itContaminations;
 
+  TIter itPartonArray(partonArray);
+  TIter itPartonLHEFArray(partonLHEFArray);
+
   contaminations.clear();
 
Index: modules/JetFlavorAssociation.h
===================================================================
--- modules/JetFlavorAssociation.h	(revision c1ce3fea879c763e18da0cb50ebce00718f4d770)
+++ modules/JetFlavorAssociation.h	(revision c627b071e8b44d21fe65b226c3ff42071a03709b)
@@ -50,6 +50,6 @@
   void Finish();
 
-  void GetAlgoFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray);
-  void GetPhysicsFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray);
+  void GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray);
+  void GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray);
 
 private:
