Index: modules/AngularSmearing.cc
===================================================================
--- modules/AngularSmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class AngularSmearing
- *
- *  Performs transverse angular resolution smearing.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/AngularSmearing.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-AngularSmearing::AngularSmearing() :
-  fFormulaEta(0), fFormulaPhi(0), fItInputArray(0)
-{
-  fFormulaEta = new DelphesFormula;
-  fFormulaPhi = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-AngularSmearing::~AngularSmearing()
-{
-  if(fFormulaEta) delete fFormulaEta;
-  if(fFormulaPhi) delete fFormulaPhi;
-}
-
-//------------------------------------------------------------------------------
-
-void AngularSmearing::Init()
-{
-  // read resolution formula
-
-  fFormulaEta->Compile(GetString("EtaResolutionFormula", "0.0"));
-  fFormulaPhi->Compile(GetString("PhiResolutionFormula", "0.0"));
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void AngularSmearing::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void AngularSmearing::Process()
-{
-  Candidate *candidate, *mother;
-  Double_t pt, eta, phi, e, m;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    eta = candidateMomentum.Eta();
-    phi = candidateMomentum.Phi();
-    pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
-    m = candidateMomentum.M();
-
-    // apply smearing formula for eta,phi
-    eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e, candidate));
-    phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e, candidate));
-
-    if(pt <= 0.0) continue;
-
-    mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m);
-    candidate->AddCandidate(mother);
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/AngularSmearing.h
===================================================================
--- modules/AngularSmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AngularSmearing_h
-#define AngularSmearing_h
-
-/** \class AngularSmearing
- *
- *  Performs transverse angular resolution smearing.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class AngularSmearing: public DelphesModule
-{
-public:
-  AngularSmearing();
-  ~AngularSmearing();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesFormula *fFormulaEta; //!
-  DelphesFormula *fFormulaPhi; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(AngularSmearing, 1)
-};
-
-#endif
Index: modules/BTagging.cc
===================================================================
--- modules/BTagging.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/BTagging.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class BTagging
@@ -21,5 +4,9 @@
  *  Determines origin of jet,
  *  applies b-tagging efficiency (miss identification rate) formulas
- *  and sets b-tagging flags
+ *  and sets b-tagging flags 
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -33,16 +20,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootClassifier.h"
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
+
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -50,7 +41,38 @@
 //------------------------------------------------------------------------------
 
+class BTaggingPartonClassifier : public ExRootClassifier
+{
+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() :
-  fItJetInputArray(0)
-{
+  fClassifier(0), fFilter(0),
+  fItPartonInputArray(0), fItJetInputArray(0)
+{
+  fClassifier = new BTaggingPartonClassifier;
 }
 
@@ -59,4 +81,5 @@
 BTagging::~BTagging()
 {
+  if(fClassifier) delete fClassifier;
 }
 
@@ -65,22 +88,25 @@
 void BTagging::Init()
 {
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   ExRootConfParam param;
   DelphesFormula *formula;
   Int_t i, size;
 
-  fBitNumber = GetInt("BitNumber", 0);
+  fDeltaR = GetDouble("DeltaR", 0.5);
+
+  fClassifier->fPTMin = GetDouble("PartonPTMin", 1.0);
+  fClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
 
   // read efficiency formulas
   param = GetParam("EfficiencyFormula");
   size = param.GetSize();
-
+  
   fEfficiencyMap.clear();
-  for(i = 0; i < size / 2; ++i)
+  for(i = 0; i < size/2; ++i)
   {
     formula = new DelphesFormula;
-    formula->Compile(param[i * 2 + 1].GetString());
-
-    fEfficiencyMap[param[i * 2].GetInt()] = formula;
+    formula->Compile(param[i*2 + 1].GetString());
+
+    fEfficiencyMap[param[i*2].GetInt()] = formula;
   }
 
@@ -97,4 +123,9 @@
   // 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();
@@ -105,8 +136,10 @@
 void BTagging::Finish()
 {
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   DelphesFormula *formula;
 
+  if(fFilter) delete fFilter;
   if(fItJetInputArray) delete fItJetInputArray;
+  if(fItPartonInputArray) delete fItPartonInputArray;
 
   for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
@@ -121,21 +154,45 @@
 void BTagging::Process()
 {
-  Candidate *jet;
-  Double_t pt, eta, phi, e;
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  Candidate *jet, *parton;
+  Double_t pt, eta, phi;
+  TObjArray *partonArray;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   DelphesFormula *formula;
-
+  Int_t pdgCode, pdgCodeMax;
+
+  // select quark and gluons
+  fFilter->Reset();
+  partonArray = fFilter->GetSubArray(fClassifier, 0);
+  
+  if(partonArray == 0) return;
+
+  TIter itPartonArray(partonArray);
+  
   // loop over all input jets
   fItJetInputArray->Reset();
-  while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
+  while((jet = static_cast<Candidate*>(fItJetInputArray->Next())))
   {
     const TLorentzVector &jetMomentum = jet->Momentum;
+    pdgCodeMax = -1;
     eta = jetMomentum.Eta();
     phi = jetMomentum.Phi();
     pt = jetMomentum.Pt();
-    e = jetMomentum.E();
-
-    // find an efficiency formula
-    itEfficiencyMap = fEfficiencyMap.find(jet->Flavor);
+
+    // loop over all input partons
+    itPartonArray.Reset();
+    while((parton = static_cast<Candidate*>(itPartonArray.Next())))
+    {
+      pdgCode = TMath::Abs(parton->PID);
+      if(pdgCode == 21) pdgCode = 0;
+      if(jetMomentum.DeltaR(parton->Momentum) <= fDeltaR)
+      {
+        if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
+      }
+    }
+    if(pdgCodeMax == 0) pdgCodeMax = 21;
+    if(pdgCodeMax == -1) pdgCodeMax = 0;
+
+    // find an efficency formula
+    itEfficiencyMap = fEfficiencyMap.find(pdgCodeMax);
     if(itEfficiencyMap == fEfficiencyMap.end())
     {
@@ -144,30 +201,8 @@
     formula = itEfficiencyMap->second;
 
-    // apply an efficiency formula
-    jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
-
-    // find an efficiency formula for algo flavor definition
-    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorAlgo);
-    if(itEfficiencyMap == fEfficiencyMap.end())
-    {
-      itEfficiencyMap = fEfficiencyMap.find(0);
-    }
-    formula = itEfficiencyMap->second;
-
-    // apply an efficiency formula
-    jet->BTagAlgo |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
-
-    // find an efficiency formula for phys flavor definition
-    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorPhys);
-    if(itEfficiencyMap == fEfficiencyMap.end())
-    {
-      itEfficiencyMap = fEfficiencyMap.find(0);
-    }
-    formula = itEfficiencyMap->second;
-
-    // apply an efficiency formula
-    jet->BTagPhys |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
-  }
-}
-
-//------------------------------------------------------------------------------
+    // apply an efficency formula
+    jet->BTag = gRandom->Uniform() <= formula->Eval(pt, eta);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/BTagging.h
===================================================================
--- modules/BTagging.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/BTagging.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef BTagging_h
 #define BTagging_h
@@ -25,4 +7,8 @@
  *  applies b-tagging efficiency (miss identification rate) formulas
  *  and sets b-tagging flags 
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -37,7 +23,11 @@
 class DelphesFormula;
 
+class ExRootFilter;
+class BTaggingPartonClassifier;
+
 class BTagging: public DelphesModule
 {
 public:
+
   BTagging();
   ~BTagging();
@@ -48,12 +38,19 @@
 
 private:
-  Int_t fBitNumber;
 
-#if !defined(__CINT__) && !defined(__CLING__)
-  std::map<Int_t, DelphesFormula *> fEfficiencyMap; //!
-#endif
+  Double_t fDeltaR;
 
+  std::map< Int_t, DelphesFormula * > fEfficiencyMap; //!
+  
+  BTaggingPartonClassifier *fClassifier; //!
+  
+  ExRootFilter *fFilter;
+
+  TIterator *fItPartonInputArray; //!
+  
   TIterator *fItJetInputArray; //!
 
+  const TObjArray *fPartonInputArray; //!
+  
   const TObjArray *fJetInputArray; //!
 
Index: modules/BeamSpotFilter.cc
===================================================================
--- modules/BeamSpotFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/** \class BeamSpotFilter
- *
- *  Extracts beam spot 
- *
- *  \author Michele Selvaggi
- *
- */
-
-#include "modules/BeamSpotFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-BeamSpotFilter::BeamSpotFilter() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-BeamSpotFilter::~BeamSpotFilter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void BeamSpotFilter::Init()
-{
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void BeamSpotFilter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void BeamSpotFilter::Process()
-{
-  Candidate *candidate;
-  Bool_t passed = false;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())) && !passed)
-  {
-    if(candidate->IsPU == 0) passed = true;
-    fOutputArray->Add(candidate);
-  }
-}
Index: modules/BeamSpotFilter.h
===================================================================
--- modules/BeamSpotFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,41 +1,0 @@
-//------------------------------------------------------------------------------
-
-#ifndef BeamSpotFilter_h
-#define BeamSpotFilter_h
-
-/** \class BeamSpotFilter
- *
- *  Extracts beam spot 
- *
- *  \author Michele Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-
-class BeamSpotFilter: public DelphesModule
-{
-public:
-  BeamSpotFilter();
-  ~BeamSpotFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Float_t fPassedOne;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(BeamSpotFilter, 1)
-};
-
-#endif
Index: modules/CMakeLists.txt
===================================================================
--- modules/CMakeLists.txt	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,38 +1,0 @@
-include_directories(
-  ${CMAKE_SOURCE_DIR}
-  ${ROOT_INCLUDE_DIRS}
-  ${DelphesExternals_INCLUDE_DIR}
-)
-
-file(GLOB sources *.cc)
-file(GLOB headers *.h)
-list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/FastJetLinkDef.h)
-list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ModulesLinkDef.h)
-list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/Pythia8LinkDef.h)
-
-DELPHES_GENERATE_DICTIONARY(FastJetDict ${headers} LINKDEF FastJetLinkDef.h)
-DELPHES_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h)
-
-if(PYTHIA8_FOUND)
-  DELPHES_GENERATE_DICTIONARY(Pythia8Dict ${headers} LINKDEF Pythia8LinkDef.h)
-  add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx Pythia8Dict.cxx)
-else()
-  list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc)
-  add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx)
-endif()
-
-# install headers
-install(FILES ${headers} DESTINATION include/modules)
-
-# install pcms if they are created
-if (NOT ${ROOT_VERSION} VERSION_LESS "6.0.0")
-  install(FILES
-    ${PROJECT_BINARY_DIR}/modules/libModulesDict_rdict.pcm
-    ${PROJECT_BINARY_DIR}/modules/libFastJetDict_rdict.pcm
-    DESTINATION lib)
-  if(PYTHIA8_FOUND)
-    install(FILES
-      ${PROJECT_BINARY_DIR}/modules/libPythia8Dict_rdict.pcm
-      DESTINATION lib)
-  endif()
-endif()
Index: modules/Calorimeter.cc
===================================================================
--- modules/Calorimeter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Calorimeter.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,24 +1,11 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class Calorimeter
  *
  *  Fills calorimeter towers, performs calorimeter resolution smearing,
- *  and creates energy flow objects (tracks, photons, and neutral hadrons).
+ *  preselects towers hit by photons and creates energy flow objects.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -32,20 +19,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -55,15 +42,14 @@
 Calorimeter::Calorimeter() :
   fECalResolutionFormula(0), fHCalResolutionFormula(0),
-  fItParticleInputArray(0), fItTrackInputArray(0)
-{
-
+  fItParticleInputArray(0), fItTrackInputArray(0),
+  fTowerTrackArray(0), fItTowerTrackArray(0),
+  fTowerPhotonArray(0), fItTowerPhotonArray(0)
+{
   fECalResolutionFormula = new DelphesFormula;
   fHCalResolutionFormula = new DelphesFormula;
-
-  fECalTowerTrackArray = new TObjArray;
-  fItECalTowerTrackArray = fECalTowerTrackArray->MakeIterator();
-
-  fHCalTowerTrackArray = new TObjArray;
-  fItHCalTowerTrackArray = fHCalTowerTrackArray->MakeIterator();
+  fTowerTrackArray = new TObjArray;
+  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
+  fTowerPhotonArray = new TObjArray;
+  fItTowerPhotonArray = fTowerPhotonArray->MakeIterator();
 }
 
@@ -72,13 +58,10 @@
 Calorimeter::~Calorimeter()
 {
-
   if(fECalResolutionFormula) delete fECalResolutionFormula;
   if(fHCalResolutionFormula) delete fHCalResolutionFormula;
-
-  if(fECalTowerTrackArray) delete fECalTowerTrackArray;
-  if(fItECalTowerTrackArray) delete fItECalTowerTrackArray;
-
-  if(fHCalTowerTrackArray) delete fHCalTowerTrackArray;
-  if(fItHCalTowerTrackArray) delete fItHCalTowerTrackArray;
+  if(fTowerTrackArray) delete fTowerTrackArray;
+  if(fItTowerTrackArray) delete fItTowerTrackArray;
+  if(fTowerPhotonArray) delete fTowerPhotonArray;
+  if(fItTowerPhotonArray) delete fItTowerPhotonArray;
 }
 
@@ -88,9 +71,9 @@
 {
   ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
-  Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
+  Long_t i, j, k, size, sizeEtaBins, sizePhiBins, sizeFractions;
   Double_t ecalFraction, hcalFraction;
   TBinMap::iterator itEtaBin;
-  set<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
+  set< Double_t >::iterator itPhiBin;
+  vector< Double_t > *phiBins;
 
   // read eta and phi bins
@@ -100,9 +83,9 @@
   fEtaBins.clear();
   fPhiBins.clear();
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramEtaBins = param[i * 2];
+  for(i = 0; i < size/2; ++i)
+  {
+    paramEtaBins = param[i*2];
     sizeEtaBins = paramEtaBins.GetSize();
-    paramPhiBins = param[i * 2 + 1];
+    paramPhiBins = param[i*2 + 1];
     sizePhiBins = paramPhiBins.GetSize();
 
@@ -121,5 +104,5 @@
   {
     fEtaBins.push_back(itEtaBin->first);
-    phiBins = new vector<double>(itEtaBin->second.size());
+    phiBins = new vector< double >(itEtaBin->second.size());
     fPhiBins.push_back(phiBins);
     phiBins->clear();
@@ -138,31 +121,21 @@
   fFractionMap[0] = make_pair(0.0, 1.0);
 
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramFractions = param[i * 2 + 1];
+  for(i = 0; i < size/2; ++i)
+  {
+    paramFractions = param[i*2 + 1];
+    sizeFractions = paramFractions.GetSize();
 
     ecalFraction = paramFractions[0].GetDouble();
     hcalFraction = paramFractions[1].GetDouble();
 
-    fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction);
-  }
-
-  // read min E value for timing measurement in ECAL
-  fTimingEnergyMin = GetDouble("TimingEnergyMin", 4.);
-  // For timing
-  // So far this flag needs to be false
-  // Curved extrapolation not supported
-  fElectronsFromTrack = false;
-
-  // read min E value for towers to be saved
-  fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
-  fHCalEnergyMin = GetDouble("HCalEnergyMin", 0.0);
-
-  fECalEnergySignificanceMin = GetDouble("ECalEnergySignificanceMin", 0.0);
-  fHCalEnergySignificanceMin = GetDouble("HCalEnergySignificanceMin", 0.0);
-
-  // switch on or off the dithering of the center of calorimeter towers
-  fSmearTowerCenter = GetBool("SmearTowerCenter", true);
-
+    fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
+  }
+/*
+  TFractionMap::iterator itFractionMap;
+  for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
+  {
+    cout << itFractionMap->first << "   " << itFractionMap->second.first  << "   " << itFractionMap->second.second << endl;
+  }
+*/
   // read resolution formulas
   fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0"));
@@ -181,6 +154,5 @@
 
   fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
-  fEFlowPhotonOutputArray = ExportArray(GetString("EFlowPhotonOutputArray", "eflowPhotons"));
-  fEFlowNeutralHadronOutputArray = ExportArray(GetString("EFlowNeutralHadronOutputArray", "eflowNeutralHadrons"));
+  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
 }
 
@@ -189,5 +161,5 @@
 void Calorimeter::Finish()
 {
-  vector<vector<Double_t> *>::iterator itPhiBin;
+  vector< vector< Double_t>* >::iterator itPhiBin;
   if(fItParticleInputArray) delete fItParticleInputArray;
   if(fItTrackInputArray) delete fItTrackInputArray;
@@ -209,36 +181,27 @@
   Double_t ecalFraction, hcalFraction;
   Double_t ecalEnergy, hcalEnergy;
-  Double_t ecalSigma, hcalSigma;
-  Double_t energyGuess;
   Int_t pdgCode;
 
   TFractionMap::iterator itFractionMap;
 
-  vector<Double_t>::iterator itEtaBin;
-  vector<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  vector<Long64_t>::iterator itTowerHits;
+  vector< Double_t >::iterator itEtaBin;
+  vector< Double_t >::iterator itPhiBin;
+  vector< Double_t > *phiBins;
+
+  vector< Long64_t >::iterator itTowerHits;
 
   DelphesFactory *factory = GetFactory();
   fTowerHits.clear();
-  fECalTowerFractions.clear();
-  fHCalTowerFractions.clear();
-  fECalTrackFractions.clear();
-  fHCalTrackFractions.clear();
+  fECalFractions.clear();
+  fHCalFractions.clear();
 
   // loop over all particles
   fItParticleInputArray->Reset();
   number = -1;
-  fTowerRmax=0.;
-  while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))
+  while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
   {
     const TLorentzVector &particlePosition = particle->Position;
     ++number;
 
-    // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower)
-    if (particlePosition.Perp() > fTowerRmax)
-      fTowerRmax=particlePosition.Perp();
-
     pdgCode = TMath::Abs(particle->PID);
 
@@ -252,6 +215,6 @@
     hcalFraction = itFractionMap->second.second;
 
-    fECalTowerFractions.push_back(ecalFraction);
-    fHCalTowerFractions.push_back(hcalFraction);
+    fECalFractions.push_back(ecalFraction);
+    fHCalFractions.push_back(hcalFraction);
 
     if(ecalFraction < 1.0E-9 && hcalFraction < 1.0E-9) continue;
@@ -270,6 +233,7 @@
     phiBin = distance(phiBins->begin(), itPhiBin);
 
-    flags = 0;
-    flags |= (pdgCode == 11 || pdgCode == 22) << 1;
+    flags = (particle->Charge == 0);
+    flags |= (pdgCode == 22) << 1;
+    flags |= (pdgCode == 11) << 2;
 
     // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
@@ -282,22 +246,8 @@
   fItTrackInputArray->Reset();
   number = -1;
-  while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
+  while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
   {
     const TLorentzVector &trackPosition = track->Position;
     ++number;
-
-    pdgCode = TMath::Abs(track->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    ecalFraction = itFractionMap->second.first;
-    hcalFraction = itFractionMap->second.second;
-
-    fECalTrackFractions.push_back(ecalFraction);
-    fHCalTrackFractions.push_back(hcalFraction);
 
     // find eta bin [1, fEtaBins.size - 1]
@@ -314,8 +264,6 @@
     phiBin = distance(phiBins->begin(), itPhiBin);
 
-    flags = 1;
-
     // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
+    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(1) << 27) | Long64_t(number);
 
     fTowerHits.push_back(towerHit);
@@ -333,5 +281,5 @@
     towerHit = (*itTowerHits);
     flags = (towerHit >> 24) & 0x00000000000000FFLL;
-    number = (towerHit)&0x0000000000FFFFFFLL;
+    number = (towerHit) & 0x0000000000FFFFFFLL;
     hitEtaPhi = towerHit >> 32;
 
@@ -354,6 +302,6 @@
 
       // calculate eta and phi of the tower's center
-      fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
-      fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
+      fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
+      fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
 
       fTowerEdges[0] = fEtaBins[etaBin - 1];
@@ -362,98 +310,54 @@
       fTowerEdges[3] = (*phiBins)[phiBin];
 
-      fECalTowerEnergy = 0.0;
-      fHCalTowerEnergy = 0.0;
-
-      fECalTrackEnergy = 0.0;
-      fHCalTrackEnergy = 0.0;
-
-      fECalTrackSigma = 0.0;
-      fHCalTrackSigma = 0.0;
-
+      fTowerECalEnergy = 0.0;
+      fTowerHCalEnergy = 0.0;
+
+      fTowerECalNeutralEnergy = 0.0;
+      fTowerHCalNeutralEnergy = 0.0;
+
+      fTowerNeutralHits = 0;
+      fTowerPhotonHits = 0;
+      fTowerElectronHits = 0;
       fTowerTrackHits = 0;
-      fTowerPhotonHits = 0;
-
-      fECalTowerTrackArray->Clear();
-      fHCalTowerTrackArray->Clear();
+      fTowerAllHits = 0;
+
+      fTowerTrackArray->Clear();
+      fTowerPhotonArray->Clear();
     }
 
     // check for track hits
-    if(flags & 1)
+    if(flags & 8)
     {
       ++fTowerTrackHits;
-
-      track = static_cast<Candidate *>(fTrackInputArray->At(number));
-      momentum = track->Momentum;
-      position = track->Position;
-
-      ecalEnergy = momentum.E() * fECalTrackFractions[number];
-      hcalEnergy = momentum.E() * fHCalTrackFractions[number];
-
-      if(ecalEnergy > fTimingEnergyMin && fTower)
-      {
-        if(fElectronsFromTrack)
-        {
-          fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T()));
-        }
-      }
-
-      if(fECalTrackFractions[number] > 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9)
-      {
-        fECalTrackEnergy += ecalEnergy;
-        ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
-        if(ecalSigma / momentum.E() < track->TrackResolution)
-          energyGuess = ecalEnergy;
-        else
-          energyGuess = momentum.E();
-
-        fECalTrackSigma += (track->TrackResolution) * energyGuess * (track->TrackResolution) * energyGuess;
-        fECalTowerTrackArray->Add(track);
-      }
-
-      else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] > 1.0E-9)
-      {
-        fHCalTrackEnergy += hcalEnergy;
-        hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
-        if(hcalSigma / momentum.E() < track->TrackResolution)
-          energyGuess = hcalEnergy;
-        else
-          energyGuess = momentum.E();
-
-        fHCalTrackSigma += (track->TrackResolution) * energyGuess * (track->TrackResolution) * energyGuess;
-        fHCalTowerTrackArray->Add(track);
-      }
-
-      else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9)
-      {
-        fEFlowTrackOutputArray->Add(track);
-      }
-
+      track = static_cast<Candidate*>(fTrackInputArray->At(number));
+      fTowerTrackArray->Add(track);
       continue;
     }
 
-    // check for photon and electron hits in current tower
-    if(flags & 2) ++fTowerPhotonHits;
-
-    particle = static_cast<Candidate *>(fParticleInputArray->At(number));
+    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
     momentum = particle->Momentum;
-    position = particle->Position;
 
     // fill current tower
-    ecalEnergy = momentum.E() * fECalTowerFractions[number];
-    hcalEnergy = momentum.E() * fHCalTowerFractions[number];
-
-    fECalTowerEnergy += ecalEnergy;
-    fHCalTowerEnergy += hcalEnergy;
-
-    if(ecalEnergy > fTimingEnergyMin && fTower)
-    {
-      if(abs(particle->PID) != 11 || !fElectronsFromTrack)
-      {
-        fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T()));
-      }
-    }
-
+    ecalEnergy = momentum.E() * fECalFractions[number];
+    hcalEnergy = momentum.E() * fHCalFractions[number];
+
+    fTowerECalEnergy += ecalEnergy;
+    fTowerHCalEnergy += hcalEnergy;
+
+    ++fTowerAllHits;
     fTower->AddCandidate(particle);
-    fTower->Position = position;
+
+    // check for neutral hits in current tower
+    if(flags & 1) ++fTowerNeutralHits;
+
+    // check for photon hits in current tower
+    if(flags & 2)
+    {
+      ++fTowerPhotonHits;
+      fTowerPhotonArray->Add(particle);
+    }
+
+    // check for electron hits in current tower
+    if(flags & 4) ++fTowerElectronHits;
   }
 
@@ -466,76 +370,27 @@
 void Calorimeter::FinalizeTower()
 {
-  Candidate *track, *tower, *mother;
-  Double_t energy, pt, eta, phi, r;
+  Candidate *particle, *track, *tower;
+  Double_t energy, pt, eta, phi;
   Double_t ecalEnergy, hcalEnergy;
-  Double_t ecalNeutralEnergy, hcalNeutralEnergy;
-
-  Double_t ecalSigma, hcalSigma;
-  Double_t ecalNeutralSigma, hcalNeutralSigma;
-
-  Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor;
-
-  TLorentzVector momentum;
-  TFractionMap::iterator itFractionMap;
-
-  Float_t weight, sumWeightedTime, sumWeight;
 
   if(!fTower) return;
 
-  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fECalTowerEnergy);
-  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fHCalTowerEnergy);
-
-  ecalEnergy = LogNormal(fECalTowerEnergy, ecalSigma);
-  hcalEnergy = LogNormal(fHCalTowerEnergy, hcalSigma);
-
-  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
-  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
-
-  if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin * ecalSigma) ecalEnergy = 0.0;
-  if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin * hcalSigma) hcalEnergy = 0.0;
+  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
+  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
+
+  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
+  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
 
   energy = ecalEnergy + hcalEnergy;
 
-  if(fSmearTowerCenter)
-  {
-    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
-    phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
-  }
-  else
-  {
-    eta = fTowerEta;
-    phi = fTowerPhi;
-  }
+  // eta = fTowerEta;
+  // phi = fTowerPhi;
+
+  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
+  phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
 
   pt = energy / TMath::CosH(eta);
 
-  // Time calculation for tower
-  fTower->NTimeHits = 0;
-  sumWeightedTime = 0.0;
-  sumWeight = 0.0;
-
-  for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
-  {
-    weight = TMath::Power((fTower->ECalEnergyTimePairs[i].first),2);
-    sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
-    sumWeight += weight;
-    fTower->NTimeHits++;
-  }
-
-  // check whether barrel or endcap tower
-  if (fTower->Position.Perp() < fTowerRmax && TMath::Abs(eta) > 0.)
-    r = fTower->Position.Z()/TMath::SinH(eta);
-  else
-    r = fTower->Position.Pt();
-
-  if(sumWeight > 0.0)
-  {
-    fTower->Position.SetPtEtaPhiE(r, eta, phi, sumWeightedTime / sumWeight);
-  }
-  else
-  {
-    fTower->Position.SetPtEtaPhiE(r, eta, phi, 999999.9);
-  }
-
+  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
   fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
   fTower->Eem = ecalEnergy;
@@ -547,7 +402,9 @@
   fTower->Edges[3] = fTowerEdges[3];
 
+  // fill calorimeter towers and photon candidates
   if(energy > 0.0)
   {
-    if(fTowerPhotonHits > 0 && fTowerTrackHits == 0)
+    if((fTowerPhotonHits > 0 || fTowerElectronHits > 0) &&
+        fTowerTrackHits == 0)
     {
       fPhotonOutputArray->Add(fTower);
@@ -558,128 +415,55 @@
 
   // fill energy flow candidates
-  fECalTrackSigma = TMath::Sqrt(fECalTrackSigma);
-  fHCalTrackSigma = TMath::Sqrt(fHCalTrackSigma);
-
-  //compute neutral excesses
-  ecalNeutralEnergy = max((ecalEnergy - fECalTrackEnergy), 0.0);
-  hcalNeutralEnergy = max((hcalEnergy - fHCalTrackEnergy), 0.0);
-
-  ecalNeutralSigma = ecalNeutralEnergy / TMath::Sqrt(fECalTrackSigma * fECalTrackSigma + ecalSigma * ecalSigma);
-  hcalNeutralSigma = hcalNeutralEnergy / TMath::Sqrt(fHCalTrackSigma * fHCalTrackSigma + hcalSigma * hcalSigma);
-
-  // if ecal neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack
-  if(ecalNeutralEnergy > fECalEnergyMin && ecalNeutralSigma > fECalEnergySignificanceMin)
-  {
-    // create new photon tower assuming null mass
-    tower = static_cast<Candidate *>(fTower->Clone());
-    pt = ecalNeutralEnergy / TMath::CosH(eta);
-
-    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalNeutralEnergy);
-    tower->Eem = ecalNeutralEnergy;
-    tower->Ehad = 0.0;
-    tower->PID = 22;
-
-    fEFlowPhotonOutputArray->Add(tower);
-
-    //clone tracks
-    fItECalTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-
+  if(fTowerTrackHits == fTowerAllHits)
+  {
+    fItTowerTrackArray->Reset();
+    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
+    {
       fEFlowTrackOutputArray->Add(track);
     }
   }
-
-  // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking
-  else if(fECalTrackEnergy > 0.0)
-  {
-    weightTrack = (fECalTrackSigma > 0.0) ? 1 / (fECalTrackSigma * fECalTrackSigma) : 0.0;
-    weightCalo = (ecalSigma > 0.0) ? 1 / (ecalSigma * ecalSigma) : 0.0;
-
-    bestEnergyEstimate = (weightTrack * fECalTrackEnergy + weightCalo * ecalEnergy) / (weightTrack + weightCalo);
-    rescaleFactor = bestEnergyEstimate / fECalTrackEnergy;
-
-    //rescale tracks
-    fItECalTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-
-      track->Momentum *= rescaleFactor;
-
+  else if(fTowerTrackHits > 0 &&
+          fTowerElectronHits == 0 &&
+          fTowerPhotonHits + fTowerTrackHits == fTowerAllHits)
+  {
+    fItTowerTrackArray->Reset();
+    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
+    {
       fEFlowTrackOutputArray->Add(track);
     }
-  }
-
-  // if hcal neutral excess is significant, simply create neutral EflowNeutralHadron tower and clone each track into eflowtrack
-  if(hcalNeutralEnergy > fHCalEnergyMin && hcalNeutralSigma > fHCalEnergySignificanceMin)
-  {
-    // create new photon tower
-    tower = static_cast<Candidate *>(fTower->Clone());
-    pt = hcalNeutralEnergy / TMath::CosH(eta);
-
-    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalNeutralEnergy);
-    tower->Ehad = hcalNeutralEnergy;
-    tower->Eem = 0.0;
-
-    fEFlowNeutralHadronOutputArray->Add(tower);
-
-    //clone tracks
-    fItHCalTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-
-  // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking
-  else if(fHCalTrackEnergy > 0.0)
-  {
-    weightTrack = (fHCalTrackSigma > 0.0) ? 1 / (fHCalTrackSigma * fHCalTrackSigma) : 0.0;
-    weightCalo = (hcalSigma > 0.0) ? 1 / (hcalSigma * hcalSigma) : 0.0;
-
-    bestEnergyEstimate = (weightTrack * fHCalTrackEnergy + weightCalo * hcalEnergy) / (weightTrack + weightCalo);
-    rescaleFactor = bestEnergyEstimate / fHCalTrackEnergy;
-
-    //rescale tracks
-    fItHCalTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-      track->Momentum *= rescaleFactor;
-      track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M());
-
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
-
-Double_t Calorimeter::LogNormal(Double_t mean, Double_t sigma)
-{
-  Double_t a, b;
-
-  if(mean > 0.0)
-  {
-    b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));
-    a = TMath::Log(mean) - 0.5 * b * b;
-
-    return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0));
-  }
-  else
-  {
-    return 0.0;
-  }
-}
+
+    if(ecalEnergy > 0.0)
+    {
+      DelphesFactory *factory = GetFactory();
+
+      // create new tower
+      tower = factory->NewCandidate();
+
+      fItTowerPhotonArray->Reset();
+      while((particle = static_cast<Candidate*>(fItTowerPhotonArray->Next())))
+      {
+        tower->AddCandidate(particle);
+      }
+
+      pt = ecalEnergy / TMath::CosH(eta);
+
+      tower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
+      tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalEnergy);
+      tower->Eem = ecalEnergy;
+      tower->Ehad = 0.0;
+
+      tower->Edges[0] = fTowerEdges[0];
+      tower->Edges[1] = fTowerEdges[1];
+      tower->Edges[2] = fTowerEdges[2];
+      tower->Edges[3] = fTowerEdges[3];
+
+      fEFlowTowerOutputArray->Add(tower);
+    }
+  }
+  else if(energy > 0.0)
+  {
+    fEFlowTowerOutputArray->Add(fTower);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/Calorimeter.h
===================================================================
--- modules/Calorimeter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Calorimeter.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef Calorimeter_h
 #define Calorimeter_h
@@ -23,5 +5,9 @@
  *
  *  Fills calorimeter towers, performs calorimeter resolution smearing,
- *  and creates energy flow objects (tracks, photons, and neutral hadrons).
+ *  preselects towers hit by photons and creates energy flow objects.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -42,4 +28,5 @@
 {
 public:
+
   Calorimeter();
   ~Calorimeter();
@@ -50,42 +37,24 @@
 
 private:
-  typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //!
-  typedef std::map<Double_t, std::set<Double_t> > TBinMap; //!
+
+  typedef std::map< Long64_t, std::pair< Double_t, Double_t > > TFractionMap; //!
+  typedef std::map< Double_t, std::set< Double_t > > TBinMap; //!
 
   Candidate *fTower;
   Double_t fTowerEta, fTowerPhi, fTowerEdges[4];
-  Double_t fECalTowerEnergy, fHCalTowerEnergy;
-  Double_t fECalTrackEnergy, fHCalTrackEnergy;
-
-  Double_t fTimingEnergyMin;
-  Bool_t fElectronsFromTrack;
-  Double_t fTowerRmax;
-
-  Int_t fTowerTrackHits, fTowerPhotonHits;
-
-  Double_t fECalEnergyMin;
-  Double_t fHCalEnergyMin;
-
-  Double_t fECalEnergySignificanceMin;
-  Double_t fHCalEnergySignificanceMin;
-
-  Double_t fECalTrackSigma;
-  Double_t fHCalTrackSigma;
-
-  Bool_t fSmearTowerCenter;
+  Double_t fTowerECalEnergy, fTowerHCalEnergy;
+  Double_t fTowerECalNeutralEnergy, fTowerHCalNeutralEnergy;
+  Int_t fTowerNeutralHits, fTowerPhotonHits, fTowerElectronHits, fTowerTrackHits, fTowerAllHits;
 
   TFractionMap fFractionMap; //!
   TBinMap fBinMap; //!
 
-  std::vector<Double_t> fEtaBins;
-  std::vector<std::vector<Double_t> *> fPhiBins;
+  std::vector < Double_t > fEtaBins;
+  std::vector < std::vector < Double_t >* > fPhiBins;
 
-  std::vector<Long64_t> fTowerHits;
+  std::vector < Long64_t > fTowerHits;
 
-  std::vector<Double_t> fECalTowerFractions;
-  std::vector<Double_t> fHCalTowerFractions;
-
-  std::vector<Double_t> fECalTrackFractions;
-  std::vector<Double_t> fHCalTrackFractions;
+  std::vector < Double_t > fECalFractions;
+  std::vector < Double_t > fHCalFractions;
 
   DelphesFormula *fECalResolutionFormula; //!
@@ -102,16 +71,14 @@
 
   TObjArray *fEFlowTrackOutputArray; //!
-  TObjArray *fEFlowPhotonOutputArray; //!
-  TObjArray *fEFlowNeutralHadronOutputArray; //!
+  TObjArray *fEFlowTowerOutputArray; //!
 
-  TObjArray *fECalTowerTrackArray; //!
-  TIterator *fItECalTowerTrackArray; //!
+  TObjArray *fTowerTrackArray; //!
+  TIterator *fItTowerTrackArray; //!
 
-  TObjArray *fHCalTowerTrackArray; //!
-  TIterator *fItHCalTowerTrackArray; //!
+  TObjArray *fTowerPhotonArray; //!
+  TIterator *fItTowerPhotonArray; //!
 
   void FinalizeTower();
-  Double_t LogNormal(Double_t mean, Double_t sigma);
-
+  
   ClassDef(Calorimeter, 1)
 };
Index: modules/Cloner.cc
===================================================================
--- modules/Cloner.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class Clone
- *
- *  Clone candidate array
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/Cloner.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-Cloner::Cloner() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-Cloner::~Cloner()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Cloner::Init()
-{
-  // import input array(s)
-
-  fInputArray = ImportArray(GetString("InputArray", "FastJetFinder/jets"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array(s)
-
-  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
-}
-
-//------------------------------------------------------------------------------
-
-void Cloner::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void Cloner::Process()
-{
-  Candidate *candidate;
-
-  // loop over all input candidates
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/Cloner.h
===================================================================
--- modules/Cloner.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef Clone_h
-#define Clone_h
-
-/** \class Clone
- *
- *  Clone candidate array
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <deque>
-
-class TObjArray;
-
-class Cloner: public DelphesModule
-{
-public:
-  Cloner();
-  ~Cloner();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-  TObjArray *fOutputArray; //!
-
-  ClassDef(Cloner, 1)
-};
-
-#endif
Index: modules/ClusterCounting.cc
===================================================================
--- modules/ClusterCounting.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,139 +1,0 @@
-   /*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2020  Universite catholique de Louvain (UCLouvain), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class ClusterCounting
- *
- *  Counts ionisation clusters of energy loss in drift chambers
- *
- *  \authors F. Bedeschi - INFN Pisa
-*            P. Demin - UCLouvain, Louvain-la-Neuve
- *           M. Selvaggi - CERN
- *
- *
- */
-
-#include "modules/ClusterCounting.h"
-#include "classes/DelphesClasses.h"
-#include "TrackCovariance/TrkUtil.h"
-
-#include "TLorentzVector.h"
-#include "TVectorD.h"
-#include "TMath.h"
-#include "TObjArray.h"
-
-#include <iostream>
-#include <sstream>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-ClusterCounting::ClusterCounting() :
-  fTrackUtil(0)
-{
-  fTrackUtil = new TrkUtil();
-}
-
-//------------------------------------------------------------------------------
-
-ClusterCounting::~ClusterCounting()
-{
-  if(fTrackUtil) delete fTrackUtil;
-}
-
-//------------------------------------------------------------------------------
-
-void ClusterCounting::Init()
-{
-
-  // geometric acceptance
-  fRmin  = GetDouble("Rmin", 0.);
-  fRmax  = GetDouble("Rmax", 0.);
-  fZmin  = GetDouble("Zmin", 0.);
-  fZmax  = GetDouble("Zmax", 0.);
-
-  // magnetic field
-  fBz    = GetDouble("Bz", 0.);
-
-  // gas mix option: 0
-  // 0:  Helium 90 - Isobutane 10
-  // 1:  Helium 100
-  // 2:  Argon 50 - Ethane 50
-  // 3:  Argon 100
-  fGasOption = GetInt("GasOption", 0);
-
-  // initialize drift chamber geometry and gas mix
-  fTrackUtil->SetBfield(fBz);
-  fTrackUtil->SetDchBoundaries(fRmin, fRmax, fZmin, fZmax);
-  fTrackUtil->SetGasMix(fGasOption);
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void ClusterCounting::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void ClusterCounting::Process()
-{
-  Candidate *candidate, *mother, *particle;
-  Double_t mass, trackLength, Ncl;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    // converting to meters
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-
-    // converting to meters
-    const TLorentzVector &candidatePosition = particle->Position*1e-03;
-    const TLorentzVector &candidateMomentum = particle->Momentum;
-
-		TVectorD Par = TrkUtil::XPtoPar(candidatePosition.Vect(), candidateMomentum.Vect(), candidate->Charge, fBz);
-    mass = candidateMomentum.M();
-
-    trackLength = fTrackUtil->TrkLen(Par);
-
-    mother    = candidate;
-    candidate = static_cast<Candidate*>(candidate->Clone());
-
-    Ncl = 0.;
-    if (fTrackUtil->IonClusters(Ncl, mass, Par))
-    {
-      candidate->Nclusters = Ncl;
-      candidate->dNdx = (trackLength > 0.) ? Ncl/trackLength : -1;
-    }
-
-    candidate->AddCandidate(mother);
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/ClusterCounting.h
===================================================================
--- modules/ClusterCounting.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2020  Universite catholique de Louvain (UCLouvain), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef ClusterCounting_h
-#define ClusterCounting_h
-
-/** \class ClusterCounting
- *
- *  Counts ionisation clusters of energy loss in drift chambers
- *
- *  \authors F. Bedeschi - INFN
- *           M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-
-class TrkUtil;
-
-class ClusterCounting: public DelphesModule
-{
-public:
-  ClusterCounting();
-  ~ClusterCounting();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  Double_t fRmin;
-	Double_t fRmax;
-	Double_t fZmin;
-	Double_t fZmax;
-  Double_t fBz;
-
-  Int_t fGasOption;
-
-  TrkUtil *fTrackUtil;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(ClusterCounting, 1)
-};
-
-#endif
Index: modules/ConstituentFilter.cc
===================================================================
--- modules/ConstituentFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ConstituentFilter.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class ConstituentFilter
  *
  *  Drops all input objects that are not constituents of any jet.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -87,10 +74,10 @@
   param = GetParam("ConstituentInputArray");
   size = param.GetSize();
-  for(i = 0; i < size / 2; ++i)
+  for(i = 0; i < size/2; ++i)
   {
-    array = ImportArray(param[i * 2].GetString());
+    array = ImportArray(param[i*2].GetString());
     iterator = array->MakeIterator();
 
-    fInputMap[iterator] = ExportArray(param[i * 2 + 1].GetString());
+    fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());;
   }
 }
@@ -100,6 +87,6 @@
 void ConstituentFilter::Finish()
 {
-  map<TIterator *, TObjArray *>::iterator itInputMap;
-  vector<TIterator *>::iterator itInputList;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
+  vector< TIterator * >::iterator itInputList;
   TIterator *iterator;
 
@@ -122,6 +109,6 @@
 {
   Candidate *jet, *constituent;
-  map<TIterator *, TObjArray *>::iterator itInputMap;
-  vector<TIterator *>::iterator itInputList;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
+  vector< TIterator * >::iterator itInputList;
   TIterator *iterator;
   TObjArray *array;
@@ -134,5 +121,5 @@
     // loop over all jets
     iterator->Reset();
-    while((jet = static_cast<Candidate *>(iterator->Next())))
+    while((jet = static_cast<Candidate*>(iterator->Next())))
     {
       TIter itConstituents(jet->GetCandidates());
@@ -141,5 +128,5 @@
 
       // loop over all constituents
-      while((constituent = static_cast<Candidate *>(itConstituents.Next())))
+      while((constituent = static_cast<Candidate*>(itConstituents.Next())))
       {
         // set the IsConstituent flag
@@ -157,5 +144,5 @@
     // loop over all constituents
     iterator->Reset();
-    while((constituent = static_cast<Candidate *>(iterator->Next())))
+    while((constituent = static_cast<Candidate*>(iterator->Next())))
     {
       // check the IsConstituent flag
Index: modules/ConstituentFilter.h
===================================================================
--- modules/ConstituentFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ConstituentFilter.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef ConstituentFilter_h
 #define ConstituentFilter_h
@@ -24,4 +6,8 @@
  *  Drops all input objects that are not constituents of any jet.
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -30,6 +16,6 @@
 #include "classes/DelphesModule.h"
 
+#include <vector>
 #include <map>
-#include <vector>
 
 class TIterator;
@@ -39,4 +25,5 @@
 {
 public:
+
   ConstituentFilter();
   ~ConstituentFilter();
@@ -47,9 +34,10 @@
 
 private:
+
   Double_t fJetPTMin;
 
-  std::vector<TIterator *> fInputList; //!
+  std::vector< TIterator * > fInputList; //!
 
-  std::map<TIterator *, TObjArray *> fInputMap; //!
+  std::map< TIterator *, TObjArray * > fInputMap; //!
 
   TObjArray *fOutputArray; //!
Index: modules/CscClusterEfficiency.cc
===================================================================
--- modules/CscClusterEfficiency.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
- /** \class CscClusterEfficiency
-  *
-  *  This module is specific to the CMS paper searching for neutral LLPs in the CMS endcap muon detectors: https://arxiv.org/abs/2107.04838
-  *  It is implemented based on the ClusterEfficiency parameterization function provided in the HEPData entry of the paper: https://www.hepdata.net/record/104408
-  *
-  *  \author Christina Wang
-  *
-  */
-
-#include "modules/CscClusterEfficiency.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesCscClusterFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-CscClusterEfficiency::CscClusterEfficiency() :
-  fFormula(0), fItInputArray(0)
-{
-  fFormula = new DelphesCscClusterFormula;
-}
-
-//------------------------------------------------------------------------------
-
-CscClusterEfficiency::~CscClusterEfficiency()
-{
-  if(fFormula) delete fFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterEfficiency::Init()
-{
-  // read CscClusterEfficiency formula
-  fFormula->Compile(GetString("EfficiencyFormula", "1.0"));
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterEfficiency::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterEfficiency::Process()
-{
-  Candidate *candidate;
-  Double_t Ehad, Eem, decayR, decayZ;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
-    decayZ = abs(candidateDecayPosition.Z());
-    decayR = sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2));
-    Ehad = candidate->Ehad;
-    Eem = candidate->Eem;
-    // apply an efficency formula
-    if(gRandom->Uniform() > fFormula->Eval(decayR, decayZ, Ehad, Eem)) continue;
-
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/CscClusterEfficiency.h
===================================================================
--- modules/CscClusterEfficiency.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CscClusterEfficiency_h
-#define CscClusterEfficiency_h
-
-
-
-/** \class CscClusterEfficiency
- *
- *  This module is specific to the CMS paper searching for neutral LLPs in the CMS endcap muon detectors: https://arxiv.org/abs/2107.04838
- *  It is implemented based on the ClusterEfficiency parameterization function provided in the HEPData entry of the paper: https://www.hepdata.net/record/104408
- *
- *  \author Christina Wang
- *
- */
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesCscClusterFormula;
-
-class CscClusterEfficiency: public DelphesModule
-{
-public:
-  CscClusterEfficiency();
-  ~CscClusterEfficiency();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesCscClusterFormula *fFormula; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(CscClusterEfficiency, 1)
-};
-
-#endif
Index: modules/CscClusterId.cc
===================================================================
--- modules/CscClusterId.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
- /** \class CscClusterId
-  *
-  *  This module is specific to the CMS paper searching for neutral LLPs in the CMS endcap muon detectors: https://arxiv.org/abs/2107.04838
-  *  It is implemented based on the cut_based_id.py function provided in the HEPData entry of the paper: https://www.hepdata.net/record/104408
-  *  to reproduce the cut-based ID efficiency of the CMS paper.
-  *
-  *  \author Christina Wang
-  *
-  */
-
-#include "modules/CscClusterId.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesCscClusterFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include "assert.h"
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-CscClusterId::CscClusterId() :
-  fFormula(0), fEtaFormula(0), fItInputArray(0)
-{
-  fFormula = new DelphesCscClusterFormula;
-  fEtaFormula = new DelphesCscClusterFormula;
-}
-
-//------------------------------------------------------------------------------
-
-CscClusterId::~CscClusterId()
-{
-  if(fFormula) delete fFormula;
-  if(fEtaFormula) delete fEtaFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterId::Init()
-{
-  // read efficiency formula
-
-  fFormula->Compile(GetString("EfficiencyFormula", "1.0"));
-  fEtaFormula->Compile(GetString("EtaCutFormula", "1.0"));
-  fEtaCutMax = GetDouble("EtaCutMax", 999.0);
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterId::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void CscClusterId::Process()
-{
-  Candidate *candidate;
-  Double_t Ehad, Eem, decayR, decayZ, NStationEff, eta, eta_cut;
-  Int_t avgStation;
-  Double_t signPz, cosTheta;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
-    decayZ = abs(candidateDecayPosition.Z());
-    decayR = sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2));
-    Ehad = candidate->Ehad;
-    Eem = candidate->Eem;
-
-    cosTheta = TMath::Abs(momentum.CosTheta());
-    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-
-    // calculate the NStation > 1 efficiency, implemented according to Additional Figure 8 in HEPData
-    NStationEff = fFormula->Eval(decayR, decayZ, Ehad);
-
-    // depending on the decay region (station Number), different eta cut is applied, implemented based on cut_based_id.py in HEPData
-    float eta_cut = fEtaFormula->Eval(decayR, decayZ);
-    if(gRandom->Uniform() > NStationEff*(abs(eta)<fEtaCutMax)+(1.0-NStationEff)*(abs(eta)<eta_cut)) continue;
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/CscClusterId.h
===================================================================
--- modules/CscClusterId.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CscClusterId_h
-#define CscClusterId_h
-
-/** \class CscClusterId
- *
- *  This module is specific to the CMS paper searching for neutral LLPs in the CMS endcap muon detectors: https://arxiv.org/abs/2107.04838
- *  It is implemented based on the cut_based_id.py function provided in the HEPData entry of the paper: https://www.hepdata.net/record/104408
- *
- *  \author Christina Wang
- *
- */
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesCscClusterFormula;
-
-class CscClusterId: public DelphesModule
-{
-public:
-  CscClusterId();
-  ~CscClusterId();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesCscClusterFormula *fFormula; //!
-  DelphesCscClusterFormula *fEtaFormula; //!
-  Double_t fEtaCutMax;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(CscClusterId, 1)
-};
-
-#endif
Index: modules/DecayFilter.cc
===================================================================
--- modules/DecayFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class DecayFilter
- *
- *  This module randomly generates decays along the particle trajectory length 
- *  according to actual particle decay length, taking into account for the boost
- *  and using ROOT TDatabasePDG as a source for the particle lifetime.
- *
- *  This module is to to be used after a PropagateParticle step or a similar module
- *  that calculates and store a trajectory length.
- *
- *  Particles that decay are not added to the OutputArray.
- *
- *  \author R. Preghenella - INFN, Bologna
- *
- */
-
-#include "modules/DecayFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-DecayFilter::DecayFilter() :
-  fItInputArray(0)
-{}
-
-//------------------------------------------------------------------------------
-
-DecayFilter::~DecayFilter()
-{}
-
-//------------------------------------------------------------------------------
-
-void DecayFilter::Init()
-{
-
-  // import input array(s)
-
-  fInputArray = ImportArray(GetString("InputArray", "FastJetFinder/jets"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array(s)
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void DecayFilter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void DecayFilter::Process()
-{
-  Candidate *candidate;
-  TDatabasePDG *pdgdb = TDatabasePDG::Instance();
-  const Double_t c = TMath::C(); // [m/s]
-  Double_t m, t, p, bgct, L, l;
-  Bool_t hasDecayed = kFALSE;
-  
-  // loop over all input candidates
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    // get particle information from PDG
-    TParticlePDG *pdg = pdgdb->GetParticle(candidate->PID);
-    if (!pdg) { // don't know this particle
-      fOutputArray->Add(candidate);
-      continue;
-    }    
-    m = pdg->Mass();
-    t = pdg->Lifetime(); // [s]
-    if (t == 0.) { // does not decay
-      fOutputArray->Add(candidate);
-      continue;
-    }
-
-    // compute boosted decay length (beta gamma c tau)
-    p = candidate->P;
-    bgct = p / m * c * t; // [m]
-
-    // get full trajectory length and generate random decay length
-    L = candidate->L * 1.0E-3; // [m]
-    l = gRandom->Exp(bgct);
-
-    // if random decay happens before end of trajectory, reject track
-    if (l < L) continue;
-
-    // else particle did not decay within the trajectory
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/DecayFilter.h
===================================================================
--- modules/DecayFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DecayFilter_h
-#define DecayFilter_h
-
-/** \class DecayFilter
- *
- *  This module randomly generates decays along the particle trajectory length 
- *  according to actual particle decay length, taking into account for the boost
- *  and using ROOT TDatabasePDG as a source for the particle lifetime.
- *
- *  This module is to to be used after a PropagateParticle step or a similar module
- *  that calculates and store a trajectory length.
- *
- *  Particles that decay are not added to the OutputArray.
- *
- *  \author R. Preghenella - INFN, Bologna
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <deque>
-
-class TObjArray;
-
-class DecayFilter: public DelphesModule
-{
-public:
-  DecayFilter();
-  ~DecayFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(DecayFilter, 1)
-};
-
-#endif
Index: modules/Delphes.cc
===================================================================
--- modules/Delphes.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Delphes.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class Delphes
@@ -21,4 +4,8 @@
  *  Main Delphes module.
  *  Controls execution of all other modules.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -32,27 +19,27 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
 #include "ExRootAnalysis/ExRootConfReader.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
 
+#include "TROOT.h"
+#include "TMath.h"
+#include "TFolder.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFolder.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TROOT.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
+#include <string.h>
 #include <stdio.h>
-#include <string.h>
 
 using namespace std;
@@ -61,9 +48,6 @@
   fFactory(0)
 {
-  TFolder *folder;
-
+  TFolder *folder = new TFolder(name, "");
   fFactory = new DelphesFactory("ObjectFactory");
-
-  folder = new TFolder(name, "");
 
   SetName(name);
@@ -80,12 +64,11 @@
 Delphes::~Delphes()
 {
+  if(fFactory) delete fFactory;
   TFolder *folder = GetFolder();
   if(folder)
   {
-    gROOT->GetListOfBrowsables()->Remove(folder);
     folder->Clear();
     delete folder;
   }
-  if(fFactory) delete fFactory;
 }
 
@@ -121,6 +104,4 @@
   ExRootConfParam param = confReader->GetParam("::ExecutionPath");
   Long_t i, size = param.GetSize();
-
-  gRandom->SetSeed(confReader->GetInt("::RandomSeed", 0));
 
   for(i = 0; i < size; ++i)
Index: modules/Delphes.h
===================================================================
--- modules/Delphes.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Delphes.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef Delphes_h
 #define Delphes_h
@@ -24,4 +6,8 @@
  *  Main Delphes module.
  *  Controls execution of all other modules.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -41,9 +27,10 @@
 {
 public:
+
   Delphes(const char *name = "Delphes");
   ~Delphes();
 
   void SetTreeWriter(ExRootTreeWriter *treeWriter);
-
+  
   DelphesFactory *GetFactory() const { return fFactory; }
 
@@ -55,4 +42,5 @@
 
 private:
+
   DelphesFactory *fFactory;
 
@@ -61,2 +49,3 @@
 
 #endif /* Delphes_h */
+
Index: modules/DenseTrackFilter.cc
===================================================================
--- modules/DenseTrackFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,272 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class DenseTrackFilter
- *
- *  Applies reconstruction inefficiency on tracks in dense environment
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "modules/DenseTrackFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-DenseTrackFilter::DenseTrackFilter() :
-  fItTrackInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-DenseTrackFilter::~DenseTrackFilter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void DenseTrackFilter::Init()
-{
-  ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
-  Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
-  TBinMap::iterator itEtaBin;
-  set<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  // read eta and phi bins
-  param = GetParam("EtaPhiBins");
-  size = param.GetSize();
-  fBinMap.clear();
-  fEtaBins.clear();
-  fPhiBins.clear();
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramEtaBins = param[i * 2];
-    sizeEtaBins = paramEtaBins.GetSize();
-    paramPhiBins = param[i * 2 + 1];
-    sizePhiBins = paramPhiBins.GetSize();
-
-    for(j = 0; j < sizeEtaBins; ++j)
-    {
-      for(k = 0; k < sizePhiBins; ++k)
-      {
-        fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
-      }
-    }
-  }
-
-  // for better performance we transform map of sets to parallel vectors:
-  // vector< double > and vector< vector< double >* >
-  for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
-  {
-    fEtaBins.push_back(itEtaBin->first);
-    phiBins = new vector<double>(itEtaBin->second.size());
-    fPhiBins.push_back(phiBins);
-    phiBins->clear();
-    for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
-    {
-      phiBins->push_back(*itPhiBin);
-    }
-  }
-
-  // Eta x Phi smearing to be applied
-  fEtaPhiRes = GetDouble("EtaPhiRes", 0.003);
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMergerProp/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  fTrackOutputArray = ExportArray(GetString("TrackOutputArray", "tracks"));
-  fChargedHadronOutputArray = ExportArray(GetString("ChargedHadronOutputArray", "chargedHadrons"));
-  fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "electrons"));
-  fMuonOutputArray = ExportArray(GetString("MuonOutputArray", "muons"));
-}
-
-//------------------------------------------------------------------------------
-
-void DenseTrackFilter::Finish()
-{
-  vector<vector<Double_t> *>::iterator itPhiBin;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
-  {
-    delete *itPhiBin;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void DenseTrackFilter::Process()
-{
-  Candidate *track;
-  TLorentzVector position, momentum;
-  Short_t etaBin, phiBin, flags;
-  Int_t number;
-  Long64_t towerHit, towerEtaPhi, hitEtaPhi;
-  Double_t ptmax;
-
-  vector<Double_t>::iterator itEtaBin;
-  vector<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  vector<Long64_t>::iterator itTowerHits;
-
-  fTowerHits.clear();
-
-  // loop over all tracks
-  fItTrackInputArray->Reset();
-  number = -1;
-  while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
-  {
-    const TLorentzVector &trackPosition = track->Position;
-    ++number;
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 1;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // all hits are sorted first by eta bin number, then by phi bin number,
-  // then by flags and then by particle or track number
-  sort(fTowerHits.begin(), fTowerHits.end());
-
-  // loop over all hits
-  towerEtaPhi = 0;
-  fBestTrack = 0;
-  ptmax = 0.0;
-  fTowerTrackHits = 0;
-
-  for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
-  {
-    towerHit = (*itTowerHits);
-    flags = (towerHit >> 24) & 0x00000000000000FFLL;
-    number = (towerHit)&0x0000000000FFFFFFLL;
-    hitEtaPhi = towerHit >> 32;
-
-    if(towerEtaPhi != hitEtaPhi)
-    {
-      // switch to next tower
-      towerEtaPhi = hitEtaPhi;
-
-      // saving track with highest pT that hit the tower
-      FillTrack();
-
-      ptmax = 0.0;
-      fTowerTrackHits = 0;
-      fBestTrack = 0;
-    }
-    // check for track hits
-
-    if(flags & 1)
-    {
-      ++fTowerTrackHits;
-      track = static_cast<Candidate *>(fTrackInputArray->At(number));
-      momentum = track->Momentum;
-
-      if(momentum.Pt() > ptmax)
-      {
-        ptmax = momentum.Pt();
-        fBestTrack = track;
-      }
-      continue;
-    }
-  }
-
-  // here fill last tower
-  FillTrack();
-}
-
-//------------------------------------------------------------------------------
-
-void DenseTrackFilter::FillTrack()
-{
-
-  Candidate *candidate, *track;
-  Double_t pt, eta, phi, m;
-  Int_t numberOfCandidates;
-
-  // saving track with highest pT that hit the tower
-  if(fTowerTrackHits < 1) return;
-
-  numberOfCandidates = fBestTrack->GetCandidates()->GetEntriesFast();
-  if(numberOfCandidates < 1) return;
-
-  track = static_cast<Candidate *>(fBestTrack->GetCandidates()->At(numberOfCandidates - 1));
-  candidate = static_cast<Candidate *>(track->Clone());
-  pt = candidate->Momentum.Pt();
-  eta = candidate->Momentum.Eta();
-  phi = candidate->Momentum.Phi();
-  m = candidate->Momentum.M();
-
-  eta = gRandom->Gaus(eta, fEtaPhiRes);
-  phi = gRandom->Gaus(phi, fEtaPhiRes);
-  candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m);
-  candidate->AddCandidate(track);
-
-  fTrackOutputArray->Add(candidate);
-  switch(TMath::Abs(candidate->PID))
-  {
-  case 11:
-    fElectronOutputArray->Add(candidate);
-    break;
-  case 13:
-    fMuonOutputArray->Add(candidate);
-    break;
-  default:
-    fChargedHadronOutputArray->Add(candidate);
-  }
-}
Index: modules/DenseTrackFilter.h
===================================================================
--- modules/DenseTrackFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DenseTrackFilter_h
-#define DenseTrackFilter_h
-
-/** \class DenseTrackFilter
- *
- *  Applies reconstruction inefficiency on tracks in dense environment
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <set>
-#include <vector>
-
-class TObjArray;
-class DelphesFormula;
-class Candidate;
-
-class DenseTrackFilter: public DelphesModule
-{
-public:
-  DenseTrackFilter();
-  ~DenseTrackFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  typedef std::map<Double_t, std::set<Double_t> > TBinMap; //!
-
-  Candidate *fBestTrack;
-
-  Int_t fTowerTrackHits;
-
-  Double_t fEtaPhiRes;
-
-  TBinMap fBinMap; //!
-
-  std::vector<Double_t> fEtaBins;
-  std::vector<std::vector<Double_t> *> fPhiBins;
-
-  std::vector<Long64_t> fTowerHits;
-
-  TIterator *fItTrackInputArray; //!
-
-  const TObjArray *fTrackInputArray; //!
-  TObjArray *fTrackOutputArray; //!
-
-  TObjArray *fChargedHadronOutputArray; //!
-  TObjArray *fElectronOutputArray; //!
-  TObjArray *fMuonOutputArray; //!
-
-  void FillTrack();
-  ClassDef(DenseTrackFilter, 1)
-};
-
-#endif
Index: modules/DualReadoutCalorimeter.cc
===================================================================
--- modules/DualReadoutCalorimeter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,666 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-/** \class DualReadoutCalorimeter
- *
-
-  // ============  TODO  =========================================================
-  // This implementation of dual calorimetry relies on several approximations:
-  // - If hadronic energy is found in the tower the energy resolution then the full tower enrgy is smeared according to hadronic resolution (pessimistic for (e,n) or (pi+,gamma))
-  // - While e+ vs pi+ (or gamma vs n) separation is in principle possible for single particles (using C/S, PMT timing, lateral shower profile) it is not obvious it can be done overlapping particles.
-  //   Now we assume that regarless of the number of particle hits per tower we can always distinguish e+ vs pi+, which is probably not true in the case (e+,n) vs (pi+,gamma) without longitudinal segmentation.
-
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "modules/DualReadoutCalorimeter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootResult.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootClassifier.h"
-
-#include "TMath.h"
-#include "TString.h"
-#include "TFormula.h"
-#include "TRandom3.h"
-#include "TObjArray.h"
-#include "TDatabasePDG.h"
-#include "TLorentzVector.h"
-
-#include <algorithm>
-#include <stdexcept>
-#include <iostream>
-#include <sstream>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-DualReadoutCalorimeter::DualReadoutCalorimeter() :
-  fECalResolutionFormula(0), fHCalResolutionFormula(0),
-  fItParticleInputArray(0), fItTrackInputArray(0)
-{
-
-  fECalResolutionFormula = new DelphesFormula;
-  fHCalResolutionFormula = new DelphesFormula;
-
-  fECalTowerTrackArray = new TObjArray;
-  fItECalTowerTrackArray = fECalTowerTrackArray->MakeIterator();
-
-  fHCalTowerTrackArray = new TObjArray;
-  fItHCalTowerTrackArray = fHCalTowerTrackArray->MakeIterator();
-
-  fTowerTrackArray = new TObjArray;
-  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
-
-}
-
-//------------------------------------------------------------------------------
-
-DualReadoutCalorimeter::~DualReadoutCalorimeter()
-{
-
-  if(fECalResolutionFormula) delete fECalResolutionFormula;
-  if(fHCalResolutionFormula) delete fHCalResolutionFormula;
-
-  if(fECalTowerTrackArray) delete fECalTowerTrackArray;
-  if(fItECalTowerTrackArray) delete fItECalTowerTrackArray;
-
-  if(fHCalTowerTrackArray) delete fHCalTowerTrackArray;
-  if(fItHCalTowerTrackArray) delete fItHCalTowerTrackArray;
-
-  if(fTowerTrackArray) delete fTowerTrackArray;
-  if(fItTowerTrackArray) delete fItTowerTrackArray;
-
-}
-
-//------------------------------------------------------------------------------
-
-void DualReadoutCalorimeter::Init()
-{
-  ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
-  Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
-  Double_t ecalFraction, hcalFraction;
-  TBinMap::iterator itEtaBin;
-  set< Double_t >::iterator itPhiBin;
-  vector< Double_t > *phiBins;
-
-  // read eta and phi bins
-  param = GetParam("EtaPhiBins");
-  size = param.GetSize();
-  fBinMap.clear();
-  fEtaBins.clear();
-  fPhiBins.clear();
-  for(i = 0; i < size/2; ++i)
-  {
-    paramEtaBins = param[i*2];
-    sizeEtaBins = paramEtaBins.GetSize();
-    paramPhiBins = param[i*2 + 1];
-    sizePhiBins = paramPhiBins.GetSize();
-
-    for(j = 0; j < sizeEtaBins; ++j)
-    {
-      for(k = 0; k < sizePhiBins; ++k)
-      {
-        fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
-      }
-    }
-  }
-
-  // for better performance we transform map of sets to parallel vectors:
-  // vector< double > and vector< vector< double >* >
-  for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
-  {
-    fEtaBins.push_back(itEtaBin->first);
-    phiBins = new vector< double >(itEtaBin->second.size());
-    fPhiBins.push_back(phiBins);
-    phiBins->clear();
-    for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
-    {
-      phiBins->push_back(*itPhiBin);
-    }
-  }
-
-  // read energy fractions for different particles
-  param = GetParam("EnergyFraction");
-  size = param.GetSize();
-
-  // set default energy fractions values
-  fFractionMap.clear();
-  fFractionMap[0] = make_pair(0.0, 1.0);
-
-  for(i = 0; i < size/2; ++i)
-  {
-    paramFractions = param[i*2 + 1];
-
-    ecalFraction = paramFractions[0].GetDouble();
-    hcalFraction = paramFractions[1].GetDouble();
-
-    fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
-  }
-
-  // read min E value for timing measurement in ECAL
-  fTimingEnergyMin = GetDouble("TimingEnergyMin",4.);
-  // For timing
-  // So far this flag needs to be false
-  // Curved extrapolation not supported
-  fElectronsFromTrack = false;
-
-  // read min E value for towers to be saved
-  fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
-  fHCalEnergyMin = GetDouble("HCalEnergyMin", 0.0);
-  fEnergyMin = GetDouble("EnergyMin", 0.0);
-
-  fECalEnergySignificanceMin = GetDouble("ECalEnergySignificanceMin", 0.0);
-  fHCalEnergySignificanceMin = GetDouble("HCalEnergySignificanceMin", 0.0);
-  fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0);
-
-  // switch on or off the dithering of the center of DualReadoutCalorimeter towers
-  fSmearTowerCenter = GetBool("SmearTowerCenter", true);
-
-  // read resolution formulas
-  fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0"));
-  fHCalResolutionFormula->Compile(GetString("HCalResolutionFormula", "0"));
-
-  // import array with output from other modules
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
-  fItParticleInputArray = fParticleInputArray->MakeIterator();
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  // create output arrays
-  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
-  fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons"));
-
-  fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
-  fEFlowPhotonOutputArray = ExportArray(GetString("EFlowPhotonOutputArray", "eflowPhotons"));
-  fEFlowNeutralHadronOutputArray = ExportArray(GetString("EFlowNeutralHadronOutputArray", "eflowNeutralHadrons"));
-}
-
-//------------------------------------------------------------------------------
-
-void DualReadoutCalorimeter::Finish()
-{
-  vector< vector< Double_t >* >::iterator itPhiBin;
-  if(fItParticleInputArray) delete fItParticleInputArray;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
-  {
-    delete *itPhiBin;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void DualReadoutCalorimeter::Process()
-{
-  Candidate *particle, *track;
-  TLorentzVector position, momentum;
-  Short_t etaBin, phiBin, flags;
-  Int_t number;
-  Long64_t towerHit, towerEtaPhi, hitEtaPhi;
-  Double_t ecalFraction, hcalFraction;
-  Double_t ecalEnergy, hcalEnergy;
-  Double_t ecalSigma, hcalSigma, sigma;
-  Double_t energyGuess, energy;
-  Int_t pdgCode;
-
-  TFractionMap::iterator itFractionMap;
-
-  vector< Double_t >::iterator itEtaBin;
-  vector< Double_t >::iterator itPhiBin;
-  vector< Double_t > *phiBins;
-
-  vector< Long64_t >::iterator itTowerHits;
-
-  DelphesFactory *factory = GetFactory();
-  fTowerHits.clear();
-  fECalTowerFractions.clear();
-  fHCalTowerFractions.clear();
-  fECalTrackFractions.clear();
-  fHCalTrackFractions.clear();
-
-  // loop over all particles
-  fItParticleInputArray->Reset();
-  number = -1;
-  fTowerRmax=0.;
-
-  //cout<<"--------- new event ---------- "<<endl;
-
-  while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
-  {
-    const TLorentzVector &particlePosition = particle->Position;
-    ++number;
-
-    // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower)
-    if (particlePosition.Perp() > fTowerRmax)
-      fTowerRmax=particlePosition.Perp();
-
-    pdgCode = TMath::Abs(particle->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    ecalFraction = itFractionMap->second.first;
-    hcalFraction = itFractionMap->second.second;
-
-    fECalTowerFractions.push_back(ecalFraction);
-    fHCalTowerFractions.push_back(hcalFraction);
-
-    if(ecalFraction < 1.0E-9 && hcalFraction < 1.0E-9) continue;
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), particlePosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), particlePosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 0;
-    flags |= (pdgCode == 11 || pdgCode == 22) << 1;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // loop over all tracks
-  fItTrackInputArray->Reset();
-  number = -1;
-  while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
-  {
-    const TLorentzVector &trackPosition = track->Position;
-    ++number;
-
-    pdgCode = TMath::Abs(track->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    ecalFraction = itFractionMap->second.first;
-    hcalFraction = itFractionMap->second.second;
-
-    fECalTrackFractions.push_back(ecalFraction);
-    fHCalTrackFractions.push_back(hcalFraction);
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 1;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // all hits are sorted first by eta bin number, then by phi bin number,
-  // then by flags and then by particle or track number
-  sort(fTowerHits.begin(), fTowerHits.end());
-
-  // loop over all hits
-  towerEtaPhi = 0;
-  fTower = 0;
-  for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
-  {
-    towerHit = (*itTowerHits);
-    flags = (towerHit >> 24) & 0x00000000000000FFLL;
-    number = (towerHit) & 0x0000000000FFFFFFLL;
-    hitEtaPhi = towerHit >> 32;
-
-    if(towerEtaPhi != hitEtaPhi)
-    {
-      // switch to next tower
-      towerEtaPhi = hitEtaPhi;
-
-      // finalize previous tower
-      FinalizeTower();
-
-      // create new tower
-      fTower = factory->NewCandidate();
-
-      phiBin = (towerHit >> 32) & 0x000000000000FFFFLL;
-      etaBin = (towerHit >> 48) & 0x000000000000FFFFLL;
-
-      // phi bins for given eta bin
-      phiBins = fPhiBins[etaBin];
-
-      // calculate eta and phi of the tower's center
-      fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
-      fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
-
-      fTowerEdges[0] = fEtaBins[etaBin - 1];
-      fTowerEdges[1] = fEtaBins[etaBin];
-      fTowerEdges[2] = (*phiBins)[phiBin - 1];
-      fTowerEdges[3] = (*phiBins)[phiBin];
-
-      fECalTowerEnergy = 0.0;
-      fHCalTowerEnergy = 0.0;
-
-      fECalTrackEnergy = 0.0;
-      fHCalTrackEnergy = 0.0;
-      fTrackEnergy = 0.0;
-
-      fECalTrackSigma = 0.0;
-      fHCalTrackSigma = 0.0;
-      fTrackSigma = 0.0;
-
-      fTowerTrackHits = 0;
-      fTowerPhotonHits = 0;
-
-      fTowerTime = 0.0;
-      fTowerTimeWeight = 0.0;
-
-      fECalTowerTrackArray->Clear();
-      fHCalTowerTrackArray->Clear();
-      fTowerTrackArray->Clear();
-
-    }
-
-    // check for track hits
-    if(flags & 1)
-    {
-      ++fTowerTrackHits;
-
-      track = static_cast<Candidate*>(fTrackInputArray->At(number));
-      momentum = track->Momentum;
-      position = track->Position;
-
-      ecalEnergy = momentum.E() * fECalTrackFractions[number];
-      hcalEnergy = momentum.E() * fHCalTrackFractions[number];
-      energy = ecalEnergy + hcalEnergy;
-
-      if(ecalEnergy > fTimingEnergyMin && fTower)
-      {
-        if(fElectronsFromTrack)
-        {
-          fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T()));
-        }
-      }
-
-      // in Dual Readout we do not care if tracks are ECAL of HCAL
-      if(fECalTrackFractions[number] > 1.0E-9 || fHCalTrackFractions[number] > 1.0E-9)
-      {
-        fTrackEnergy += energy;
-        // this sigma will be used to determine whether neutral excess is significant. We choose the resolution according to bthe higest deposited fraction (in practice had for charged hadrons and em for electrons)
-        sigma = 0.0;
-        if(fHCalTrackFractions[number] > 0)
-          sigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
-        else
-          sigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
-
-        if(sigma/momentum.E() < track->TrackResolution)
-          energyGuess = ecalEnergy + hcalEnergy;
-        else
-          energyGuess = momentum.E();
-
-        fTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess;
-        fTowerTrackArray->Add(track);
-      }
-      else
-      {
-        fEFlowTrackOutputArray->Add(track);
-      }
-
-      continue;
-    }
-
-    // check for photon and electron hits in current tower
-    if(flags & 2) ++fTowerPhotonHits;
-
-    particle = static_cast<Candidate*>(fParticleInputArray->At(number));
-    momentum = particle->Momentum;
-    position = particle->Position;
-
-
-    // fill current tower
-    ecalEnergy = momentum.E() * fECalTowerFractions[number];
-    hcalEnergy = momentum.E() * fHCalTowerFractions[number];
-
-    fECalTowerEnergy += ecalEnergy;
-    fHCalTowerEnergy += hcalEnergy;
-
-    // assume combined timing measurements in ECAL/HCAL sections
-    fTowerTime += (ecalEnergy + hcalEnergy) * position.T(); //sigma_t ~ 1/sqrt(E)
-    fTowerTimeWeight += ecalEnergy + hcalEnergy;
-
-    fTower->AddCandidate(particle);
-    fTower->Position = position;
-  }
-
-  // finalize last tower
-  FinalizeTower();
-}
-
-//------------------------------------------------------------------------------
-
-void DualReadoutCalorimeter::FinalizeTower()
-{
-
-  Candidate *track, *tower, *mother;
-  Double_t energy, pt, eta, phi, r, time;
-  Double_t ecalEnergy, hcalEnergy;
-  Double_t ecalNeutralEnergy, hcalNeutralEnergy, neutralEnergy;
-
-  Double_t ecalSigma, hcalSigma, sigma;
-  Double_t ecalNeutralSigma, hcalNeutralSigma, neutralSigma;
-
-  Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor;
-
-  TLorentzVector momentum;
-  TFractionMap::iterator itFractionMap;
-
-  Float_t weight, sumWeightedTime, sumWeight;
-
-  if(!fTower) return;
-
-  // if no hadronic energy, use ECAL resolution
-  if (fHCalTowerEnergy <= fHCalEnergyMin)
-  {
-    energy = fECalTowerEnergy;
-    sigma  = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
-  }
-
-  // if hadronic fraction > 0, use HCAL resolution
-  else
-  {
-    energy = fECalTowerEnergy + fHCalTowerEnergy;
-    sigma  = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
-  }
-
-  energy = LogNormal(energy, sigma);
-
-  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
-
-  // for now keep this the same
-  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fECalTowerEnergy);
-  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fHCalTowerEnergy);
-
-  ecalEnergy = LogNormal(fECalTowerEnergy, ecalSigma);
-  hcalEnergy = LogNormal(fHCalTowerEnergy, hcalSigma);
-
-  time = (fTowerTimeWeight < 1.0E-09) ? 0.0 : fTowerTime / fTowerTimeWeight;
-
-  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
-  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
-
-  if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0;
-  if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0;
-
-  if(fSmearTowerCenter)
-  {
-    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
-    phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
-  }
-  else
-  {
-    eta = fTowerEta;
-    phi = fTowerPhi;
-  }
-
-  pt = energy / TMath::CosH(eta);
-
-  // check whether barrel or endcap tower
-
-  // endcap
-  if (TMath::Abs(fTower->Position.Pt() - fTowerRmax) > 1.e-06 && TMath::Abs(eta) > 0.){
-    r = fTower->Position.Z()/TMath::SinH(eta);
-  }
-  // barrel
-  else {
-    r = fTower->Position.Pt();
-  }
-
-  fTower->Position.SetPtEtaPhiE(r, eta, phi, time);
-  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
-  fTower->L = fTower->Position.Vect().Mag();
-
-  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
-  fTower->Eem = ecalEnergy;
-  fTower->Ehad = hcalEnergy;
-  fTower->Etrk = fTrackEnergy;
-  fTower->Edges[0] = fTowerEdges[0];
-  fTower->Edges[1] = fTowerEdges[1];
-  fTower->Edges[2] = fTowerEdges[2];
-  fTower->Edges[3] = fTowerEdges[3];
-
-  if(energy > 0.0)
-  {
-    if(fTowerPhotonHits > 0 && fTowerTrackHits == 0)
-    {
-      fPhotonOutputArray->Add(fTower);
-    }
-    fTowerOutputArray->Add(fTower);
-  }
-
-  // fill energy flow candidates
-
-  fTrackSigma = TMath::Sqrt(fTrackSigma);
-  neutralEnergy = max( (energy - fTrackEnergy) , 0.0);
-  neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma + sigma*sigma);
-
-  if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin)
-  {
-    // create new photon tower
-    tower = static_cast<Candidate*>(fTower->Clone());
-    pt = neutralEnergy / TMath::CosH(eta);
-    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy);
-
-    // if no hadronic energy, use ECAL resolution
-    if (fHCalTowerEnergy <= fHCalEnergyMin)
-    {
-      tower->Eem = neutralEnergy;
-      tower->Ehad = 0.0;
-      tower->PID = 22;
-      fEFlowPhotonOutputArray->Add(tower);
-    }
-    // if hadronic fraction > 0, use HCAL resolution
-    else
-    {
-      tower->Eem = 0;
-      tower->Ehad = neutralEnergy;
-      tower->PID = 130;
-      fEFlowNeutralHadronOutputArray->Add(tower);
-    }
-
-    //clone tracks
-    fItTowerTrackArray->Reset();
-    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate*>(track->Clone());
-      track->AddCandidate(mother);
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-
-
-  // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the DualReadoutCalorimeter and tracking
-  else if(fTrackEnergy > 0.0)
-  {
-    //cout<<"no significant neutral excess found:"<<endl;
-    weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma*fTrackSigma) : 0.0;
-    weightCalo  = (sigma > 0.0) ? 1 / (sigma*sigma) : 0.0;
-
-    bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo);
-    rescaleFactor = bestEnergyEstimate/fTrackEnergy;
-
-    //rescale tracks
-    fItTowerTrackArray->Reset();
-    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-      track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M());
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-
-
-}
-
-//------------------------------------------------------------------------------
-
-Double_t DualReadoutCalorimeter::LogNormal(Double_t mean, Double_t sigma)
-{
-  Double_t a, b;
-
-  if(mean > 0.0)
-  {
-    b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean))));
-    a = TMath::Log(mean) - 0.5*b*b;
-
-    return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0));
-  }
-  else
-  {
-    return 0.0;
-  }
-}
Index: modules/DualReadoutCalorimeter.h
===================================================================
--- modules/DualReadoutCalorimeter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DualReadoutCalorimeter_h
-#define DualReadoutCalorimeter_h
-
-/** \class DualReadoutCalorimeter
- *
- *  Fills DualReadoutCalorimeter towers, performs DualReadoutCalorimeter resolution smearing,
- *  and creates energy flow objects (tracks, photons, and neutral hadrons).
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <set>
-#include <vector>
-
-class TObjArray;
-class DelphesFormula;
-class Candidate;
-
-class DualReadoutCalorimeter: public DelphesModule
-{
-public:
-
-  DualReadoutCalorimeter();
-  ~DualReadoutCalorimeter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  typedef std::map< Long64_t, std::pair< Double_t, Double_t > > TFractionMap; //!
-  typedef std::map< Double_t, std::set< Double_t > > TBinMap; //!
-
-  Candidate *fTower;
-  Double_t fTowerEta, fTowerPhi, fTowerEdges[4];
-  Double_t fECalTowerEnergy, fHCalTowerEnergy;
-  Double_t fECalTrackEnergy, fHCalTrackEnergy;
-  Double_t fTrackEnergy;
-  Double_t fTowerRmax;
-
-  Double_t fTimingEnergyMin;
-  Bool_t fElectronsFromTrack;
-
-  Int_t fTowerTrackHits, fTowerPhotonHits;
-
-  Double_t fECalEnergyMin;
-  Double_t fHCalEnergyMin;
-  Double_t fEnergyMin;
-
-  Double_t fECalEnergySignificanceMin;
-  Double_t fHCalEnergySignificanceMin;
-  Double_t fEnergySignificanceMin;
-
-  Double_t fECalTrackSigma;
-  Double_t fHCalTrackSigma;
-  Double_t fTrackSigma;
-
-  Double_t fTowerTime;
-  Double_t fTowerTimeWeight;
-
-  Bool_t fSmearTowerCenter;
-
-  TFractionMap fFractionMap; //!
-  TBinMap fBinMap; //!
-
-  std::vector < Double_t > fEtaBins;
-  std::vector < std::vector < Double_t >* > fPhiBins;
-
-  std::vector < Long64_t > fTowerHits;
-
-  std::vector < Double_t > fECalTowerFractions;
-  std::vector < Double_t > fHCalTowerFractions;
-
-  std::vector < Double_t > fECalTrackFractions;
-  std::vector < Double_t > fHCalTrackFractions;
-
-  DelphesFormula *fECalResolutionFormula; //!
-  DelphesFormula *fHCalResolutionFormula; //!
-
-  TIterator *fItParticleInputArray; //!
-  TIterator *fItTrackInputArray; //!
-
-  const TObjArray *fParticleInputArray; //!
-  const TObjArray *fTrackInputArray; //!
-
-  TObjArray *fTowerOutputArray; //!
-  TObjArray *fPhotonOutputArray; //!
-
-  TObjArray *fEFlowTrackOutputArray; //!
-  TObjArray *fEFlowPhotonOutputArray; //!
-  TObjArray *fEFlowNeutralHadronOutputArray; //!
-
-  TObjArray *fECalTowerTrackArray; //!
-  TIterator *fItECalTowerTrackArray; //!
-
-  TObjArray *fHCalTowerTrackArray; //!
-  TIterator *fItHCalTowerTrackArray; //!
-
-  TObjArray *fTowerTrackArray; //!
-  TIterator *fItTowerTrackArray; //!
-
-  void FinalizeTower();
-  Double_t LogNormal(Double_t mean, Double_t sigma);
-
-  ClassDef(DualReadoutCalorimeter, 1)
-};
-
-#endif
Index: modules/Efficiency.cc
===================================================================
--- modules/Efficiency.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Efficiency.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class Efficiency
  *
  *  Selects candidates from the InputArray according to the efficiency formula.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -78,7 +65,4 @@
   fItInputArray = fInputArray->MakeIterator();
 
-  // switch to compute efficiency based on momentum vector eta, phi
-  fUseMomentumVector = GetBool("UseMomentumVector", false);
-
   // create output array
 
@@ -96,11 +80,10 @@
 
 void Efficiency::Process()
-{
+{ 
   Candidate *candidate;
-  Double_t pt, eta, phi, e;
-
+  Double_t pt, eta, phi;
 
   fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
     const TLorentzVector &candidatePosition = candidate->Position;
@@ -108,16 +91,9 @@
     eta = candidatePosition.Eta();
     phi = candidatePosition.Phi();
-
-    if (fUseMomentumVector){
-      eta = candidateMomentum.Eta();
-      phi = candidateMomentum.Phi();
-    }
-
     pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
 
     // apply an efficency formula
-    if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e, candidate)) continue;
-
+    if(gRandom->Uniform() > fFormula->Eval(pt, eta)) continue;
+    
     fOutputArray->Add(candidate);
   }
Index: modules/Efficiency.h
===================================================================
--- modules/Efficiency.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Efficiency.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef Efficiency_h
 #define Efficiency_h
@@ -23,4 +5,8 @@
  *
  *  Selects candidates from the InputArray according to the efficiency formula.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -37,4 +23,5 @@
 {
 public:
+
   Efficiency();
   ~Efficiency();
@@ -45,4 +32,5 @@
 
 private:
+
   DelphesFormula *fFormula; //!
 
@@ -53,6 +41,4 @@
   TObjArray *fOutputArray; //!
 
-  Double_t fUseMomentumVector; //!
-
   ClassDef(Efficiency, 1)
 };
Index: modules/EnergyScale.cc
===================================================================
--- modules/EnergyScale.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class EnergyScale
- *
- *  Applies energy scale.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/EnergyScale.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-EnergyScale::EnergyScale() :
-  fFormula(0), fItInputArray(0)
-{
-  fFormula = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-EnergyScale::~EnergyScale()
-{
-  if(fFormula) delete fFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void EnergyScale::Init()
-{
-  // read resolution formula
-
-  fFormula->Compile(GetString("ScaleFormula", "0.0"));
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "FastJetFinder/jets"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
-}
-
-//------------------------------------------------------------------------------
-
-void EnergyScale::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void EnergyScale::Process()
-{
-  Candidate *candidate;
-  TLorentzVector momentum;
-  Double_t scale;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    momentum = candidate->Momentum;
-
-    scale = fFormula->Eval(momentum.Pt(), momentum.Eta(), momentum.Phi(), momentum.E());
-
-    if(scale > 0.0) momentum *= scale;
-
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->Momentum = momentum;
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/EnergyScale.h
===================================================================
--- modules/EnergyScale.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef EnergyScale_h
-#define EnergyScale_h
-
-/** \class EnergyScale
- *
- *  Applies energy scale.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class EnergyScale: public DelphesModule
-{
-public:
-  EnergyScale();
-  ~EnergyScale();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesFormula *fFormula; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(EnergyScale, 1)
-};
-
-#endif
Index: modules/EnergySmearing.cc
===================================================================
--- modules/EnergySmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/EnergySmearing.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class EnergySmearing
  *
  *  Performs energy resolution smearing.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -86,5 +73,5 @@
 
 void EnergySmearing::Finish()
-{
+{  
   if(fItInputArray) delete fItInputArray;
 }
@@ -95,32 +82,27 @@
 {
   Candidate *candidate, *mother;
-  Double_t pt, energy, eta, phi, m;
+  Double_t energy, eta, phi;
 
   fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
     const TLorentzVector &candidatePosition = candidate->Position;
     const TLorentzVector &candidateMomentum = candidate->Momentum;
-
-    pt = candidatePosition.Pt();
     eta = candidatePosition.Eta();
     phi = candidatePosition.Phi();
     energy = candidateMomentum.E();
-    m = candidateMomentum.M();
-
+ 
     // apply smearing formula
-    energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy));
-
+    energy = gRandom->Gaus(energy, fFormula->Eval(0.0, eta, 0.0, energy));
+     
     if(energy <= 0.0) continue;
-
+ 
     mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
+    candidate = static_cast<Candidate*>(candidate->Clone());
     eta = candidateMomentum.Eta();
     phi = candidateMomentum.Phi();
-    pt = (energy > m) ? TMath::Sqrt(energy*energy - m*m)/TMath::CosH(eta) : 0;
-    candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
-    candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E();
+    candidate->Momentum.SetPtEtaPhiE(energy/TMath::CosH(eta), eta, phi, energy);
     candidate->AddCandidate(mother);
-
+ 
     fOutputArray->Add(candidate);
   }
Index: modules/EnergySmearing.h
===================================================================
--- modules/EnergySmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/EnergySmearing.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef EnergySmearing_h
 #define EnergySmearing_h
@@ -23,4 +5,8 @@
  *
  *  Performs energy resolution smearing.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -37,4 +23,5 @@
 {
 public:
+
   EnergySmearing();
   ~EnergySmearing();
@@ -45,4 +32,5 @@
 
 private:
+
   DelphesFormula *fFormula; //!
 
@@ -50,5 +38,5 @@
 
   const TObjArray *fInputArray; //!
-
+  
   TObjArray *fOutputArray; //!
 
Index: modules/ExampleModule.cc
===================================================================
--- modules/ExampleModule.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ExampleModule.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class ExampleModule
  *
  *  Selects candidates from the InputArray according to the efficiency formula.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -86,5 +73,5 @@
     fArrayParam.push_back(param[i].GetDouble());
   }
-
+  
   // import input array(s)
 
@@ -95,4 +82,5 @@
 
   fOutputArray = ExportArray(GetString("OutputArray", "jets"));
+
 }
 
@@ -113,5 +101,5 @@
   // loop over all input candidates
   fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
     candidatePosition = candidate->Position;
Index: modules/ExampleModule.h
===================================================================
--- modules/ExampleModule.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ExampleModule.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef ExampleModule_h
 #define ExampleModule_h
@@ -23,4 +5,8 @@
  *
  *  Selects candidates from the InputArray according to the efficiency formula.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -38,4 +24,5 @@
 {
 public:
+
   ExampleModule();
   ~ExampleModule();
@@ -46,9 +33,10 @@
 
 private:
+
   Int_t fIntParam;
   Double_t fDoubleParam;
-
-  std::deque<Double_t> fArrayParam;
-
+  
+  std::deque <Double_t> fArrayParam;
+  
   DelphesFormula *fFormula; //!
 
Index: modules/FastJetFinder.cc
===================================================================
--- modules/FastJetFinder.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/FastJetFinder.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class FastJetFinder
  *
  *  Finds jets using FastJet library.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,54 +18,42 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
+
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 #include <vector>
 
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/JetDefinition.hh"
 #include "fastjet/ClusterSequence.hh"
+#include "fastjet/Selector.hh"
 #include "fastjet/ClusterSequenceArea.hh"
-#include "fastjet/JetDefinition.hh"
-#include "fastjet/PseudoJet.hh"
-#include "fastjet/Selector.hh"
 #include "fastjet/tools/JetMedianBackgroundEstimator.hh"
 
+#include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh"
+#include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"
 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh"
-#include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"
-#include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh"
-
-#include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh"
-#include "fastjet/contribs/Nsubjettiness/Njettiness.hh"
-#include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh"
-#include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh"
-
-#include "fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh"
-
-#include "fastjet/contribs/RecursiveTools/SoftDrop.hh"
-#include "fastjet/tools/Filter.hh"
-#include "fastjet/tools/Pruner.hh"
 
 using namespace std;
 using namespace fastjet;
-using namespace fastjet::contrib;
 
 //------------------------------------------------------------------------------
 
 FastJetFinder::FastJetFinder() :
-  fPlugin(0), fRecomb(0), fAxesDef(0), fMeasureDef(0), fNjettinessPlugin(0), fValenciaPlugin(0),
-  fDefinition(0), fAreaDefinition(0), fItInputArray(0)
-{
+  fPlugin(0), fDefinition(0), fAreaDefinition(0), fItInputArray(0)
+{
+
 }
 
@@ -87,4 +62,5 @@
 FastJetFinder::~FastJetFinder()
 {
+
 }
 
@@ -93,10 +69,5 @@
 void FastJetFinder::Init()
 {
-  JetDefinition::Plugin *plugin = 0;
-  JetDefinition::Recombiner *recomb = 0;
-  ExRootConfParam param;
-  Long_t i, size;
-  Double_t etaMin, etaMax;
-  TEstimatorStruct estimatorStruct;
+  JetDefinition::Plugin *plugin = NULL;
 
   // define algorithm
@@ -104,5 +75,4 @@
   fJetAlgorithm = GetInt("JetAlgorithm", 6);
   fParameterR = GetDouble("ParameterR", 0.5);
-  fParameterP = GetDouble("ParameterP", -1.0);
 
   fConeRadius = GetDouble("ConeRadius", 0.5);
@@ -112,70 +82,13 @@
   fMaxPairSize = GetInt("MaxPairSize", 2);
   fIratch = GetInt("Iratch", 1);
-  fAdjacencyCut = GetInt("AdjacencyCut", 2);
+  fAdjacencyCut = GetDouble("AdjacencyCut", 2.0);
   fOverlapThreshold = GetDouble("OverlapThreshold", 0.75);
 
   fJetPTMin = GetDouble("JetPTMin", 10.0);
 
-  //-- N(sub)jettiness parameters --
-
-  fComputeNsubjettiness = GetBool("ComputeNsubjettiness", false);
-  fBeta = GetDouble("Beta", 1.0);
-  fAxisMode = GetInt("AxisMode", 1);
-  fRcutOff = GetDouble("RcutOff", 0.8); // used only if Njettiness is used as jet clustering algo (case 8)
-  fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8)
-
-  //-- Exclusive clustering for e+e- collisions --
-
-  fNJets = GetInt("NJets", 2);
-  fExclusiveClustering = GetBool("ExclusiveClustering", false);
-
-  //-- Valencia Linear Collider algorithm
-
-  fGamma = GetDouble("Gamma", 1.0);
-  //fBeta parameter see above
-
-  fMeasureDef = new NormalizedMeasure(fBeta, fParameterR);
-
-  switch(fAxisMode)
-  {
-  default:
-  case 1:
-    fAxesDef = new WTA_KT_Axes();
-    break;
-  case 2:
-    fAxesDef = new OnePass_WTA_KT_Axes();
-    break;
-  case 3:
-    fAxesDef = new KT_Axes();
-    break;
-  case 4:
-    fAxesDef = new OnePass_KT_Axes();
-  }
-
-  //-- Trimming parameters --
-
-  fComputeTrimming = GetBool("ComputeTrimming", false);
-  fRTrim = GetDouble("RTrim", 0.2);
-  fPtFracTrim = GetDouble("PtFracTrim", 0.05);
-
-  //-- Pruning parameters --
-
-  fComputePruning = GetBool("ComputePruning", false);
-  fZcutPrun = GetDouble("ZcutPrun", 0.1);
-  fRcutPrun = GetDouble("RcutPrun", 0.5);
-  fRPrun = GetDouble("RPrun", 0.8);
-
-  //-- SoftDrop parameters --
-
-  fComputeSoftDrop = GetBool("ComputeSoftDrop", false);
-  fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0);
-  fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1);
-  fR0SoftDrop = GetDouble("R0SoftDrop=", 0.8);
-
   // ---  Jet Area Parameters ---
-
   fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
   fComputeRho = GetBool("ComputeRho", false);
-
+  fRhoEtaMax = GetDouble("RhoEtaMax", 5.0);
   // - ghost based areas -
   fGhostEtaMax = GetDouble("GhostEtaMax", 5.0);
@@ -185,5 +98,4 @@
   fPtScatter = GetDouble("PtScatter", 0.1);
   fMeanGhostPt = GetDouble("MeanGhostPt", 1.0E-100);
-
   // - voronoi based areas -
   fEffectiveRfact = GetDouble("EffectiveRfact", 1.0);
@@ -191,91 +103,55 @@
   switch(fAreaAlgorithm)
   {
-  default:
-  case 0:
-    fAreaDefinition = 0;
-    break;
-  case 1:
-    fAreaDefinition = new AreaDefinition(active_area_explicit_ghosts, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
-    break;
-  case 2:
-    fAreaDefinition = new AreaDefinition(one_ghost_passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
-    break;
-  case 3:
-    fAreaDefinition = new AreaDefinition(passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
-    break;
-  case 4:
-    fAreaDefinition = new AreaDefinition(VoronoiAreaSpec(fEffectiveRfact));
-    break;
-  case 5:
-    fAreaDefinition = new AreaDefinition(active_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
-    break;
+    case 1:
+      fAreaDefinition = new fastjet::AreaDefinition(active_area_explicit_ghosts, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
+      break;
+    case 2:
+      fAreaDefinition = new fastjet::AreaDefinition(one_ghost_passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
+      break;
+    case 3:
+      fAreaDefinition = new fastjet::AreaDefinition(passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
+      break;
+    case 4:
+      fAreaDefinition = new fastjet::AreaDefinition(VoronoiAreaSpec(fEffectiveRfact));
+      break;
+    case 5:
+      fAreaDefinition = new fastjet::AreaDefinition(active_area, GhostedAreaSpec(fGhostEtaMax));
+      break;
+    default:
+    case 0:
+      fAreaDefinition = 0;
+      break;
   }
 
   switch(fJetAlgorithm)
   {
-  case 1:
-    plugin = new CDFJetCluPlugin(fSeedThreshold, fConeRadius, fAdjacencyCut, fMaxIterations, fIratch, fOverlapThreshold);
-    fDefinition = new JetDefinition(plugin);
-    break;
-  case 2:
-    plugin = new CDFMidPointPlugin(fSeedThreshold, fConeRadius, fConeAreaFraction, fMaxPairSize, fMaxIterations, fOverlapThreshold);
-    fDefinition = new JetDefinition(plugin);
-    break;
-  case 3:
-    plugin = new SISConePlugin(fConeRadius, fOverlapThreshold, fMaxIterations, fJetPTMin);
-    fDefinition = new JetDefinition(plugin);
-    break;
-  case 4:
-    fDefinition = new JetDefinition(kt_algorithm, fParameterR);
-    break;
-  case 5:
-    fDefinition = new JetDefinition(cambridge_algorithm, fParameterR);
-    break;
-  default:
-  case 6:
-    fDefinition = new JetDefinition(antikt_algorithm, fParameterR);
-    break;
-  case 7:
-    recomb = new WinnerTakeAllRecombiner();
-    fDefinition = new JetDefinition(antikt_algorithm, fParameterR, recomb, Best);
-    break;
-  case 8:
-    fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);
-    fDefinition = new JetDefinition(fNjettinessPlugin);
-    break;
-  case 9:
-    fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma);
-    fDefinition = new JetDefinition(fValenciaPlugin);
-    break;
-  case 10:
-    fDefinition = new JetDefinition(ee_genkt_algorithm,fParameterR,fParameterP);
-    break;
-
-  }
-
+    case 1: 
+      plugin = new fastjet::CDFJetCluPlugin(fSeedThreshold, fConeRadius, fAdjacencyCut, fMaxIterations, fIratch, fOverlapThreshold);
+      fDefinition = new fastjet::JetDefinition(plugin);
+      break;
+    case 2:
+      plugin = new fastjet::CDFMidPointPlugin(fSeedThreshold, fConeRadius, fConeAreaFraction, fMaxPairSize, fMaxIterations, fOverlapThreshold);
+      fDefinition = new fastjet::JetDefinition(plugin);
+      break;
+    case 3:
+      plugin = new fastjet::SISConePlugin(fConeRadius, fOverlapThreshold, fMaxIterations, fJetPTMin);
+      fDefinition = new fastjet::JetDefinition(plugin);
+      break;
+    case 4:
+      fDefinition = new fastjet::JetDefinition(fastjet::kt_algorithm, fParameterR);
+      break;
+    case 5:
+      fDefinition = new fastjet::JetDefinition(fastjet::cambridge_algorithm, fParameterR);
+      break;
+    default:
+    case 6:
+      fDefinition = new fastjet::JetDefinition(fastjet::antikt_algorithm, fParameterR);
+      break;
+  }
+  
   fPlugin = plugin;
-  fRecomb = recomb;
 
   ClusterSequence::print_banner();
-
-  if(fComputeRho && fAreaDefinition)
-  {
-    // read eta ranges
-
-    param = GetParam("RhoEtaRange");
-    size = param.GetSize();
-
-    fEstimators.clear();
-    for(i = 0; i < size / 2; ++i)
-    {
-      etaMin = param[i * 2].GetDouble();
-      etaMax = param[i * 2 + 1].GetDouble();
-      estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorRapRange(etaMin, etaMax), *fDefinition, *fAreaDefinition);
-      estimatorStruct.etaMin = etaMin;
-      estimatorStruct.etaMax = etaMax;
-      fEstimators.push_back(estimatorStruct);
-    }
-  }
-
+  
   // import input array
 
@@ -287,5 +163,4 @@
   fOutputArray = ExportArray(GetString("OutputArray", "jets"));
   fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho"));
-  fConstituentsOutputArray = ExportArray(GetString("ConstituentsOutputArray", "constituents"));
 }
 
@@ -294,20 +169,8 @@
 void FastJetFinder::Finish()
 {
-  vector<TEstimatorStruct>::iterator itEstimators;
-
-  for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
-  {
-    if(itEstimators->estimator) delete itEstimators->estimator;
-  }
-
   if(fItInputArray) delete fItInputArray;
   if(fDefinition) delete fDefinition;
   if(fAreaDefinition) delete fAreaDefinition;
-  if(fPlugin) delete static_cast<JetDefinition::Plugin *>(fPlugin);
-  if(fRecomb) delete static_cast<JetDefinition::Recombiner *>(fRecomb);
-  if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin *>(fNjettinessPlugin);
-  if(fAxesDef) delete fAxesDef;
-  if(fMeasureDef) delete fMeasureDef;
-  if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin *>(fValenciaPlugin);
+  if(fPlugin) delete static_cast<JetDefinition::Plugin*>(fPlugin);
 }
 
@@ -318,21 +181,10 @@
   Candidate *candidate, *constituent;
   TLorentzVector momentum;
-
   Double_t deta, dphi, detaMax, dphiMax;
-  Double_t time, timeWeight;
-  Double_t neutralEnergyFraction, chargedEnergyFraction;
-
-  Int_t number, ncharged, nneutrals;
-  Int_t charge;
-  Double_t rho = 0.0;
+  Int_t number;
+  Double_t rho = 0;
   PseudoJet jet, area;
+  vector<PseudoJet> inputList, outputList;
   ClusterSequence *sequence;
-  vector<PseudoJet> inputList, outputList, subjets;
-  vector<PseudoJet>::iterator itInputList, itOutputList;
-  vector<TEstimatorStruct>::iterator itEstimators;
-  Double_t excl_ymerge23 = 0.0;
-  Double_t excl_ymerge34 = 0.0;
-  Double_t excl_ymerge45 = 0.0;
-  Double_t excl_ymerge56 = 0.0;
 
   DelphesFactory *factory = GetFactory();
@@ -343,6 +195,6 @@
   fItInputArray->Reset();
   number = 0;
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
+  {   
     momentum = candidate->Momentum;
     jet = PseudoJet(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E());
@@ -351,6 +203,6 @@
     ++number;
   }
-
-  // construct jets
+   
+  // construct jets 
   if(fAreaDefinition)
   {
@@ -360,56 +212,29 @@
   {
     sequence = new ClusterSequence(inputList, *fDefinition);
-  }
+  } 
 
   // compute rho and store it
   if(fComputeRho && fAreaDefinition)
   {
-    for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
-    {
-      itEstimators->estimator->set_particles(inputList);
-      rho = itEstimators->estimator->rho();
-
-      candidate = factory->NewCandidate();
-      candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
-      candidate->Edges[0] = itEstimators->etaMin;
-      candidate->Edges[1] = itEstimators->etaMax;
-      fRhoOutputArray->Add(candidate);
-    }
-  }
-
+    Selector select_rapidity = SelectorAbsRapMax(fRhoEtaMax);
+    JetMedianBackgroundEstimator estimator(select_rapidity, *fDefinition, *fAreaDefinition);
+    estimator.set_particles(inputList);
+    rho = estimator.rho();
+
+    candidate = factory->NewCandidate();
+    candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho); 
+    fRhoOutputArray->Add(candidate);
+  }
+  
   outputList.clear();
-
-  if(fExclusiveClustering)
-  {
-    try
-    {
-      outputList = sorted_by_pt(sequence->exclusive_jets(fNJets));
-    }
-    catch(fastjet::Error)
-    {
-      outputList.clear();
-    }
-
-    excl_ymerge23 = sequence->exclusive_ymerge(2);
-    excl_ymerge34 = sequence->exclusive_ymerge(3);
-    excl_ymerge45 = sequence->exclusive_ymerge(4);
-    excl_ymerge56 = sequence->exclusive_ymerge(5);
-  }
-  else
-  {
-    outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin));
-  }
+  outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin));
 
   // loop over all jets and export them
   detaMax = 0.0;
   dphiMax = 0.0;
-
+  vector<PseudoJet>::iterator itInputList, itOutputList;
   for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList)
   {
-    jet = *itOutputList;
-    if(fJetAlgorithm == 7) jet = join(jet.constituents());
-
-    momentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
-
+    momentum.SetPxPyPzE(itOutputList->px(), itOutputList->py(), itOutputList->pz(), itOutputList->E());
     area.reset(0.0, 0.0, 0.0, 0.0);
     if(fAreaDefinition) area = itOutputList->area_4vector();
@@ -417,22 +242,9 @@
     candidate = factory->NewCandidate();
 
-    time = 0.0;
-    timeWeight = 0.0;
-
-    charge = 0;
-
-    ncharged = 0;
-    nneutrals = 0;
-
-    neutralEnergyFraction =0.;
-    chargedEnergyFraction =0.;
-
     inputList.clear();
     inputList = sequence->constituents(*itOutputList);
-
     for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList)
     {
-      if(itInputList->user_index() < 0) continue;
-      constituent = static_cast<Candidate *>(fInputArray->At(itInputList->user_index()));
+      constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index()));
 
       deta = TMath::Abs(momentum.Eta() - constituent->Momentum.Eta());
@@ -441,142 +253,12 @@
       if(dphi > dphiMax) dphiMax = dphi;
 
-      if(constituent->Charge == 0)
-      {
-        nneutrals++;
-        neutralEnergyFraction += constituent->Momentum.E();
-      }
-      else
-      {
-        ncharged++;
-        chargedEnergyFraction += constituent->Momentum.E();
-      }
-      
-      time += TMath::Sqrt(constituent->Momentum.E()) * (constituent->Position.T());
-      timeWeight += TMath::Sqrt(constituent->Momentum.E());
-
-      charge += constituent->Charge;
-
-      fConstituentsOutputArray->Add(constituent);
       candidate->AddCandidate(constituent);
     }
 
     candidate->Momentum = momentum;
-    candidate->Position.SetT(time / timeWeight);
     candidate->Area.SetPxPyPzE(area.px(), area.py(), area.pz(), area.E());
 
     candidate->DeltaEta = detaMax;
     candidate->DeltaPhi = dphiMax;
-    candidate->Charge = charge;
-    candidate->NNeutrals = nneutrals;
-    candidate->NCharged = ncharged;
-
-    candidate->NeutralEnergyFraction = (momentum.E() > 0 ) ? neutralEnergyFraction/momentum.E() : 0.0;
-    candidate->ChargedEnergyFraction = (momentum.E() > 0 ) ? chargedEnergyFraction/momentum.E() : 0.0;
-
-    //for exclusive clustering, access y_n,n+1 as exclusive_ymerge (fNJets);
-    candidate->ExclYmerge23 = excl_ymerge23;
-    candidate->ExclYmerge34 = excl_ymerge34;
-    candidate->ExclYmerge45 = excl_ymerge45;
-    candidate->ExclYmerge56 = excl_ymerge56;
-
-    //------------------------------------
-    // Trimming
-    //------------------------------------
-
-    if(fComputeTrimming)
-    {
-
-      fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, fRTrim), fastjet::SelectorPtFractionMin(fPtFracTrim));
-      fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList);
-      
-      candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m());
-
-      // four hardest subjets
-      subjets.clear();
-      subjets = trimmed_jet.pieces();
-      subjets = sorted_by_pt(subjets);
-
-      candidate->NSubJetsTrimmed = subjets.size();
-
-      for(size_t i = 0; i < subjets.size() and i < 4; i++)
-      {
-        if(subjets.at(i).pt() < 0) continue;
-        candidate->TrimmedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
-      }
-    }
-
-    //------------------------------------
-    // Pruning
-    //------------------------------------
-
-    if(fComputePruning)
-    {
-
-      fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm, fRPrun), fZcutPrun, fRcutPrun);
-      fastjet::PseudoJet pruned_jet = pruner(*itOutputList);
-
-      candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m());
-
-      // four hardest subjet
-      subjets.clear();
-      subjets = pruned_jet.pieces();
-      subjets = sorted_by_pt(subjets);
-
-      candidate->NSubJetsPruned = subjets.size();
-
-      for(size_t i = 0; i < subjets.size() and i < 4; i++)
-      {
-        if(subjets.at(i).pt() < 0) continue;
-        candidate->PrunedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
-      }
-    }
-
-    //------------------------------------
-    // SoftDrop
-    //------------------------------------
-
-    if(fComputeSoftDrop)
-    {
-
-      contrib::SoftDrop softDrop(fBetaSoftDrop, fSymmetryCutSoftDrop, fR0SoftDrop);
-      fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList);
-
-      candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m());
-
-      // four hardest subjet
-
-      subjets.clear();
-      subjets = softdrop_jet.pieces();
-      subjets = sorted_by_pt(subjets);
-      candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size();
-
-      candidate->SoftDroppedJet = candidate->SoftDroppedP4[0];
-
-      for(size_t i = 0; i < subjets.size() and i < 4; i++)
-      {
-        if(subjets.at(i).pt() < 0) continue;
-        candidate->SoftDroppedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
-        if(i == 0) candidate->SoftDroppedSubJet1 = candidate->SoftDroppedP4[i + 1];
-        if(i == 1) candidate->SoftDroppedSubJet2 = candidate->SoftDroppedP4[i + 1];
-      }
-    }
-
-    // --- compute N-subjettiness with N = 1,2,3,4,5 ----
-
-    if(fComputeNsubjettiness)
-    {
-
-      Nsubjettiness nSub1(1, *fAxesDef, *fMeasureDef);
-      Nsubjettiness nSub2(2, *fAxesDef, *fMeasureDef);
-      Nsubjettiness nSub3(3, *fAxesDef, *fMeasureDef);
-      Nsubjettiness nSub4(4, *fAxesDef, *fMeasureDef);
-      Nsubjettiness nSub5(5, *fAxesDef, *fMeasureDef);
-
-      candidate->Tau[0] = nSub1(*itOutputList);
-      candidate->Tau[1] = nSub2(*itOutputList);
-      candidate->Tau[2] = nSub3(*itOutputList);
-      candidate->Tau[3] = nSub4(*itOutputList);
-      candidate->Tau[4] = nSub5(*itOutputList);
-    }
 
     fOutputArray->Add(candidate);
Index: modules/FastJetFinder.h
===================================================================
--- modules/FastJetFinder.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/FastJetFinder.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef FastJetFinder_h
 #define FastJetFinder_h
@@ -23,4 +5,8 @@
  *
  *  Finds jets using FastJet library.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -35,21 +21,14 @@
 class TIterator;
 
-namespace fastjet
-{
-class JetDefinition;
-class AreaDefinition;
-class JetMedianBackgroundEstimator;
-namespace contrib
-{
-class NjettinessPlugin;
-class ValenciaPlugin;
-class AxesDefinition;
-class MeasureDefinition;
-} // namespace contrib
-} // namespace fastjet
+namespace fastjet {
+  class JetDefinition;
+  class AreaDefinition;
+  class Selector;
+}
 
 class FastJetFinder: public DelphesModule
 {
 public:
+
   FastJetFinder();
   ~FastJetFinder();
@@ -58,20 +37,12 @@
   void Process();
   void Finish();
+  
+private:
 
-private:
   void *fPlugin; //!
-  void *fRecomb; //!
-
-  fastjet::contrib::AxesDefinition *fAxesDef;
-  fastjet::contrib::MeasureDefinition *fMeasureDef;
-
-  fastjet::contrib::NjettinessPlugin *fNjettinessPlugin; //!
-  fastjet::contrib::ValenciaPlugin *fValenciaPlugin; //!
   fastjet::JetDefinition *fDefinition; //!
-
+   
   Int_t fJetAlgorithm;
   Double_t fParameterR;
-  Double_t fParameterP;
-
   Double_t fJetPTMin;
   Double_t fConeRadius;
@@ -81,49 +52,14 @@
   Int_t fMaxPairSize;
   Int_t fIratch;
-  Int_t fAdjacencyCut;
+  Double_t fAdjacencyCut;
   Double_t fOverlapThreshold;
-
-  //-- Exclusive clustering for e+e- collisions --
-
-  Int_t fNJets;
-  Bool_t fExclusiveClustering;
-
-  //-- Valencia Linear Collider algorithm
-  Double_t fGamma;
-
-  //-- N (sub)jettiness parameters --
-
-  Bool_t fComputeNsubjettiness;
-  Double_t fBeta;
-  Int_t fAxisMode;
-  Double_t fRcutOff;
-  Int_t fN;
-
-  //-- Trimming parameters --
-
-  Bool_t fComputeTrimming;
-  Double_t fRTrim;
-  Double_t fPtFracTrim;
-
-  //-- Pruning parameters --
-
-  Bool_t fComputePruning;
-  Double_t fZcutPrun;
-  Double_t fRcutPrun;
-  Double_t fRPrun;
-
-  //-- SoftDrop parameters --
-
-  Bool_t fComputeSoftDrop;
-  Double_t fBetaSoftDrop;
-  Double_t fSymmetryCutSoftDrop;
-  Double_t fR0SoftDrop;
-
+  
   // --- FastJet Area method --------
-
+  
   fastjet::AreaDefinition *fAreaDefinition;
-  Int_t fAreaAlgorithm;
-  Bool_t fComputeRho;
-
+  Int_t fAreaAlgorithm;  
+  Bool_t  fComputeRho; 
+  Double_t fRhoEtaMax;
+  
   // -- ghost based areas --
   Double_t fGhostEtaMax;
@@ -132,19 +68,10 @@
   Double_t fGridScatter;
   Double_t fPtScatter;
-  Double_t fMeanGhostPt;
-
+  Double_t fMeanGhostPt; 
+  
   // -- voronoi areas --
   Double_t fEffectiveRfact;
-
-#if !defined(__CINT__) && !defined(__CLING__)
-  struct TEstimatorStruct
-  {
-    fastjet::JetMedianBackgroundEstimator *estimator;
-    Double_t etaMin, etaMax;
-  };
-
-  std::vector<TEstimatorStruct> fEstimators; //!
-#endif
-
+  
+  
   TIterator *fItInputArray; //!
 
@@ -153,5 +80,4 @@
   TObjArray *fOutputArray; //!
   TObjArray *fRhoOutputArray; //!
-  TObjArray *fConstituentsOutputArray; //!
 
   ClassDef(FastJetFinder, 1)
Index: modules/FastJetGridMedianEstimator.cc
===================================================================
--- modules/FastJetGridMedianEstimator.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class FastJetGridMedianEstimator
- *
- *  Computes median energy density per event using a fixed grid.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/FastJetGridMedianEstimator.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include <utility>
-#include <vector>
-
-#include "fastjet/ClusterSequence.hh"
-#include "fastjet/ClusterSequenceArea.hh"
-#include "fastjet/JetDefinition.hh"
-#include "fastjet/PseudoJet.hh"
-#include "fastjet/RectangularGrid.hh"
-#include "fastjet/Selector.hh"
-#include "fastjet/tools/JetMedianBackgroundEstimator.hh"
-
-#include "fastjet/tools/GridMedianBackgroundEstimator.hh"
-
-#include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh"
-#include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"
-#include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh"
-
-#include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh"
-#include "fastjet/contribs/Nsubjettiness/Njettiness.hh"
-#include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh"
-#include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh"
-
-using namespace std;
-using namespace fastjet;
-using namespace fastjet::contrib;
-
-//------------------------------------------------------------------------------
-
-FastJetGridMedianEstimator::FastJetGridMedianEstimator() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-FastJetGridMedianEstimator::~FastJetGridMedianEstimator()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void FastJetGridMedianEstimator::Init()
-{
-  ExRootConfParam param;
-  Long_t i, size;
-  Double_t drap, dphi, rapMin, rapMax;
-
-  // read rapidity ranges
-
-  param = GetParam("GridRange");
-  size = param.GetSize();
-
-  fEstimators.clear();
-  for(i = 0; i < size / 4; ++i)
-  {
-    rapMin = param[i * 4].GetDouble();
-    rapMax = param[i * 4 + 1].GetDouble();
-    drap = param[i * 4 + 2].GetDouble();
-    dphi = param[i * 4 + 3].GetDouble();
-    fEstimators.push_back(new GridMedianBackgroundEstimator(rapMin, rapMax, drap, dphi));
-  }
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "Calorimeter/towers"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho"));
-}
-
-//------------------------------------------------------------------------------
-
-void FastJetGridMedianEstimator::Finish()
-{
-  vector<GridMedianBackgroundEstimator *>::iterator itEstimators;
-
-  for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
-  {
-    if(*itEstimators) delete *itEstimators;
-  }
-
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void FastJetGridMedianEstimator::Process()
-{
-  Candidate *candidate;
-  TLorentzVector momentum;
-  Int_t number;
-  Double_t rho = 0;
-  PseudoJet jet;
-  vector<PseudoJet> inputList, outputList;
-
-  vector<GridMedianBackgroundEstimator *>::iterator itEstimators;
-  ;
-
-  DelphesFactory *factory = GetFactory();
-
-  inputList.clear();
-
-  // loop over input objects
-  fItInputArray->Reset();
-  number = 0;
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    momentum = candidate->Momentum;
-    jet = PseudoJet(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E());
-    jet.set_user_index(number);
-    inputList.push_back(jet);
-    ++number;
-  }
-
-  // compute rho and store it
-
-  for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
-  {
-    (*itEstimators)->set_particles(inputList);
-
-    rho = (*itEstimators)->rho();
-
-    candidate = factory->NewCandidate();
-    candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
-    candidate->Edges[0] = (*itEstimators)->rapmin();
-    candidate->Edges[1] = (*itEstimators)->rapmax();
-    fRhoOutputArray->Add(candidate);
-  }
-}
Index: modules/FastJetGridMedianEstimator.h
===================================================================
--- modules/FastJetGridMedianEstimator.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef FastJetGridMedianEstimator_h
-#define FastJetGridMedianEstimator_h
-
-/** \class FastJetGridMedianEstimator
- *
- *  Computes median energy density per event using a fixed grid.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-#include <vector>
-
-class TObjArray;
-class TIterator;
-
-namespace fastjet
-{
-class GridMedianBackgroundEstimator;
-}
-
-class FastJetGridMedianEstimator: public DelphesModule
-{
-public:
-  FastJetGridMedianEstimator();
-  ~FastJetGridMedianEstimator();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  std::vector<fastjet::GridMedianBackgroundEstimator *> fEstimators; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fRhoOutputArray; //!
-
-  ClassDef(FastJetGridMedianEstimator, 1)
-};
-
-#endif
Index: modules/FastJetLinkDef.h
===================================================================
--- modules/FastJetLinkDef.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-/** \class
- *
- *  Lists classes to be included in cint dicitonary
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/FastJetFinder.h"
-#include "modules/FastJetGridMedianEstimator.h"
-#include "modules/RunPUPPI.h"
-
-#ifdef __CINT__
-
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ class FastJetFinder+;
-#pragma link C++ class FastJetGridMedianEstimator+;
-#pragma link C++ class RunPUPPI+;
-
-#endif
Index: modules/Hector.cc
===================================================================
--- modules/Hector.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class Hector
- *
- *  Propagates candidates using Hector library.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/Hector.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-#include "Hector/H_BeamLine.h"
-#include "Hector/H_BeamParticle.h"
-#include "Hector/H_RecRPObject.h"
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-Hector::Hector() :
-  fBeamLine(0), fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-Hector::~Hector()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Hector::Init()
-{
-  // read Hector parameters
-
-  fDirection = GetInt("Direction", 1);
-  fBeamLineLength = GetDouble("BeamLineLength", 430.0);
-  fDistance = GetDouble("Distance", 420.0);
-  fOffsetX = GetDouble("OffsetX", 0.0);
-  fOffsetS = GetDouble("OffsetS", 120.0);
-  fSigmaE = GetDouble("SigmaE", 0.0);
-  fSigmaX = GetDouble("SigmaX", 0.0);
-  fSigmaY = GetDouble("SigmaY", 0.0);
-  fSigmaT = GetDouble("SigmaT", 0.0);
-  fEtaMin = GetDouble("EtaMin", 5.0);
-
-  fBeamLine = new H_BeamLine(fDirection, fBeamLineLength + 0.1);
-  fBeamLine->fill(GetString("BeamLineFile", "cards/LHCB1IR5_5TeV.tfs"), fDirection, GetString("IPName", "IP5"));
-  fBeamLine->offsetElements(fOffsetS, fOffsetX);
-  fBeamLine->calcMatrix();
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "hits"));
-}
-
-//------------------------------------------------------------------------------
-
-void Hector::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-  if(fBeamLine) delete fBeamLine;
-}
-
-//------------------------------------------------------------------------------
-
-void Hector::Process()
-{
-  Candidate *candidate, *mother;
-  Double_t pz;
-  Double_t x, y, z, tx, ty, theta;
-  Double_t distance, time;
-
-  const Double_t c_light = 2.99792458E8;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidatePosition = candidate->Position;
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    pz = candidateMomentum.Pz();
-
-    if(TMath::Abs(candidateMomentum.Eta()) <= fEtaMin || TMath::Sign(pz, Double_t(fDirection)) != pz) continue;
-
-    x = 1.0E3 * candidatePosition.X();
-    y = 1.0E3 * candidatePosition.Y();
-    z = 1.0E-3 * candidatePosition.Z();
-
-    //    tx = 1.0E6 * TMath::ATan(candidateMomentum.Px()/pz);
-    //    ty = 1.0E6 * TMath::ATan(candidateMomentum.Py()/pz);
-
-    tx = 0.0;
-    ty = 0.0;
-
-    theta = TMath::Hypot(TMath::ATan(candidateMomentum.Px() / pz), TMath::ATan(candidateMomentum.Py() / pz));
-    distance = (fDistance - 1.0E-3 * candidatePosition.Z()) / TMath::Cos(theta);
-    time = gRandom->Gaus((distance + 1.0E-3 * candidatePosition.T()) / c_light, fSigmaT);
-
-    H_BeamParticle particle(candidate->Mass, candidate->Charge);
-    //    particle.set4Momentum(candidateMomentum);
-    particle.set4Momentum(candidateMomentum.Px(), candidateMomentum.Py(),
-      candidateMomentum.Pz(), candidateMomentum.E());
-    particle.setPosition(x, y, tx, ty, z);
-
-    particle.smearAng(fSigmaX, fSigmaY, gRandom);
-    particle.smearE(fSigmaE, gRandom);
-
-    particle.computePath(fBeamLine);
-
-    if(particle.stopped(fBeamLine)) continue;
-
-    particle.propagate(fDistance);
-
-    mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->Position.SetXYZT(particle.getX(), particle.getY(), particle.getS(), time);
-    candidate->Momentum.SetPxPyPzE(particle.getTX(), particle.getTY(), 0.0, particle.getE());
-    candidate->AddCandidate(mother);
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/Hector.h
===================================================================
--- modules/Hector.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef Hector_h
-#define Hector_h
-
-/** \class Hector
- *
- *  Propagates candidates using Hector library.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class H_BeamLine;
-
-class Hector: public DelphesModule
-{
-public:
-  Hector();
-  ~Hector();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Int_t fDirection;
-
-  Double_t fBeamLineLength, fDistance;
-  Double_t fOffsetX, fOffsetS;
-  Double_t fSigmaE, fSigmaX, fSigmaY, fSigmaT;
-  Double_t fEtaMin;
-
-  H_BeamLine *fBeamLine;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(Hector, 1)
-};
-
-#endif
Index: modules/IdentificationMap.cc
===================================================================
--- modules/IdentificationMap.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,183 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class IdentificationMap
- *
- *  Converts particles with some PDG code into another particle,
- *  according to parametrized probability.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/IdentificationMap.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-IdentificationMap::IdentificationMap() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-IdentificationMap::~IdentificationMap()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void IdentificationMap::Init()
-{
-  TMisIDMap::iterator itEfficiencyMap;
-  ExRootConfParam param;
-  DelphesFormula *formula;
-  Int_t i, size, pdg;
-
-  // read efficiency formulas
-  param = GetParam("EfficiencyFormula");
-  size = param.GetSize();
-
-  fEfficiencyMap.clear();
-  for(i = 0; i < size / 3; ++i)
-  {
-    formula = new DelphesFormula;
-    formula->Compile(param[i * 3 + 2].GetString());
-    pdg = param[i * 3].GetInt();
-    fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i * 3 + 1].GetInt(), formula)));
-  }
-
-  // set default efficiency formula
-  itEfficiencyMap = fEfficiencyMap.find(0);
-  if(itEfficiencyMap == fEfficiencyMap.end())
-  {
-    formula = new DelphesFormula;
-    formula->Compile("1.0");
-
-    fEfficiencyMap.insert(make_pair(0, make_pair(0, formula)));
-  }
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void IdentificationMap::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-
-  TMisIDMap::iterator itEfficiencyMap;
-  DelphesFormula *formula;
-  for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
-  {
-    formula = (itEfficiencyMap->second).second;
-    if(formula) delete formula;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void IdentificationMap::Process()
-{
-  Candidate *candidate;
-  Double_t pt, eta, phi, e;
-  TMisIDMap::iterator itEfficiencyMap;
-  pair<TMisIDMap::iterator, TMisIDMap::iterator> range;
-  DelphesFormula *formula;
-  Int_t pdgCodeIn, pdgCodeOut, charge;
-
-  Double_t p, r, total;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidatePosition = candidate->Position;
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    eta = candidatePosition.Eta();
-    phi = candidatePosition.Phi();
-    pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
-
-    pdgCodeIn = candidate->PID;
-    charge = candidate->Charge;
-
-    // first check that PID of this particle is specified in the map
-    // otherwise, look for PID = 0
-
-    itEfficiencyMap = fEfficiencyMap.find(pdgCodeIn);
-
-    range = fEfficiencyMap.equal_range(pdgCodeIn);
-    if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgCodeIn);
-    if(range.first == range.second) range = fEfficiencyMap.equal_range(0);
-
-    r = gRandom->Uniform();
-    total = 0.0;
-
-    // loop over sub-map for this PID
-    for(TMisIDMap::iterator it = range.first; it != range.second; ++it)
-    {
-      formula = (it->second).second;
-      pdgCodeOut = (it->second).first;
-
-      p = formula->Eval(pt, eta, phi, e);
-
-      if(total <= r && r < total + p)
-      {
-        // change PID of particle
-        candidate = static_cast<Candidate *>(candidate->Clone());
-        if(pdgCodeOut != 0) candidate->PID = charge * pdgCodeOut;
-        fOutputArray->Add(candidate);
-        break;
-      }
-
-      total += p;
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/IdentificationMap.h
===================================================================
--- modules/IdentificationMap.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IdentificationMap_h
-#define IdentificationMap_h
-
-/** \class IdentificationMap
- *
- *  Converts particles with some PDG code into another particle,
- *  according to parametrized probability.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class IdentificationMap: public DelphesModule
-{
-public:
-  IdentificationMap();
-  ~IdentificationMap();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  typedef std::multimap<Int_t, std::pair<Int_t, DelphesFormula *> > TMisIDMap; //!
-
-  TMisIDMap fEfficiencyMap; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(IdentificationMap, 1)
-};
-
-#endif
Index: modules/ImpactParameterSmearing.cc
===================================================================
--- modules/ImpactParameterSmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class ImpactParameterSmearing
- *
- *  Performs transverse impact parameter smearing.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/ImpactParameterSmearing.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-ImpactParameterSmearing::ImpactParameterSmearing() :
-  fFormula(0), fItInputArray(0)
-{
-  fFormula = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-ImpactParameterSmearing::~ImpactParameterSmearing()
-{
-  if(fFormula) delete fFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void ImpactParameterSmearing::Init()
-{
-  // read resolution formula
-
-  fFormula->Compile(GetString("ResolutionFormula", "0.0"));
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void ImpactParameterSmearing::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void ImpactParameterSmearing::Process()
-{
-  Candidate *candidate, *particle, *mother;
-  Double_t xd, yd, zd, d0, sx, sy, sz, dd0;
-  Double_t pt, eta, px, py, phi, e;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    // take momentum before smearing (otherwise apply double smearing on d0)
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-
-    const TLorentzVector &candidateMomentum = particle->Momentum;
-
-    eta = candidateMomentum.Eta();
-    pt = candidateMomentum.Pt();
-    phi = candidateMomentum.Phi();
-    e = candidateMomentum.E();
-
-    px = candidateMomentum.Px();
-    py = candidateMomentum.Py();
-
-    // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd
-    xd = candidate->Xd;
-    yd = candidate->Yd;
-    zd = candidate->Zd;
-
-    // calculate smeared values
-    sx = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
-    sy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
-    sz = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
-
-    xd += sx;
-    yd += sy;
-    zd += sz;
-
-    // calculate impact parameter (after-smearing)
-    d0 = (xd * py - yd * px) / pt;
-
-    dd0 = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
-
-    // fill smeared values in candidate
-    mother = candidate;
-
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->Xd = xd;
-    candidate->Yd = yd;
-    candidate->Zd = zd;
-
-    candidate->D0 = d0;
-    candidate->ErrorD0 = dd0;
-
-    candidate->AddCandidate(mother);
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/ImpactParameterSmearing.h
===================================================================
--- modules/ImpactParameterSmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef ImpactParameterSmearing_h
-#define ImpactParameterSmearing_h
-
-/** \class ImpactParameterSmearing
- *
- *  Performs transverse impact parameter smearing.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class ImpactParameterSmearing: public DelphesModule
-{
-public:
-  ImpactParameterSmearing();
-  ~ImpactParameterSmearing();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesFormula *fFormula; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(ImpactParameterSmearing, 1)
-};
-
-#endif
Index: modules/Isolation.cc
===================================================================
--- modules/Isolation.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Isolation.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class Isolation
@@ -24,5 +7,9 @@
  *  the transverse momenta fraction within (PTRatioMin, PTRatioMax].
  *
- *  \author P. Demin, M. Selvaggi, R. Gerosa - UCL, Louvain-la-Neuve
+ *  $Date$
+ *  $Revision$
+ *
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
  *
  */
@@ -34,20 +21,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -58,4 +45,5 @@
 {
 public:
+
   IsolationClassifier() {}
 
@@ -69,5 +57,5 @@
 Int_t IsolationClassifier::GetCategory(TObject *object)
 {
-  Candidate *track = static_cast<Candidate *>(object);
+  Candidate *track = static_cast<Candidate*>(object);
   const TLorentzVector &momentum = track->Momentum;
 
@@ -81,6 +69,5 @@
 Isolation::Isolation() :
   fClassifier(0), fFilter(0),
-  fItIsolationInputArray(0), fItCandidateInputArray(0),
-  fItRhoInputArray(0)
+  fItIsolationInputArray(0), fItCandidateInputArray(0)
 {
   fClassifier = new IsolationClassifier;
@@ -103,13 +90,4 @@
   fPTRatioMax = GetDouble("PTRatioMax", 0.1);
 
-  fPTSumMax = GetDouble("PTSumMax", 5.0);
-
-  fUsePTSum = GetBool("UsePTSum", false);
-
-  fUseRhoCorrection = GetBool("UseRhoCorrection", true);
-
-  fDeltaRMin = GetDouble("DeltaRMin", 0.01);
-  fUseMiniCone = GetBool("UseMiniCone", false);
-
   fClassifier->fPTMin = GetDouble("PTMin", 0.5);
 
@@ -128,5 +106,4 @@
   {
     fRhoInputArray = ImportArray(rhoInputArrayName);
-    fItRhoInputArray = fRhoInputArray->MakeIterator();
   }
   else
@@ -144,5 +121,4 @@
 void Isolation::Finish()
 {
-  if(fItRhoInputArray) delete fItRhoInputArray;
   if(fFilter) delete fFilter;
   if(fItCandidateInputArray) delete fItCandidateInputArray;
@@ -154,113 +130,51 @@
 void Isolation::Process()
 {
-  Candidate *candidate, *isolation, *object;
+  Candidate *candidate, *isolation;
   TObjArray *isolationArray;
-  Double_t sumChargedNoPU, sumChargedPU, sumNeutral, sumAllParticles;
-  Double_t sumDBeta, ratioDBeta, sumRhoCorr, ratioRhoCorr, sum, ratio;
-  Bool_t pass = kFALSE;
-  Double_t eta = 0.0;
+  Double_t sumPT, ratio;
+  Int_t counter;
   Double_t rho = 0.0;
+
+  if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)
+  {
+    candidate = static_cast<Candidate*>(fRhoInputArray->At(0));
+    rho = candidate->Momentum.Pt();
+  }
 
   // select isolation objects
   fFilter->Reset();
   isolationArray = fFilter->GetSubArray(fClassifier, 0);
+
+  if(isolationArray == 0) return;
+
   TIter itIsolationArray(isolationArray);
 
   // loop over all input jets
   fItCandidateInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItCandidateInputArray->Next())))
   {
     const TLorentzVector &candidateMomentum = candidate->Momentum;
-    eta = TMath::Abs(candidateMomentum.Eta());
 
-    // find rho
-    rho = 0.0;
-    if(fRhoInputArray)
+    // loop over all input tracks
+    sumPT = 0.0;
+    counter = 0;
+    itIsolationArray.Reset();
+    while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
     {
-      fItRhoInputArray->Reset();
-      while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))
+      const TLorentzVector &isolationMomentum = isolation->Momentum;
+
+      if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
+         !candidate->Overlaps(isolation))
       {
-        if(eta >= object->Edges[0] && eta < object->Edges[1])
-        {
-          rho = object->Momentum.Pt();
-        }
+        sumPT += isolationMomentum.Pt();
+        ++counter;
       }
     }
 
-    // loop over all input tracks
+    // correct sumPT for pile-up contamination
+    sumPT = sumPT - rho*fDeltaRMax*fDeltaRMax*TMath::Pi();  
 
-    sumNeutral = 0.0;
-    sumChargedNoPU = 0.0;
-    sumChargedPU = 0.0;
-    sumAllParticles = 0.0;
-
-    itIsolationArray.Reset();
-    while((isolation = static_cast<Candidate *>(itIsolationArray.Next())))
-    {
-      const TLorentzVector &isolationMomentum = isolation->Momentum;
-
-      if(fUseMiniCone)
-      {
-        pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidateMomentum.DeltaR(isolationMomentum) > fDeltaRMin;
-      }
-      else
-      {
-        pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidate->GetUniqueID() != isolation->GetUniqueID();
-      }
-
-      if(pass)
-      {
-
-        sumAllParticles += isolationMomentum.Pt();
-        if(isolation->Charge != 0)
-        {
-          if(isolation->IsRecoPU)
-          {
-            sumChargedPU += isolationMomentum.Pt();
-          }
-          else
-          {
-            sumChargedNoPU += isolationMomentum.Pt();
-          }
-        }
-        else
-        {
-          sumNeutral += isolationMomentum.Pt();
-        }
-      }
-    }
-
-    // find rho
-    rho = 0.0;
-    if(fRhoInputArray)
-    {
-      fItRhoInputArray->Reset();
-      while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))
-      {
-        if(eta >= object->Edges[0] && eta < object->Edges[1])
-        {
-          rho = object->Momentum.Pt();
-        }
-      }
-    }
-
-    // correct sum for pile-up contamination
-    sumDBeta = sumChargedNoPU + TMath::Max(sumNeutral - 0.5 * sumChargedPU, 0.0);
-    sumRhoCorr = sumChargedNoPU + TMath::Max(sumNeutral - TMath::Max(rho, 0.0) * fDeltaRMax * fDeltaRMax * TMath::Pi(), 0.0);
-    ratioDBeta = sumDBeta / candidateMomentum.Pt();
-    ratioRhoCorr = sumRhoCorr / candidateMomentum.Pt();
-
-    candidate->IsolationVar = ratioDBeta;
-    candidate->IsolationVarRhoCorr = ratioRhoCorr;
-    candidate->SumPtCharged = sumChargedNoPU;
-    candidate->SumPtNeutral = sumNeutral;
-    candidate->SumPtChargedPU = sumChargedPU;
-    candidate->SumPt = sumAllParticles;
-
-    sum = fUseRhoCorrection ? sumRhoCorr : sumDBeta;
-    if(fUsePTSum && sum > fPTSumMax) continue;
-
-    ratio = fUseRhoCorrection ? ratioRhoCorr : ratioDBeta;
-    if(!fUsePTSum && ratio > fPTRatioMax) continue;
+    ratio = sumPT/candidateMomentum.Pt();
+    if(ratio > fPTRatioMax) continue;
 
     fOutputArray->Add(candidate);
Index: modules/Isolation.h
===================================================================
--- modules/Isolation.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Isolation.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef Isolation_h
 #define Isolation_h
@@ -26,4 +8,8 @@
  *  to the candidate's transverse momentum. outputs candidates that have
  *  the transverse momenta fraction within (PTRatioMin, PTRatioMax].
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -41,4 +27,5 @@
 {
 public:
+
   Isolation();
   ~Isolation();
@@ -49,17 +36,8 @@
 
 private:
+
   Double_t fDeltaRMax;
 
   Double_t fPTRatioMax;
-
-  Double_t fPTSumMax;
-
-  Double_t fDeltaRMin;
-
-  Bool_t fUsePTSum;
-
-  Bool_t fUseRhoCorrection;
-
-  Bool_t fUseMiniCone;
 
   IsolationClassifier *fClassifier; //!
@@ -70,6 +48,4 @@
 
   TIterator *fItCandidateInputArray; //!
-
-  TIterator *fItRhoInputArray; //!
 
   const TObjArray *fIsolationInputArray; //!
Index: modules/JetFakeParticle.cc
===================================================================
--- modules/JetFakeParticle.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class JetFakeParticle
- *
- *  Converts jet into particle with some PID,
- *  according to parametrized probability.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/JetFakeParticle.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-JetFakeParticle::JetFakeParticle() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-JetFakeParticle::~JetFakeParticle()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void JetFakeParticle::Init()
-{
-  TFakeMap::iterator itEfficiencyMap;
-  ExRootConfParam param;
-  DelphesFormula *formula;
-  Int_t i, size, pdgCode;
-
-  // read efficiency formulas
-  param = GetParam("EfficiencyFormula");
-  size = param.GetSize();
-
-  fEfficiencyMap.clear();
-
-  for(i = 0; i < size / 2; ++i)
-  {
-    formula = new DelphesFormula;
-    formula->Compile(param[i * 2 + 1].GetString());
-    pdgCode = param[i * 2].GetInt();
-
-    if(TMath::Abs(pdgCode) != 11 && TMath::Abs(pdgCode) != 13 && TMath::Abs(pdgCode) != 22)
-    {
-      throw runtime_error("Jets can only fake into electrons, muons or photons. Other particles are not authorized.");
-    }
-
-    fEfficiencyMap[param[i * 2].GetInt()] = formula;
-  }
-
-  // set default efficiency formula
-  itEfficiencyMap = fEfficiencyMap.find(0);
-  if(itEfficiencyMap == fEfficiencyMap.end())
-  {
-    formula = new DelphesFormula;
-    formula->Compile("0.0");
-
-    fEfficiencyMap[0] = formula;
-  }
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "FastJetFinder/jets"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "fakeElectrons"));
-  fMuonOutputArray = ExportArray(GetString("MuonOutputArray", "fakeMuons"));
-  fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "fakePhotons"));
-  fJetOutputArray = ExportArray(GetString("JetOutputArray", "jets"));
-}
-
-//------------------------------------------------------------------------------
-
-void JetFakeParticle::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-
-  TFakeMap::iterator itEfficiencyMap;
-  DelphesFormula *formula;
-  for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
-  {
-    formula = itEfficiencyMap->second;
-    if(formula) delete formula;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void JetFakeParticle::Process()
-{
-  Candidate *candidate, *fake = 0;
-  Double_t pt, eta, phi, e;
-  TFakeMap::iterator itEfficiencyMap;
-  DelphesFormula *formula;
-  Int_t pdgCodeOut;
-
-  Double_t p, r, rs, total;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    eta = candidateMomentum.Eta();
-    phi = candidateMomentum.Phi();
-    pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
-
-    r = gRandom->Uniform();
-    total = 0.0;
-    fake = 0;
-
-    // loop over map for this jet
-    for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
-    {
-      formula = itEfficiencyMap->second;
-      pdgCodeOut = itEfficiencyMap->first;
-
-      p = formula->Eval(pt, eta, phi, e);
-
-      if(total <= r && r < total + p)
-      {
-        fake = static_cast<Candidate *>(candidate->Clone());
-
-        // convert jet
-
-        if(TMath::Abs(pdgCodeOut) == 11 || TMath::Abs(pdgCodeOut) == 13)
-        {
-          if(candidate->Charge != 0)
-          {
-            fake->Charge = candidate->Charge / TMath::Abs(candidate->Charge);
-          }
-          else
-          {
-            rs = gRandom->Uniform();
-            fake->Charge = (rs < 0.5) ? -1 : 1;
-          }
-        }
-
-        if(TMath::Abs(pdgCodeOut) == 22) fake->PID = 22;
-
-        if(TMath::Abs(pdgCodeOut) == 11) fElectronOutputArray->Add(fake);
-        if(TMath::Abs(pdgCodeOut) == 13) fMuonOutputArray->Add(fake);
-        if(TMath::Abs(pdgCodeOut) == 22) fPhotonOutputArray->Add(fake);
-
-        break;
-      }
-
-      total += p;
-    }
-
-    if(!fake) fJetOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/JetFakeParticle.h
===================================================================
--- modules/JetFakeParticle.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef JetFakeParticle_h
-#define JetFakeParticle_h
-
-/** \class JetFakeParticle
- *
- *  Converts jet into particle with some PID,
- *  according to parametrized probability.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class JetFakeParticle: public DelphesModule
-{
-public:
-  JetFakeParticle();
-  ~JetFakeParticle();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-#if !defined(__CINT__) && !defined(__CLING__)
-  typedef std::map<Int_t, DelphesFormula *> TFakeMap; //!
-  TFakeMap fEfficiencyMap;
-#endif
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fElectronOutputArray; //!
-  TObjArray *fMuonOutputArray; //!
-  TObjArray *fPhotonOutputArray; //!
-  TObjArray *fJetOutputArray; //!
-
-  ClassDef(JetFakeParticle, 1)
-};
-
-#endif
Index: modules/JetFlavorAssociation.cc
===================================================================
--- modules/JetFlavorAssociation.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,384 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY || FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class JetFlavorAssociation
- *
- *  Find origin of jet && evaluate jet flavor
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/JetFlavorAssociation.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-class PartonClassifier : public ExRootClassifier
-{
-public:
-  PartonClassifier() {}
-  Int_t GetCategory(TObject *object);
-  Double_t fEtaMax, fPTMin;
-};
-
-//------------------------------------------------------------------------------
-// https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc
-
-Int_t PartonClassifier::GetCategory(TObject *object)
-{
-  // select parton in the parton list
-
-  Candidate *parton = static_cast<Candidate *>(object);
-  const TLorentzVector &momentum = parton->Momentum;
-  Int_t pdgCode;
-
-  // inside the eta && momentum range (be a little bit larger that the tracking coverage
-  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
-
-  pdgCode = TMath::Abs(parton->PID);
-
-  if(parton->Status == -1) return -1;
-  if(pdgCode != 21 && pdgCode > 5) return -1; // not a parton, skip
-  if(parton->Status == 3 || parton->Status == 2) return 0; // if status 3 return
-
-  return 0;
-}
-
-//------------------------------------------------------------------------------
-
-class ParticleLHEFClassifier : public ExRootClassifier
-{
-public:
-  ParticleLHEFClassifier() {}
-  Int_t GetCategory(TObject *object);
-  Double_t fEtaMax, fPTMin;
-};
-
-Int_t ParticleLHEFClassifier::GetCategory(TObject *object)
-{
-  // select parton in the parton list
-
-  Candidate *particleLHEF = static_cast<Candidate *>(object);
-  const TLorentzVector &momentum = particleLHEF->Momentum;
-  Int_t pdgCode;
-
-  // inside the eta && momentum range (be a little bit larger that the tracking coverage
-  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
-
-  pdgCode = TMath::Abs(particleLHEF->PID);
-  if(particleLHEF->Status == -1) return -1;
-  if(pdgCode != 21 && pdgCode > 5) return -1; // not a parton, skip
-  if(particleLHEF->Status != 1) return -1; // if status 3 return
-
-  return 0;
-}
-
-//------------------------------------------------------------------------------
-
-JetFlavorAssociation::JetFlavorAssociation() :
-  fPartonClassifier(0), fPartonFilter(0), fParticleLHEFFilter(0),
-  fItPartonInputArray(0), fItParticleInputArray(0),
-  fItParticleLHEFInputArray(0), fItJetInputArray(0)
-{
-  fPartonClassifier = new PartonClassifier;
-  fParticleLHEFClassifier = new ParticleLHEFClassifier;
-}
-
-//------------------------------------------------------------------------------
-
-JetFlavorAssociation::~JetFlavorAssociation()
-{
-  if(fPartonClassifier) delete fPartonClassifier;
-  if(fParticleLHEFClassifier) delete fParticleLHEFClassifier;
-}
-
-//------------------------------------------------------------------------------
-
-void JetFlavorAssociation::Init()
-{
-  ExRootConfParam param;
-
-  fDeltaR = GetDouble("DeltaR", 0.5);
-
-  fPartonClassifier->fPTMin = GetDouble("PartonPTMin", 0.0);
-  fPartonClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
-
-  fParticleLHEFClassifier->fPTMin = GetDouble("PartonPTMin", 0.0);
-  fParticleLHEFClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
-
-  // import input array(s)
-  fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
-  fItPartonInputArray = fPartonInputArray->MakeIterator();
-  fPartonFilter = new ExRootFilter(fPartonInputArray);
-
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles"));
-  fItParticleInputArray = fParticleInputArray->MakeIterator();
-
-  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"));
-  fItJetInputArray = fJetInputArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-void JetFlavorAssociation::Finish()
-{
-  if(fPartonFilter) delete fPartonFilter;
-  if(fParticleLHEFFilter) delete fParticleLHEFFilter;
-
-  if(fItJetInputArray) delete fItJetInputArray;
-  if(fItParticleLHEFInputArray) delete fItParticleLHEFInputArray;
-  if(fItParticleInputArray) delete fItParticleInputArray;
-  if(fItPartonInputArray) delete fItPartonInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void JetFlavorAssociation::Process()
-{
-
-  Candidate *jet;
-  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;
-
-  if(fParticleLHEFInputArray)
-  {
-    fParticleLHEFFilter->Reset();
-    partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array
-  }
-  // loop over all input jets
-  fItJetInputArray->Reset();
-  while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
-  {
-    // get standard flavor
-    GetAlgoFlavor(jet, partonArray, partonLHEFArray);
-    if(fParticleLHEFInputArray) GetPhysicsFlavor(jet, partonArray, partonLHEFArray);
-  }
-}
-
-//------------------------------------------------------------------------------
-// Standard definition of jet flavor in
-// https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc?v=CMSSW_7_3_0_pre1
-
-void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray)
-{
-  float maxPt = 0;
-  int daughterCounter = 0;
-  Candidate *parton, *partonLHEF;
-  Candidate *tempParton = 0, *tempPartonHighestPt = 0;
-  int pdgCode, pdgCodeMax = -1;
-
-  TIter itPartonArray(partonArray);
-  TIter itPartonLHEFArray(partonLHEFArray);
-
-  itPartonArray.Reset();
-  while((parton = static_cast<Candidate *>(itPartonArray.Next())))
-  {
-    // default delphes method
-    pdgCode = TMath::Abs(parton->PID);
-    if(TMath::Abs(parton->PID) == 21) pdgCode = 0;
-    if(jet->Momentum.DeltaR(parton->Momentum) <= fDeltaR)
-    {
-      if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
-    }
-
-    if(!fParticleLHEFInputArray) continue;
-
-    itPartonLHEFArray.Reset();
-    while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
-    {
-      if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge)
-      {
-        break;
-      }
-
-      // check the daughter
-      daughterCounter = 0;
-      if(parton->D1 != -1 || parton->D2 != -1)
-      {
-        // partons are only quarks || gluons
-        int daughterFlavor1 = -1;
-        int daughterFlavor2 = -1;
-        if(parton->D1 != -1) daughterFlavor1 = TMath::Abs(static_cast<Candidate *>(fParticleInputArray->At(parton->D1))->PID);
-        if(parton->D2 != -1) daughterFlavor2 = TMath::Abs(static_cast<Candidate *>(fParticleInputArray->At(parton->D2))->PID);
-        if((daughterFlavor1 == 1 || daughterFlavor1 == 2 || daughterFlavor1 == 3 || daughterFlavor1 == 4 || daughterFlavor1 == 5 || daughterFlavor1 == 21)) daughterCounter++;
-        if((daughterFlavor2 == 1 || daughterFlavor2 == 2 || daughterFlavor2 == 3 || daughterFlavor2 == 4 || daughterFlavor2 == 5 || daughterFlavor2 == 21)) daughterCounter++;
-      }
-      if(daughterCounter > 0) continue;
-      if(jet->Momentum.DeltaR(parton->Momentum) <= fDeltaR)
-      {
-        // if not yet found && pdgId is a c, take as c
-        if(TMath::Abs(parton->PID) == 4) tempParton = parton;
-        if(TMath::Abs(parton->PID) == 5) tempParton = parton;
-        if(parton->Momentum.Pt() > maxPt)
-        {
-          maxPt = parton->Momentum.Pt();
-          tempPartonHighestPt = parton;
-        }
-      }
-    }
-  }
-
-  if(!tempParton) tempParton = tempPartonHighestPt;
-  jet->FlavorAlgo = tempParton ? TMath::Abs(tempParton->PID) : 0;
-
-  if(pdgCodeMax == 0) pdgCodeMax = 21;
-  if(pdgCodeMax == -1) pdgCodeMax = 0;
-
-  jet->Flavor = pdgCodeMax;
-}
-
-//------------------------------------------------------------------------------
-
-void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray)
-{
-  int partonCounter = 0;
-  float biggerConeSize = 0.7;
-  float dist;
-  bool isGoodCandidate;
-  int contaminatingFlavor = 0;
-  int motherCounter = 0;
-  Candidate *parton, *partonLHEF, *mother1, *mother2;
-  Candidate *tempParton = 0;
-  vector<Candidate *> contaminations;
-  vector<Candidate *>::iterator itContaminations;
-
-  TIter itPartonArray(partonArray);
-  TIter itPartonLHEFArray(partonLHEFArray);
-
-  contaminations.clear();
-
-  itPartonLHEFArray.Reset();
-  while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
-  {
-    dist = jet->Momentum.DeltaR(partonLHEF->Momentum); // take the DR
-
-    if(partonLHEF->Status == 1 && dist <= fDeltaR)
-    {
-      tempParton = partonLHEF;
-      partonCounter++;
-    }
-  }
-
-  itPartonArray.Reset();
-  itPartonLHEFArray.Reset();
-  while((parton = static_cast<Candidate *>(itPartonArray.Next())))
-  {
-    dist = jet->Momentum.DeltaR(parton->Momentum); // take the DR
-    isGoodCandidate = true;
-    while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
-    {
-      if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge)
-      {
-        isGoodCandidate = false;
-        break;
-      }
-    }
-
-    if(!isGoodCandidate) continue;
-
-    if(parton->D1 != -1 || parton->D2 != -1)
-    {
-      if((TMath::Abs(parton->PID) < 4 || TMath::Abs(parton->PID) == 21)) continue;
-      if(dist < biggerConeSize) contaminations.push_back(parton);
-    }
-  }
-
-  if(partonCounter != 1)
-  {
-    jet->FlavorPhys = 0;
-  }
-  else if(contaminations.size() == 0)
-  {
-    jet->FlavorPhys = TMath::Abs(tempParton->PID);
-  }
-  else if(contaminations.size() > 0)
-  {
-    jet->FlavorPhys = TMath::Abs(tempParton->PID);
-
-    for(itContaminations = contaminations.begin(); itContaminations != contaminations.end(); ++itContaminations)
-    {
-      parton = *itContaminations;
-      contaminatingFlavor = TMath::Abs(parton->PID);
-      motherCounter = 0;
-      if(parton->M1 != -1) motherCounter++;
-      if(parton->M2 != -1) motherCounter++;
-
-      if(parton->M1 != -1)
-      {
-        mother1 = static_cast<Candidate *>(fParticleInputArray->At(parton->M1));
-        if(mother1 && motherCounter > 0 && mother1->Momentum.DeltaR(tempParton->Momentum) < 0.001) continue;
-      }
-      if(parton->M2 != -1)
-      {
-        mother2 = static_cast<Candidate *>(fParticleInputArray->At(parton->M2));
-        if(mother2 && motherCounter > 0 && mother2->Momentum.DeltaR(tempParton->Momentum) < 0.001) continue;
-      }
-      // mother is the initialParton --> OK
-      if(TMath::Abs(tempParton->PID) == 4)
-      {
-        // keep association --> the initialParton is a c --> the contaminated parton is a c
-        if(contaminatingFlavor == 4) continue;
-        jet->FlavorPhys = 0; // all the other cases reject!
-        break;
-      }
-    }
-  }
-}
Index: modules/JetFlavorAssociation.h
===================================================================
--- modules/JetFlavorAssociation.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef JetFlavorAssociation_h
-#define JetFlavorAssociation_h
-
-/** \class JetFlavorAssociation
- *
- *  Find origin of jet and evaluate jet flavor
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesModule.h"
-#include <map>
-
-class TObjArray;
-class DelphesFormula;
-
-class ExRootFilter;
-class PartonClassifier;
-class ParticleLHEFClassifier;
-
-class JetFlavorAssociation: public DelphesModule
-{
-public:
-  JetFlavorAssociation();
-  ~JetFlavorAssociation();
-
-  void Init();
-  void Process();
-  void Finish();
-
-  void GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray);
-  void GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray);
-
-private:
-  Double_t fDeltaR;
-
-  PartonClassifier *fPartonClassifier; //!
-  ParticleLHEFClassifier *fParticleLHEFClassifier; //!
-
-  ExRootFilter *fPartonFilter;
-  ExRootFilter *fParticleLHEFFilter;
-
-  TIterator *fItPartonInputArray; //!
-  TIterator *fItParticleInputArray; //!
-  TIterator *fItParticleLHEFInputArray; //!
-  TIterator *fItJetInputArray; //!
-
-  const TObjArray *fPartonInputArray; //!
-  const TObjArray *fParticleInputArray; //!
-  const TObjArray *fParticleLHEFInputArray; //!
-  const TObjArray *fJetInputArray; //!
-
-  ClassDef(JetFlavorAssociation, 1)
-};
-
-#endif
Index: modules/JetPileUpSubtractor.cc
===================================================================
--- modules/JetPileUpSubtractor.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/JetPileUpSubtractor.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,9 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class JetPileUpSubtractor
  *
  *  Subtract pile-up contribution from jets using the fastjet area method
+ *
+ *  $Date: 2012-11-18 15:57:08 +0100 (Sun, 18 Nov 2012) $
+ *  $Revision: 814 $
  *
  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
@@ -31,20 +17,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -53,6 +39,7 @@
 
 JetPileUpSubtractor::JetPileUpSubtractor() :
-  fItJetInputArray(0), fItRhoInputArray(0)
+  fItJetInputArray(0)
 {
+
 }
 
@@ -61,4 +48,5 @@
 JetPileUpSubtractor::~JetPileUpSubtractor()
 {
+
 }
 
@@ -75,9 +63,9 @@
 
   fRhoInputArray = ImportArray(GetString("RhoInputArray", "Rho/rho"));
-  fItRhoInputArray = fRhoInputArray->MakeIterator();
 
   // create output array(s)
 
   fOutputArray = ExportArray(GetString("OutputArray", "jets"));
+
 }
 
@@ -86,5 +74,4 @@
 void JetPileUpSubtractor::Finish()
 {
-  if(fItRhoInputArray) delete fItRhoInputArray;
   if(fItJetInputArray) delete fItJetInputArray;
 }
@@ -94,30 +81,20 @@
 void JetPileUpSubtractor::Process()
 {
-  Candidate *candidate, *object;
+  Candidate *candidate;
   TLorentzVector momentum, area;
-  Double_t eta = 0.0;
   Double_t rho = 0.0;
+
+  if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)
+  {
+    candidate = static_cast<Candidate*>(fRhoInputArray->At(0));
+    rho = candidate->Momentum.Pt();
+  }
 
   // loop over all input candidates
   fItJetInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItJetInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItJetInputArray->Next())))
   {
     momentum = candidate->Momentum;
     area = candidate->Area;
-    eta = momentum.Eta();
-
-    // find rho
-    rho = 0.0;
-    if(fRhoInputArray)
-    {
-      fItRhoInputArray->Reset();
-      while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))
-      {
-        if(eta >= object->Edges[0] && eta < object->Edges[1])
-        {
-          rho = object->Momentum.Pt();
-        }
-      }
-    }
 
     // apply pile-up correction
@@ -125,8 +102,8 @@
 
     momentum -= rho * area;
-
+  
     if(momentum.Pt() <= fJetPTMin) continue;
 
-    candidate = static_cast<Candidate *>(candidate->Clone());
+    candidate = static_cast<Candidate*>(candidate->Clone());
     candidate->Momentum = momentum;
 
Index: modules/JetPileUpSubtractor.h
===================================================================
--- modules/JetPileUpSubtractor.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/JetPileUpSubtractor.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef JetPileUpSubtractor_h
 #define JetPileUpSubtractor_h
@@ -23,4 +5,7 @@
  *
  *  Subtract pile-up contribution from jets using the fastjet area method
+ *
+ *  $Date: 2012-11-18 15:57:08 +0100 (Sun, 18 Nov 2012) $
+ *  $Revision: 814 $
  *
  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
@@ -33,8 +18,10 @@
 
 class TObjArray;
+class DelphesFormula;
 
 class JetPileUpSubtractor: public DelphesModule
 {
 public:
+
   JetPileUpSubtractor();
   ~JetPileUpSubtractor();
@@ -45,8 +32,8 @@
 
 private:
+
   Double_t fJetPTMin;
 
   TIterator *fItJetInputArray; //!
-  TIterator *fItRhoInputArray; //!
 
   const TObjArray *fJetInputArray; //!
Index: modules/LLPFilter.cc
===================================================================
--- modules/LLPFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class LLPFilter
- *
- *  Filter LLPs with particular PDG ID/status and calculate the EM and hadronic energy of LLP based on decay particles
- *  The classification of EM and hadronic energy of LLP is based on instructions from the HEPData entry for the CMS paper searching
- *  for neutral LLPs in the CMS endcap muon detectors: https://www.hepdata.net/record/104408
- *  Muons and neutrinos are ignored. Photons, electrons, and pi0 are EM energy and everything else is hadronic energy.
- *
- *  \author Christina Wang
- *
- */
-
-#include "modules/LLPFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-LLPFilter::LLPFilter() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-LLPFilter::~LLPFilter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void LLPFilter::Init()
-{
-
-  ExRootConfParam param;
-  Size_t i, size;
-
-  // PT threshold
-  fPTMin = GetDouble("PTMin", 0.0);
-
-  fInvert = GetBool("Invert", false);
-  fDaughterNumber = GetInt("DaughterNumber", 0);
-  fRequireDecayRegion = GetBool("RequireDecayRegion", 0);
-
-  fDecayRegionRMax = GetDouble("DecayRegionRMax", 0.0); //mm
-  fDecayRegionRMin = GetDouble("DecayRegionRMin", 0.0); //mm
-  fDecayRegionZMax = GetDouble("DecayRegionZMax", 0.0); //mm
-  fDecayRegionZMin = GetDouble("DecayRegionZMin", 0.0); //mm
-  fDecayRegionEtaMax = GetDouble("DecayRegionEtaMax", 0.0); // requirement on abs(eta)
-  fDecayRegionEtaMin = GetDouble("DecayRegionEtaMin", 0.0); //requirement on abs(eta)
-
-
-  // no pileup
-  fRequireNotPileup = GetBool("RequireNotPileup", false);
-
-  fRequireStatus = GetBool("RequireStatus", false);
-  fStatus = GetInt("Status", 1);
-
-  fRequireCharge = GetBool("RequireCharge", false);
-  fCharge = GetInt("Charge", 1);
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  fParticleInputArray =  ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItParticleInputArray = fParticleInputArray->MakeIterator();
-
-
-  param = GetParam("PdgCode");
-  size = param.GetSize();
-
-  // read PdgCodes to be filtered out from the data card
-
-  fPdgCodes.clear();
-  for(i = 0; i < size; ++i)
-  {
-    fPdgCodes.push_back(param[i].GetInt());
-  }
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void LLPFilter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void LLPFilter::Process()
-{
-
-  Candidate *candidate;
-  Int_t pdgCode;
-  Bool_t pass;
-  Double_t pt, eta;
-  Candidate *tempCandidate;
-
-  Candidate *daughter;
-  Int_t daughterPdg;
-
-
-  // loop over particles to find LLP
-  fItInputArray->Reset();
-  int index = -1;
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    index++;
-
-    //all distance units are in mm
-    pdgCode = candidate->PID;
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    const TLorentzVector &candidateProdPosition = candidate->Position;
-    const TLorentzVector &candidateDecayPosition = candidate->DecayPosition;
-    pt = candidateMomentum.Pt();
-    eta = candidateMomentum.Eta();
-    if(pt < fPTMin) continue;
-    if (fDaughterNumber > 0)
-    {
-      if (candidate->D2-candidate->D1 != fDaughterNumber) continue;//require at least fDaughterNumber daughters
-
-    }
-    if(find(fPdgCodes.begin(), fPdgCodes.end(), pdgCode) == fPdgCodes.end()) continue; //require pdgID is one of the LLP id
-    if(fRequireStatus && (candidate->Status != fStatus)) continue;
-
-    // loop over particles to find LLP daughters and assign EM and hadronic energy
-    candidate->Eem = 0.0;
-    candidate->Ehad = 0.0;
-    fItParticleInputArray->Reset();
-
-    while((daughter = static_cast<Candidate *>(fItParticleInputArray->Next())))
-    {
-
-      daughterPdg = daughter->PID;
-      if (daughter->Status != 1)continue;
-      if (daughter->IsPU)continue;
-      if (abs(daughterPdg)==12 || abs(daughterPdg)==14 || abs(daughterPdg)==16 || abs(daughterPdg)==13)continue; // ignore neutrinos and muons
-      if (abs(daughterPdg) > 1000000) continue;//ignore BSM particles
-
-      const TLorentzVector &daughterMomentum = daughter->Momentum;
-
-      // look for mother until find LLP or reach the top of the tree
-      tempCandidate = daughter;
-      while(tempCandidate->M1 != -1 && tempCandidate->M1 != index)
-      {
-        tempCandidate  = static_cast<Candidate *>(fParticleInputArray->At(tempCandidate->M1));
-      }
-      if (tempCandidate->M1 == -1) continue;
-
-      // assign LLP EM or hadronic energy, depending on the daughter ID
-      if (abs(daughterPdg)==11 || abs(daughterPdg)==22 || abs(daughterPdg)==111)candidate->Eem += daughterMomentum.E();
-      else candidate->Ehad += daughterMomentum.E();
-    }
-
-    if (fRequireDecayRegion)
-    {
-      if (abs(eta) < fDecayRegionEtaMax && abs(eta) > fDecayRegionEtaMin
-         && abs(candidateDecayPosition.Z()) < fDecayRegionZMax && abs(candidateDecayPosition.Z()) > fDecayRegionZMin
-         && sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2)) < fDecayRegionRMax
-         && sqrt(pow(candidateDecayPosition.X(),2)+pow(candidateDecayPosition.Y(),2)) > fDecayRegionRMin)
-      {
-        fOutputArray->Add(candidate);
-      }
-
-    }
-    else{
-      fOutputArray->Add(candidate);
-    }
-  }//end of while loop
-}
Index: modules/LLPFilter.h
===================================================================
--- modules/LLPFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-//------------------------------------------------------------------------------
-
-#ifndef LLPFilter_h
-#define LLPFilter_h
-
-
-/** \class LLPFilter
- *
- *  Filter LLPs with particular PDG ID/status and calculate the EM and hadronic energy of LLP based on decay particles
- *  The classification of EM and hadronic energy of LLP is based on instructions from the HEPData entry for the CMS paper searching
- *  for neutral LLPs in the CMS endcap muon detectors: https://www.hepdata.net/record/104408
- *
- *  \author Christina Wang
- *
- */
-
-#include "classes/DelphesModule.h"
-#include <vector>
-
-class TIterator;
-class TObjArray;
-
-class LLPFilter: public DelphesModule
-{
-public:
-  LLPFilter();
-  ~LLPFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fPTMin; //!
-  Bool_t fRequireDecayRegion;
-  Double_t fDecayRegionRMax;
-  Double_t fDecayRegionRMin;
-  Double_t fDecayRegionZMax;
-  Double_t fDecayRegionZMin;
-  Double_t fDecayRegionEtaMax;
-  Double_t fDecayRegionEtaMin;
-  Int_t fDaughterNumber;
-  Bool_t fInvert; //!
-  Bool_t fRequireStatus; //!
-  Int_t fStatus; //!
-  Bool_t fRequireCharge; //!
-  Int_t fCharge; //!
-  Bool_t fRequireNotPileup; //!
-
-  std::vector<Int_t> fPdgCodes;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TIterator *fItParticleInputArray;
-  const TObjArray *fParticleInputArray;
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(LLPFilter, 1)
-};
-
-#endif
Index: modules/LeptonDressing.cc
===================================================================
--- modules/LeptonDressing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/LeptonDressing.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,22 +1,7 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class LeptonDressing
  *
+ *
+ *  
  *
  *
@@ -31,20 +16,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -53,5 +38,5 @@
 
 LeptonDressing::LeptonDressing() :
-  fItDressingInputArray(0), fItCandidateInputArray(0)
+ fItDressingInputArray(0), fItCandidateInputArray(0)
 {
 }
@@ -73,8 +58,8 @@
   fDressingInputArray = ImportArray(GetString("DressingInputArray", "Calorimeter/photons"));
   fItDressingInputArray = fDressingInputArray->MakeIterator();
-
+  
   fCandidateInputArray = ImportArray(GetString("CandidateInputArray", "UniqueObjectFinder/electrons"));
   fItCandidateInputArray = fCandidateInputArray->MakeIterator();
-
+  
   // create output array
 
@@ -96,8 +81,8 @@
   Candidate *candidate, *dressing, *mother;
   TLorentzVector momentum;
-
+  
   // loop over all input candidate
   fItCandidateInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItCandidateInputArray->Next())))
   {
     const TLorentzVector &candidateMomentum = candidate->Momentum;
@@ -106,8 +91,8 @@
     fItDressingInputArray->Reset();
     momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
-    while((dressing = static_cast<Candidate *>(fItDressingInputArray->Next())))
+    while((dressing = static_cast<Candidate*>(fItDressingInputArray->Next())))
     {
       const TLorentzVector &dressingMomentum = dressing->Momentum;
-      if(dressingMomentum.Pt() > 0.1)
+      if (dressingMomentum.Pt() > 0.1)
       {
         if(candidateMomentum.DeltaR(dressingMomentum) <= fDeltaR)
@@ -119,9 +104,9 @@
 
     mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
+    candidate = static_cast<Candidate*>(candidate->Clone());
 
     candidate->Momentum += momentum;
     candidate->AddCandidate(mother);
-
+    
     fOutputArray->Add(candidate);
   }
Index: modules/LeptonDressing.h
===================================================================
--- modules/LeptonDressing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/LeptonDressing.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,24 +1,7 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef LeptonDressing_h
 #define LeptonDressing_h
 
 /** \class LeptonDressing
+ *
  *
  *  \author P. Demin && A. Mertens - UCL, Louvain-la-Neuve
@@ -34,7 +17,8 @@
 {
 public:
+
   LeptonDressing();
   ~LeptonDressing();
-
+  
   void Init();
   void Process();
@@ -42,12 +26,13 @@
 
 private:
+
   Double_t fDeltaR;
-
+  
   TIterator *fItDressingInputArray; //!
-
+  
   TIterator *fItCandidateInputArray; //!
 
   const TObjArray *fDressingInputArray; //!
-
+  
   const TObjArray *fCandidateInputArray; //!
 
Index: modules/Merger.cc
===================================================================
--- modules/Merger.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Merger.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class Merger
@@ -21,4 +4,8 @@
  *  Merges multiple input arrays into one output array
  *  and sums transverse momenta of all input objects.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -32,20 +19,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -88,5 +75,5 @@
 
   fMomentumOutputArray = ExportArray(GetString("MomentumOutputArray", "momentum"));
-
+  
   fEnergyOutputArray = ExportArray(GetString("EnergyOutputArray", "energy"));
 }
@@ -96,5 +83,5 @@
 void Merger::Finish()
 {
-  vector<TIterator *>::iterator itInputList;
+  vector< TIterator * >::iterator itInputList;
   TIterator *iterator;
 
@@ -112,10 +99,10 @@
   Candidate *candidate;
   TLorentzVector momentum;
-  Double_t sumPT, sumE;
-  vector<TIterator *>::iterator itInputList;
+  Double_t sumPT, sumE;  
+  vector< TIterator * >::iterator itInputList;
   TIterator *iterator;
 
   DelphesFactory *factory = GetFactory();
-
+  
   momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
   sumPT = 0;
@@ -129,5 +116,5 @@
     // loop over all candidates
     iterator->Reset();
-    while((candidate = static_cast<Candidate *>(iterator->Next())))
+    while((candidate = static_cast<Candidate*>(iterator->Next())))
     {
       const TLorentzVector &candidateMomentum = candidate->Momentum;
@@ -142,17 +129,16 @@
 
   candidate = factory->NewCandidate();
-
+  
   candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
   candidate->Momentum = momentum;
-
+  
   fMomentumOutputArray->Add(candidate);
 
   candidate = factory->NewCandidate();
-
+  
   candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
   candidate->Momentum.SetPtEtaPhiE(sumPT, 0.0, 0.0, sumE);
-
-  fEnergyOutputArray->Add(candidate);
-}
+  
+  fEnergyOutputArray->Add(candidate);}
 
 //------------------------------------------------------------------------------
Index: modules/Merger.h
===================================================================
--- modules/Merger.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/Merger.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef Merger_h
 #define Merger_h
@@ -24,4 +6,8 @@
  *  Merges multiple input arrays into one output array
  *  and sums transverse momenta of all input objects.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -35,8 +21,10 @@
 class TIterator;
 class TObjArray;
+class DelphesFormula;
 
 class Merger: public DelphesModule
 {
 public:
+
   Merger();
   ~Merger();
@@ -47,5 +35,6 @@
 
 private:
-  std::vector<TIterator *> fInputList; //!
+
+  std::vector< TIterator * > fInputList; //!
 
   TObjArray *fOutputArray; //!
Index: modules/ModulesLinkDef.h
===================================================================
--- modules/ModulesLinkDef.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ModulesLinkDef.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 
 /** \class
@@ -22,4 +4,8 @@
  *  Lists classes to be included in cint dicitonary
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *  
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -27,30 +13,15 @@
 
 #include "modules/Delphes.h"
-
-#include "modules/AngularSmearing.h"
-#include "modules/PhotonConversions.h"
+ 
+#include "modules/FastJetFinder.h"
 #include "modules/ParticlePropagator.h"
 #include "modules/Efficiency.h"
-#include "modules/IdentificationMap.h"
 #include "modules/EnergySmearing.h"
 #include "modules/MomentumSmearing.h"
-#include "modules/TrackSmearing.h"
-#include "modules/TrackCovariance.h"
-#include "modules/ClusterCounting.h"
-#include "modules/ImpactParameterSmearing.h"
-#include "modules/TimeSmearing.h"
-#include "modules/TimeOfFlight.h"
-#include "modules/SimpleCalorimeter.h"
-#include "modules/DenseTrackFilter.h"
 #include "modules/Calorimeter.h"
-#include "modules/DualReadoutCalorimeter.h"
-#include "modules/OldCalorimeter.h"
 #include "modules/Isolation.h"
-#include "modules/EnergyScale.h"
 #include "modules/UniqueObjectFinder.h"
-#include "modules/TrackCountingBTagging.h"
 #include "modules/BTagging.h"
 #include "modules/TauTagging.h"
-#include "modules/TrackCountingTauTagging.h"
 #include "modules/TreeWriter.h"
 #include "modules/Merger.h"
@@ -59,27 +30,7 @@
 #include "modules/JetPileUpSubtractor.h"
 #include "modules/TrackPileUpSubtractor.h"
-#include "modules/TaggingParticlesSkimmer.h"
-#include "modules/PileUpJetID.h"
-#include "modules/PhotonID.h"
 #include "modules/ConstituentFilter.h"
 #include "modules/StatusPidFilter.h"
-#include "modules/PdgCodeFilter.h"
-#include "modules/BeamSpotFilter.h"
-#include "modules/RecoPuFilter.h"
-#include "modules/Cloner.h"
-#include "modules/Weighter.h"
-#include "modules/Hector.h"
-#include "modules/JetFlavorAssociation.h"
-#include "modules/JetFakeParticle.h"
-#include "modules/VertexSorter.h"
-#include "modules/VertexFinder.h"
-#include "modules/VertexFinderDA4D.h"
-#include "modules/DecayFilter.h"
-#include "modules/ParticleDensity.h"
-#include "modules/TruthVertexFinder.h"
 #include "modules/ExampleModule.h"
-#include "modules/LLPFilter.h"
-#include "modules/CscClusterEfficiency.h"
-#include "modules/CscClusterId.h"
 
 #ifdef __CINT__
@@ -91,29 +42,14 @@
 #pragma link C++ class Delphes+;
 
-#pragma link C++ class AngularSmearing+;
-#pragma link C++ class PhotonConversions+;
+#pragma link C++ class FastJetFinder+;
 #pragma link C++ class ParticlePropagator+;
 #pragma link C++ class Efficiency+;
-#pragma link C++ class IdentificationMap+;
 #pragma link C++ class EnergySmearing+;
 #pragma link C++ class MomentumSmearing+;
-#pragma link C++ class TrackSmearing+;
-#pragma link C++ class TrackCovariance+;
-#pragma link C++ class ClusterCounting+;
-#pragma link C++ class ImpactParameterSmearing+;
-#pragma link C++ class TimeSmearing+;
-#pragma link C++ class TimeOfFlight+;
-#pragma link C++ class SimpleCalorimeter+;
-#pragma link C++ class DenseTrackFilter+;
 #pragma link C++ class Calorimeter+;
-#pragma link C++ class DualReadoutCalorimeter+;
-#pragma link C++ class OldCalorimeter+;
 #pragma link C++ class Isolation+;
-#pragma link C++ class EnergyScale+;
 #pragma link C++ class UniqueObjectFinder+;
-#pragma link C++ class TrackCountingBTagging+;
 #pragma link C++ class BTagging+;
 #pragma link C++ class TauTagging+;
-#pragma link C++ class TrackCountingTauTagging+;
 #pragma link C++ class TreeWriter+;
 #pragma link C++ class Merger+;
@@ -122,27 +58,7 @@
 #pragma link C++ class JetPileUpSubtractor+;
 #pragma link C++ class TrackPileUpSubtractor+;
-#pragma link C++ class TaggingParticlesSkimmer+;
-#pragma link C++ class PileUpJetID+;
-#pragma link C++ class PhotonID+;
 #pragma link C++ class ConstituentFilter+;
 #pragma link C++ class StatusPidFilter+;
-#pragma link C++ class PdgCodeFilter+;
-#pragma link C++ class BeamSpotFilter+;
-#pragma link C++ class RecoPuFilter+;
-#pragma link C++ class Cloner+;
-#pragma link C++ class Weighter+;
-#pragma link C++ class Hector+;
-#pragma link C++ class JetFlavorAssociation+;
-#pragma link C++ class JetFakeParticle+;
-#pragma link C++ class VertexSorter+;
-#pragma link C++ class VertexFinder+;
-#pragma link C++ class VertexFinderDA4D+;
-#pragma link C++ class DecayFilter+;
-#pragma link C++ class ParticleDensity+;
-#pragma link C++ class TruthVertexFinder+;
 #pragma link C++ class ExampleModule+;
-#pragma link C++ class LLPFilter+;
-#pragma link C++ class CscClusterEfficiency+;
-#pragma link C++ class CscClusterId+;
 
 #endif
Index: modules/MomentumSmearing.cc
===================================================================
--- modules/MomentumSmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/MomentumSmearing.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class MomentumSmearing
  *
  *  Performs transverse momentum resolution smearing.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -78,7 +65,4 @@
   fItInputArray = fInputArray->MakeIterator();
 
-  // switch to compute momentum smearing based on momentum vector eta, phi
-  fUseMomentumVector = GetBool("UseMomentumVector", false);
-
   // create output array
 
@@ -98,8 +82,8 @@
 {
   Candidate *candidate, *mother;
-  Double_t pt, eta, phi, e, m, res;
+  Double_t pt, eta, phi;
 
   fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
     const TLorentzVector &candidatePosition = candidate->Position;
@@ -107,52 +91,19 @@
     eta = candidatePosition.Eta();
     phi = candidatePosition.Phi();
-
-    if (fUseMomentumVector){
-      eta = candidateMomentum.Eta();
-      phi = candidateMomentum.Phi();
-    }
-
     pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
-    m = candidateMomentum.M();
-    res = fFormula->Eval(pt, eta, phi, e, candidate);
 
     // apply smearing formula
-    //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt);
-
-    res = (res > 1.0) ? 1.0 : res;
-
-    pt = LogNormal(pt, res * pt);
-
-    //if(pt <= 0.0) continue;
+    pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta) * pt);
+    
+    if(pt <= 0.0) continue;
 
     mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
+    candidate = static_cast<Candidate*>(candidate->Clone());
     eta = candidateMomentum.Eta();
     phi = candidateMomentum.Phi();
-    candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m);
-    //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e);
-    candidate->TrackResolution = res;
+    candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta));
     candidate->AddCandidate(mother);
-
+        
     fOutputArray->Add(candidate);
-  }
-}
-//----------------------------------------------------------------
-
-Double_t MomentumSmearing::LogNormal(Double_t mean, Double_t sigma)
-{
-  Double_t a, b;
-
-  if(mean > 0.0)
-  {
-    b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));
-    a = TMath::Log(mean) - 0.5 * b * b;
-
-    return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0));
-  }
-  else
-  {
-    return 0.0;
   }
 }
Index: modules/MomentumSmearing.h
===================================================================
--- modules/MomentumSmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/MomentumSmearing.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef MomentumSmearing_h
 #define MomentumSmearing_h
@@ -23,4 +5,8 @@
  *
  *  Performs transverse momentum resolution smearing.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -37,4 +23,5 @@
 {
 public:
+
   MomentumSmearing();
   ~MomentumSmearing();
@@ -45,5 +32,4 @@
 
 private:
-  Double_t LogNormal(Double_t mean, Double_t sigma);
 
   DelphesFormula *fFormula; //!
@@ -52,8 +38,6 @@
 
   const TObjArray *fInputArray; //!
-
+  
   TObjArray *fOutputArray; //!
-
-  Double_t fUseMomentumVector; //!
 
   ClassDef(MomentumSmearing, 1)
Index: modules/OldCalorimeter.cc
===================================================================
--- modules/OldCalorimeter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,597 +1,0 @@
-
-/** \class OldCalorimeter
- *
- *  Fills calorimeter towers, performs calorimeter resolution smearing,
- *  preselects towers hit by photons and creates energy flow objects.
- *
- *  $Date$
- *  $Revision$
- *
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/OldCalorimeter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-OldCalorimeter::OldCalorimeter() :
-  fECalResolutionFormula(0), fHCalResolutionFormula(0),
-  fItParticleInputArray(0), fItTrackInputArray(0),
-  fTowerECalArray(0), fItTowerECalArray(0),
-  fTowerHCalArray(0), fItTowerHCalArray(0),
-  fTowerTrackArray(0), fItTowerTrackArray(0),
-  fTowerECalTrackArray(0), fItTowerECalTrackArray(0),
-  fTowerHCalTrackArray(0), fItTowerHCalTrackArray(0)
-{
-  fECalResolutionFormula = new DelphesFormula;
-  fHCalResolutionFormula = new DelphesFormula;
-
-  fTowerECalArray = new TObjArray;
-  fItTowerECalArray = fTowerECalArray->MakeIterator();
-  fTowerHCalArray = new TObjArray;
-  fItTowerHCalArray = fTowerHCalArray->MakeIterator();
-
-  fTowerTrackArray = new TObjArray;
-  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
-  fTowerECalTrackArray = new TObjArray;
-  fItTowerECalTrackArray = fTowerECalTrackArray->MakeIterator();
-  fTowerHCalTrackArray = new TObjArray;
-  fItTowerHCalTrackArray = fTowerHCalTrackArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-OldCalorimeter::~OldCalorimeter()
-{
-  if(fECalResolutionFormula) delete fECalResolutionFormula;
-  if(fHCalResolutionFormula) delete fHCalResolutionFormula;
-
-  if(fTowerECalArray) delete fTowerECalArray;
-  if(fItTowerECalArray) delete fItTowerECalArray;
-  if(fTowerHCalArray) delete fTowerHCalArray;
-  if(fItTowerHCalArray) delete fItTowerHCalArray;
-
-  if(fTowerTrackArray) delete fTowerTrackArray;
-  if(fItTowerTrackArray) delete fItTowerTrackArray;
-  if(fTowerECalTrackArray) delete fTowerECalTrackArray;
-  if(fItTowerECalTrackArray) delete fItTowerECalTrackArray;
-  if(fTowerHCalTrackArray) delete fTowerHCalTrackArray;
-  if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;
-}
-
-//------------------------------------------------------------------------------
-
-void OldCalorimeter::Init()
-{
-  ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
-  Long_t i, j, k, size, sizeEtaBins, sizePhiBins, sizeFractions;
-  Double_t ecalFraction, hcalFraction;
-  TBinMap::iterator itEtaBin;
-  set<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  // read eta and phi bins
-  param = GetParam("EtaPhiBins");
-  size = param.GetSize();
-  fBinMap.clear();
-  fEtaBins.clear();
-  fPhiBins.clear();
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramEtaBins = param[i * 2];
-    sizeEtaBins = paramEtaBins.GetSize();
-    paramPhiBins = param[i * 2 + 1];
-    sizePhiBins = paramPhiBins.GetSize();
-
-    for(j = 0; j < sizeEtaBins; ++j)
-    {
-      for(k = 0; k < sizePhiBins; ++k)
-      {
-        fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
-      }
-    }
-  }
-
-  // for better performance we transform map of sets to parallel vectors:
-  // vector< double > and vector< vector< double >* >
-  for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
-  {
-    fEtaBins.push_back(itEtaBin->first);
-    phiBins = new vector<double>(itEtaBin->second.size());
-    fPhiBins.push_back(phiBins);
-    phiBins->clear();
-    for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
-    {
-      phiBins->push_back(*itPhiBin);
-    }
-  }
-
-  // read energy fractions for different particles
-  param = GetParam("EnergyFraction");
-  size = param.GetSize();
-
-  // set default energy fractions values
-  fFractionMap.clear();
-  fFractionMap[0] = make_pair(0.0, 1.0);
-
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramFractions = param[i * 2 + 1];
-    sizeFractions = paramFractions.GetSize();
-
-    ecalFraction = paramFractions[0].GetDouble();
-    hcalFraction = paramFractions[1].GetDouble();
-
-    fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction);
-  }
-  /*
-  TFractionMap::iterator itFractionMap;
-  for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
-  {
-    cout << itFractionMap->first << "   " << itFractionMap->second.first  << "   " << itFractionMap->second.second << endl;
-  }
-*/
-  // read resolution formulas
-  fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0"));
-  fHCalResolutionFormula->Compile(GetString("HCalResolutionFormula", "0"));
-
-  // import array with output from other modules
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
-  fItParticleInputArray = fParticleInputArray->MakeIterator();
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  // create output arrays
-  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
-  fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons"));
-
-  fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
-  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
-}
-
-//------------------------------------------------------------------------------
-
-void OldCalorimeter::Finish()
-{
-  vector<vector<Double_t> *>::iterator itPhiBin;
-  if(fItParticleInputArray) delete fItParticleInputArray;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
-  {
-    delete *itPhiBin;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void OldCalorimeter::Process()
-{
-  Candidate *particle, *track;
-  TLorentzVector position, momentum;
-  Short_t etaBin, phiBin, flags;
-  Int_t number;
-  Long64_t towerHit, towerEtaPhi, hitEtaPhi;
-  Double_t ecalFraction, hcalFraction;
-  Double_t ecalEnergy, hcalEnergy;
-  Int_t pdgCode;
-
-  TFractionMap::iterator itFractionMap;
-
-  vector<Double_t>::iterator itEtaBin;
-  vector<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  vector<Long64_t>::iterator itTowerHits;
-
-  DelphesFactory *factory = GetFactory();
-  fTowerHits.clear();
-  fECalFractions.clear();
-  fHCalFractions.clear();
-
-  // loop over all particles
-  fItParticleInputArray->Reset();
-  number = -1;
-  while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))
-  {
-    const TLorentzVector &particlePosition = particle->Position;
-    ++number;
-
-    pdgCode = TMath::Abs(particle->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    ecalFraction = itFractionMap->second.first;
-    hcalFraction = itFractionMap->second.second;
-
-    fECalFractions.push_back(ecalFraction);
-    fHCalFractions.push_back(hcalFraction);
-
-    if(ecalFraction < 1.0E-9 && hcalFraction < 1.0E-9) continue;
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), particlePosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), particlePosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 0;
-    flags |= (ecalFraction >= 1.0E-9) << 1;
-    flags |= (hcalFraction >= 1.0E-9) << 2;
-    flags |= (pdgCode == 11 || pdgCode == 22) << 3;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // loop over all tracks
-  fItTrackInputArray->Reset();
-  number = -1;
-  while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
-  {
-    const TLorentzVector &trackPosition = track->Position;
-    ++number;
-
-    pdgCode = TMath::Abs(track->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    ecalFraction = itFractionMap->second.first;
-    hcalFraction = itFractionMap->second.second;
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 1;
-    flags |= (ecalFraction >= 1.0E-9) << 1;
-    flags |= (hcalFraction >= 1.0E-9) << 2;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // all hits are sorted first by eta bin number, then by phi bin number,
-  // then by flags and then by particle or track number
-  sort(fTowerHits.begin(), fTowerHits.end());
-
-  // loop over all hits
-  towerEtaPhi = 0;
-  fTower = 0;
-  for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
-  {
-    towerHit = (*itTowerHits);
-    flags = (towerHit >> 24) & 0x00000000000000FFLL;
-    number = (towerHit)&0x0000000000FFFFFFLL;
-    hitEtaPhi = towerHit >> 32;
-
-    if(towerEtaPhi != hitEtaPhi)
-    {
-      // switch to next tower
-      towerEtaPhi = hitEtaPhi;
-
-      // finalize previous tower
-      FinalizeTower();
-
-      // create new tower
-      fTower = factory->NewCandidate();
-
-      phiBin = (towerHit >> 32) & 0x000000000000FFFFLL;
-      etaBin = (towerHit >> 48) & 0x000000000000FFFFLL;
-
-      // phi bins for given eta bin
-      phiBins = fPhiBins[etaBin];
-
-      // calculate eta and phi of the tower's center
-      fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
-      fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
-
-      fTowerEdges[0] = fEtaBins[etaBin - 1];
-      fTowerEdges[1] = fEtaBins[etaBin];
-      fTowerEdges[2] = (*phiBins)[phiBin - 1];
-      fTowerEdges[3] = (*phiBins)[phiBin];
-
-      fTowerECalEnergy = 0.0;
-      fTowerHCalEnergy = 0.0;
-
-      fTowerPhotonHits = 0;
-
-      fTowerAllHits = 0;
-      fTowerECalHits = 0;
-      fTowerHCalHits = 0;
-
-      fTowerTrackAllHits = 0;
-      fTowerECalTrackHits = 0;
-      fTowerHCalTrackHits = 0;
-
-      fTowerECalArray->Clear();
-      fTowerHCalArray->Clear();
-
-      fTowerTrackArray->Clear();
-      fTowerECalTrackArray->Clear();
-      fTowerHCalTrackArray->Clear();
-    }
-
-    // check for track hits
-    if(flags & 1)
-    {
-      track = static_cast<Candidate *>(fTrackInputArray->At(number));
-
-      ++fTowerTrackAllHits;
-      fTowerTrackArray->Add(track);
-
-      // check for track ECAL hits
-      if(flags & 2)
-      {
-        ++fTowerECalTrackHits;
-        fTowerECalTrackArray->Add(track);
-      }
-
-      // check for track HCAL hits
-      if(flags & 4)
-      {
-        ++fTowerHCalTrackHits;
-        fTowerHCalTrackArray->Add(track);
-      }
-      continue;
-    }
-
-    ++fTowerAllHits;
-
-    // check for ECAL hits
-    if(flags & 2)
-    {
-      ++fTowerECalHits;
-      fTowerECalArray->Add(particle);
-    }
-
-    // check for HCAL hits
-    if(flags & 4)
-    {
-      ++fTowerHCalHits;
-      fTowerHCalArray->Add(particle);
-    }
-
-    // check for photon and electron hits in current tower
-    if(flags & 8) ++fTowerPhotonHits;
-
-    particle = static_cast<Candidate *>(fParticleInputArray->At(number));
-    momentum = particle->Momentum;
-
-    // fill current tower
-    ecalEnergy = momentum.E() * fECalFractions[number];
-    hcalEnergy = momentum.E() * fHCalFractions[number];
-
-    fTowerECalEnergy += ecalEnergy;
-    fTowerHCalEnergy += hcalEnergy;
-
-    fTower->AddCandidate(particle);
-  }
-
-  // finalize last tower
-  FinalizeTower();
-}
-
-//------------------------------------------------------------------------------
-
-void OldCalorimeter::FinalizeTower()
-{
-  Candidate *particle, *track, *tower;
-  Double_t energy, pt, eta, phi;
-  Double_t ecalEnergy, hcalEnergy;
-  TIterator *itTowerTrackArray;
-
-  if(!fTower) return;
-
-  //  ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
-  //  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
-
-  ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
-
-  //  hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
-  //  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
-
-  hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
-
-  energy = ecalEnergy + hcalEnergy;
-
-  //  eta = fTowerEta;
-  //  phi = fTowerPhi;
-
-  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
-  phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
-
-  pt = energy / TMath::CosH(eta);
-
-  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
-  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
-  fTower->Eem = ecalEnergy;
-  fTower->Ehad = hcalEnergy;
-
-  fTower->Edges[0] = fTowerEdges[0];
-  fTower->Edges[1] = fTowerEdges[1];
-  fTower->Edges[2] = fTowerEdges[2];
-  fTower->Edges[3] = fTowerEdges[3];
-
-  // fill calorimeter towers and photon candidates
-  if(energy > 0.0)
-  {
-    if(fTowerPhotonHits > 0 && fTowerTrackAllHits == 0)
-    {
-      fPhotonOutputArray->Add(fTower);
-    }
-
-    fTowerOutputArray->Add(fTower);
-  }
-
-  // fill energy flow candidates
-  if(fTowerTrackAllHits == fTowerAllHits)
-  {
-    fItTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))
-    {
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-  else if(fTowerTrackAllHits > 0 && fTowerECalHits + fTowerHCalHits == fTowerAllHits)
-  {
-    if(fTowerECalHits == fTowerECalTrackHits && fTowerHCalHits == fTowerHCalTrackHits)
-    {
-      itTowerTrackArray = fItTowerTrackArray;
-    }
-    else if(fTowerECalHits == fTowerECalTrackHits)
-    {
-      itTowerTrackArray = fItTowerECalTrackArray;
-
-      if(hcalEnergy > 0.0)
-      {
-        DelphesFactory *factory = GetFactory();
-
-        // create new tower
-        tower = factory->NewCandidate();
-
-        fItTowerHCalArray->Reset();
-        while((particle = static_cast<Candidate *>(fItTowerHCalArray->Next())))
-        {
-          tower->AddCandidate(particle);
-        }
-
-        pt = hcalEnergy / TMath::CosH(eta);
-
-        tower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
-        tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalEnergy);
-        tower->Eem = 0.0;
-        tower->Ehad = hcalEnergy;
-
-        tower->Edges[0] = fTowerEdges[0];
-        tower->Edges[1] = fTowerEdges[1];
-        tower->Edges[2] = fTowerEdges[2];
-        tower->Edges[3] = fTowerEdges[3];
-
-        fEFlowTowerOutputArray->Add(tower);
-      }
-    }
-    else if(fTowerHCalHits == fTowerHCalTrackHits)
-    {
-      itTowerTrackArray = fItTowerHCalTrackArray;
-
-      if(ecalEnergy > 0.0)
-      {
-        DelphesFactory *factory = GetFactory();
-
-        // create new tower
-        tower = factory->NewCandidate();
-
-        fItTowerECalArray->Reset();
-        while((particle = static_cast<Candidate *>(fItTowerECalArray->Next())))
-        {
-          tower->AddCandidate(particle);
-        }
-
-        pt = ecalEnergy / TMath::CosH(eta);
-
-        tower->Position.SetPtEtaPhiE(1.0, eta, phi, 0.0);
-        tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalEnergy);
-        tower->Eem = ecalEnergy;
-        tower->Ehad = 0.0;
-
-        tower->Edges[0] = fTowerEdges[0];
-        tower->Edges[1] = fTowerEdges[1];
-        tower->Edges[2] = fTowerEdges[2];
-        tower->Edges[3] = fTowerEdges[3];
-
-        fEFlowTowerOutputArray->Add(tower);
-      }
-    }
-    else
-    {
-      itTowerTrackArray = 0;
-      fEFlowTowerOutputArray->Add(fTower);
-    }
-
-    if(itTowerTrackArray)
-    {
-      itTowerTrackArray->Reset();
-      while((track = static_cast<Candidate *>(itTowerTrackArray->Next())))
-      {
-        fEFlowTrackOutputArray->Add(track);
-      }
-    }
-  }
-  else if(energy > 0.0)
-  {
-    fEFlowTowerOutputArray->Add(fTower);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-Double_t OldCalorimeter::LogNormal(Double_t mean, Double_t sigma)
-{
-  Double_t a, b;
-
-  if(mean > 0.0)
-  {
-    b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));
-    a = TMath::Log(mean) - 0.5 * b * b;
-
-    return TMath::Exp(a + b * gRandom->Gaus(0, 1));
-  }
-  else
-  {
-    return 0.0;
-  }
-}
Index: modules/OldCalorimeter.h
===================================================================
--- modules/OldCalorimeter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,95 +1,0 @@
-#ifndef OldCalorimeter_h
-#define OldCalorimeter_h
-
-/** \class OldCalorimeter
- *
- *  Fills calorimeter towers, performs calorimeter resolution smearing,
- *  preselects towers hit by photons and creates energy flow objects.
- *
- *  $Date$
- *  $Revision$
- *
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <set>
-#include <vector>
-
-class TObjArray;
-class DelphesFormula;
-class Candidate;
-
-class OldCalorimeter: public DelphesModule
-{
-public:
-  OldCalorimeter();
-  ~OldCalorimeter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //!
-  typedef std::map<Double_t, std::set<Double_t> > TBinMap; //!
-
-  Candidate *fTower;
-  Double_t fTowerEta, fTowerPhi, fTowerEdges[4];
-  Double_t fTowerECalEnergy, fTowerHCalEnergy;
-  Double_t fTowerECalNeutralEnergy, fTowerHCalNeutralEnergy;
-  Int_t fTowerPhotonHits, fTowerECalHits, fTowerHCalHits, fTowerAllHits;
-  Int_t fTowerECalTrackHits, fTowerHCalTrackHits, fTowerTrackAllHits;
-
-  TFractionMap fFractionMap; //!
-  TBinMap fBinMap; //!
-
-  std::vector<Double_t> fEtaBins;
-  std::vector<std::vector<Double_t> *> fPhiBins;
-
-  std::vector<Long64_t> fTowerHits;
-
-  std::vector<Double_t> fECalFractions;
-  std::vector<Double_t> fHCalFractions;
-
-  DelphesFormula *fECalResolutionFormula; //!
-  DelphesFormula *fHCalResolutionFormula; //!
-
-  TIterator *fItParticleInputArray; //!
-  TIterator *fItTrackInputArray; //!
-
-  const TObjArray *fParticleInputArray; //!
-  const TObjArray *fTrackInputArray; //!
-
-  TObjArray *fTowerOutputArray; //!
-  TObjArray *fPhotonOutputArray; //!
-
-  TObjArray *fEFlowTrackOutputArray; //!
-  TObjArray *fEFlowTowerOutputArray; //!
-
-  TObjArray *fTowerECalArray; //!
-  TIterator *fItTowerECalArray; //!
-
-  TObjArray *fTowerHCalArray; //!
-  TIterator *fItTowerHCalArray; //!
-
-  TObjArray *fTowerTrackArray; //!
-  TIterator *fItTowerTrackArray; //!
-
-  TObjArray *fTowerECalTrackArray; //!
-  TIterator *fItTowerECalTrackArray; //!
-
-  TObjArray *fTowerHCalTrackArray; //!
-  TIterator *fItTowerHCalTrackArray; //!
-
-  void FinalizeTower();
-  Double_t LogNormal(Double_t mean, Double_t sigma);
-
-  ClassDef(OldCalorimeter, 1)
-};
-
-#endif
Index: modules/ParticleDensity.cc
===================================================================
--- modules/ParticleDensity.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class ParticleDensity
- *
- *  This module calculates the particle multiplicity density in eta-phi bins.
- *  It then assigns the value to the candidates according to the candidate eta.
- *
- *  \author R. Preghenella - INFN, Bologna
- *
- */
-
-#include "modules/ParticleDensity.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-#include "TH2F.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-ParticleDensity::ParticleDensity() :
-  fItInputArray(0)
-{}
-
-//------------------------------------------------------------------------------
-
-ParticleDensity::~ParticleDensity()
-{}
-
-//------------------------------------------------------------------------------
-
-void ParticleDensity::Init()
-{
-
-  // import input array(s)
-
-  fInputArray = ImportArray(GetString("InputArray", "FastJetFinder/jets"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array(s)
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-
-  // create multiplicity histogram
-
-  ExRootConfParam paramEta = GetParam("EtaBins");
-  const Long_t sizeEta = paramEta.GetSize();
-  Int_t nbinsEta = sizeEta - 1;
-  Float_t binsEta[sizeEta];
-  for (Int_t i = 0; i < sizeEta; ++i) {
-    binsEta[i] = paramEta[i].GetDouble();
-  }
-  
-  ExRootConfParam paramPhi = GetParam("PhiBins");
-  const Long_t sizePhi = paramPhi.GetSize();
-  Int_t nbinsPhi = sizePhi - 1;
-  Float_t binsPhi[sizePhi];
-  for (Int_t i = 0; i < sizePhi; ++i) {
-    binsPhi[i] = paramPhi[i].GetDouble();
-  }
-  
-  fHisto = new TH2F("hParticleDensity", ";#eta;#varphi;d^{2}N/d#etad#varphi", nbinsEta, binsEta, nbinsPhi, binsPhi);
-
-  fUseMomentumVector = GetBool("UseMomentumVector", false);
-}
-
-//------------------------------------------------------------------------------
-
-void ParticleDensity::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-  if (fHisto) delete fHisto;
-}
-
-//------------------------------------------------------------------------------
-
-void ParticleDensity::Process()
-{
-  Candidate *candidate;
-  fHisto->Reset();
-  
-  // loop over all input candidates to fill histogram
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) {
-    if (fUseMomentumVector) fHisto->Fill(candidate->Momentum.Eta(), candidate->Momentum.Phi());
-    else                    fHisto->Fill(candidate->Position.Eta(), candidate->Position.Phi());
-  }
-
-  // normalise by bin width
-  fHisto->Scale(1., "width");
-  
-  // loop over all input candidates to assign multiplicity
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) {
-    Int_t ieta, iphi;
-    if (fUseMomentumVector) {
-      ieta = fHisto->GetXaxis()->FindBin(candidate->Momentum.Eta());
-      iphi = fHisto->GetYaxis()->FindBin(candidate->Momentum.Phi());
-    } else {
-      ieta = fHisto->GetXaxis()->FindBin(candidate->Position.Eta());
-      iphi = fHisto->GetYaxis()->FindBin(candidate->Position.Phi());
-    }
-    candidate->ParticleDensity = fHisto->GetBinContent(ieta, iphi);
-    fOutputArray->Add(candidate);
-  }
-
-  
-}
-
-//------------------------------------------------------------------------------
Index: modules/ParticleDensity.h
===================================================================
--- modules/ParticleDensity.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef ParticleDensity_h
-#define ParticleDensity_h
-
-/** \class ParticleDensity
- *
- *  This module calculates the particle multiplicity density in eta-phi bins.
- *  It then assigns the value to the candidates according to the candidate eta.
- *
- *  \author R. Preghenella - INFN, Bologna
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <deque>
-
-class TObjArray;
-class TH2F;
-
-class ParticleDensity: public DelphesModule
-{
-public:
-  ParticleDensity();
-  ~ParticleDensity();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  Bool_t fUseMomentumVector; // !
-  TH2F *fHisto; //!
-  
-  ClassDef(ParticleDensity, 1)
-};
-
-#endif
Index: modules/ParticlePropagator.cc
===================================================================
--- modules/ParticlePropagator.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ParticlePropagator.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,26 +1,13 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class ParticlePropagator
  *
  *  Propagates charged and neutral particles
- *  from a given vertex to a cylinder defined by its radius,
+ *  from a given vertex to a cylinder defined by its radius, 
  *  its half-length, centered at (0,0,0) and with its axis
  *  oriented along the z-axis.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -34,20 +21,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
+
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -71,9 +58,9 @@
 {
   fRadius = GetDouble("Radius", 1.0);
-  fRadius2 = fRadius * fRadius;
+  fRadius2 = fRadius*fRadius;
   fHalfLength = GetDouble("HalfLength", 3.0);
   fBz = GetDouble("Bz", 0.0);
   if(fRadius < 1.0E-2)
-  {
+  { 
     cout << "ERROR: magnetic field radius is too low\n";
     return;
@@ -85,7 +72,4 @@
   }
 
-  fRadiusMax = GetDouble("RadiusMax", fRadius);
-  fHalfLengthMax = GetDouble("HalfLengthMax", fHalfLength);
-
   // import array with output from filter/classifier module
 
@@ -93,17 +77,7 @@
   fItInputArray = fInputArray->MakeIterator();
 
-  // import beamspot
-  try
-  {
-    fBeamSpotInputArray = ImportArray(GetString("BeamSpotInputArray", "BeamSpotFilter/beamSpotParticle"));
-  }
-  catch(runtime_error &e)
-  {
-    fBeamSpotInputArray = 0;
-  }
   // create output arrays
 
   fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-  fNeutralOutputArray = ExportArray(GetString("NeutralOutputArray", "neutralParticles"));
   fChargedHadronOutputArray = ExportArray(GetString("ChargedHadronOutputArray", "chargedHadrons"));
   fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "electrons"));
@@ -122,67 +96,39 @@
 void ParticlePropagator::Process()
 {
-  Candidate *candidate, *mother, *particle;
-  TLorentzVector particlePosition, particleMomentum, beamSpotPosition;
+  Candidate *candidate, *mother;
+  TLorentzVector candidatePosition, candidateMomentum;
   Double_t px, py, pz, pt, pt2, e, q;
-  Double_t x, y, z, t, r;
-  Double_t x_c, y_c, r_c, phi_0;
-  Double_t x_t, y_t, z_t, r_t, phi_t;
-  Double_t t_r, t_z;
-  Double_t tmp;
-  Double_t gammam, omega;
-  Double_t xd, yd, zd;
-  Double_t l, d0, dz, ctgTheta, alpha;
-  Double_t bsx, bsy, bsz;
-  Double_t td, pio, phid, vz;
-
+  Double_t x, y, z, t, r, phi;
+  Double_t x_c, y_c, r_c, phi_c, phi_0;
+  Double_t x_t, y_t, z_t, r_t;
+  Double_t t1, t2, t3, t4, t5, t6;
+  Double_t t_z, t_r, t_ra, t_rb;
+  Double_t tmp, discr, discr2;
+  Double_t delta, gammam, omega, asinrho;
+  
   const Double_t c_light = 2.99792458E8;
-
-  if(!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0)
+    
+  fItInputArray->Reset();
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
-    beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
-  }
-  else
-  {
-    Candidate &beamSpotCandidate = *((Candidate *)fBeamSpotInputArray->At(0));
-    beamSpotPosition = beamSpotCandidate.Position;
-  }
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    if(candidate->GetCandidates()->GetEntriesFast() == 0)
-    {
-      particle = candidate;
-    }
-    else
-    {
-      particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-    }
-
-    particlePosition = particle->Position;
-    particleMomentum = particle->Momentum;
-
-    x = particlePosition.X() * 1.0E-3;
-    y = particlePosition.Y() * 1.0E-3;
-    z = particlePosition.Z() * 1.0E-3;
-
-    bsx = beamSpotPosition.X() * 1.0E-3;
-    bsy = beamSpotPosition.Y() * 1.0E-3;
-    bsz = beamSpotPosition.Z() * 1.0E-3;
-
-    q = particle->Charge;
+    candidatePosition = candidate->Position;
+    candidateMomentum = candidate->Momentum;
+    x = candidatePosition.X()*1.0E-3;
+    y = candidatePosition.Y()*1.0E-3;
+    z = candidatePosition.Z()*1.0E-3;
+    q = candidate->Charge;
 
     // check that particle position is inside the cylinder
-    if(TMath::Hypot(x, y) > fRadiusMax || TMath::Abs(z) > fHalfLengthMax)
+    if(TMath::Hypot(x, y) > fRadius || TMath::Abs(z) > fHalfLength)
     {
       continue;
     }
 
-    px = particleMomentum.Px();
-    py = particleMomentum.Py();
-    pz = particleMomentum.Pz();
-    pt = particleMomentum.Pt();
-    pt2 = particleMomentum.Perp2();
-    e = particleMomentum.E();
+    px = candidateMomentum.Px();
+    py = candidateMomentum.Py();
+    pz = candidateMomentum.Pz();
+    pt = candidateMomentum.Pt();
+    pt2 = candidateMomentum.Perp2();
+    e = candidateMomentum.E();
 
     if(pt2 < 1.0E-9)
@@ -191,120 +137,90 @@
     }
 
-    if(TMath::Hypot(x, y) > fRadius || TMath::Abs(z) > fHalfLength)
-    {
+    if(TMath::Abs(q) < 1.0E-9 || TMath::Abs(fBz) < 1.0E-9)
+    {
+      // solve pt2*t^2 + 2*(px*x + py*y)*t + (fRadius2 - x*x - y*y) = 0
+      tmp = px*y - py*x;
+      discr2 = pt2*fRadius2 - tmp*tmp;
+      
+      if(discr2 < 0)
+      {
+        // no solutions
+        continue;
+      }
+
+      tmp = px*x + py*y;
+      discr = TMath::Sqrt(discr2);
+      t1 = (-tmp + discr)/pt2;
+      t2 = (-tmp - discr)/pt2;
+      t = (t1 < 0) ? t2 : t1; 
+
+      z_t = z + pz*t;
+      if(TMath::Abs(z_t) > fHalfLength)
+      {
+        t3 = (+fHalfLength - z) / pz;
+        t4 = (-fHalfLength - z) / pz;
+        t = (t3 < 0) ? t4 : t3; 
+      }
+
+      x_t = x + px*t;
+      y_t = y + py*t;
+      z_t = z + pz*t;
+
       mother = candidate;
-      candidate = static_cast<Candidate *>(candidate->Clone());
-
-      candidate->InitialPosition = particlePosition;
-      candidate->Position = particlePosition;
-      candidate->L = 0.0;
-
-      candidate->Momentum = particleMomentum;
+      candidate = static_cast<Candidate*>(candidate->Clone());
+
+      candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, 0.0);
+
+      candidate->Momentum = candidateMomentum;
       candidate->AddCandidate(mother);
-
+      
       fOutputArray->Add(candidate);
-    }
-    else if(TMath::Abs(q) < 1.0E-9 || TMath::Abs(fBz) < 1.0E-9)
-    {
-      // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0
-      tmp = px * y - py * x;
-      t_r = (TMath::Sqrt(pt2 * fRadius2 - tmp * tmp) - px * x - py * y) / pt2;
-
-      t_z = (TMath::Sign(fHalfLength, pz) - z) / pz;
-
-      t = TMath::Min(t_r, t_z);
-
-      x_t = x + px * t;
-      y_t = y + py * t;
-      z_t = z + pz * t;
-
-      l = TMath::Sqrt((x_t - x) * (x_t - x) + (y_t - y) * (y_t - y) + (z_t - z) * (z_t - z));
-
-      mother = candidate;
-      candidate = static_cast<Candidate *>(candidate->Clone());
-
-      candidate->InitialPosition = particlePosition;
-      candidate->Position.SetXYZT(x_t * 1.0E3, y_t * 1.0E3, z_t * 1.0E3, particlePosition.T() + t * e * 1.0E3);
-      candidate->L = l * 1.0E3;
-
-      candidate->Momentum = particleMomentum;
-      candidate->AddCandidate(mother);
-
-      fOutputArray->Add(candidate);
-
-      if(TMath::Abs(q) > 1.0E-9)
+      if(TMath::Abs(q) > 1.0E-9) 
       {
         switch(TMath::Abs(candidate->PID))
         {
-        case 11:
-          fElectronOutputArray->Add(candidate);
-          break;
-        case 13:
-          fMuonOutputArray->Add(candidate);
-          break;
-        default:
-          fChargedHadronOutputArray->Add(candidate);
+          case 11:
+            fElectronOutputArray->Add(candidate);
+            break;
+          case 13:
+            fMuonOutputArray->Add(candidate);
+            break;
+          default:
+            fChargedHadronOutputArray->Add(candidate);
         }
       }
-      else
-      {
-        fNeutralOutputArray->Add(candidate);
-      }
     }
     else
     {
 
-      // 1. initial transverse momentum p_{T0}: Part->pt
-      //    initial transverse momentum direction phi_0 = -atan(p_{X0} / p_{Y0})
-      //    relativistic gamma: gamma = E / mc^2; gammam = gamma * m
-      //    gyration frequency omega = q * Bz / (gammam)
-      //    helix radius r = p_{T0} / (omega * gammam)
-
-      gammam = e * 1.0E9 / (c_light * c_light); // gammam in [eV/c^2]
-      omega = q * fBz / gammam; // omega is here in [89875518/s]
-      r = pt / (q * fBz) * 1.0E9 / c_light; // in [m]
-
-      phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi]
+      // 1.  initial transverse momentum p_{T0} : Part->pt
+      //     initial transverse momentum direction \phi_0 = -atan(p_X0/p_Y0) 
+      //     relativistic gamma : gamma = E/mc² ; gammam = gamma \times m
+      //     giration frequency \omega = q/(gamma m) fBz
+      //     helix radius r = p_T0 / (omega gamma m)
+
+      gammam = e*1.0E9 / (c_light*c_light);      // gammam in [eV/c²]
+      omega = q * fBz / (gammam);                // omega is here in [ 89875518 / s]  
+      r = pt / (q * fBz) * 1.0E9/c_light;        // in [m]  
+
+      phi_0 = TMath::ATan2(py, px); // [rad] in [-pi; pi]
 
       // 2. helix axis coordinates
-      x_c = x + r * TMath::Sin(phi_0);
-      y_c = y - r * TMath::Cos(phi_0);
+      x_c = x + r*TMath::Sin(phi_0);
+      y_c = y - r*TMath::Cos(phi_0);
       r_c = TMath::Hypot(x_c, y_c);
-
-      // time of closest approach
-      td = (phi_0 + TMath::ATan2(x_c, y_c)) / omega;
-
-      // remove all the modulo pi that might have come from the atan
-      pio = TMath::Abs(TMath::Pi() / omega);
-      while(TMath::Abs(td) > 0.5 * pio)
-      {
-        td -= TMath::Sign(1.0, td) * pio;
-      }
-
-      vz = pz * c_light / e;
-
-      // calculate coordinates of closest approach to z axis
-      phid = phi_0 - omega * td;
-      xd = x_c - r * TMath::Sin(phid);
-      yd = y_c + r * TMath::Cos(phid);
-      zd = z + vz * td;
-
-      // momentum at closest approach
-      px = pt * TMath::Cos(phid);
-      py = pt * TMath::Sin(phid);
-
-      particleMomentum.SetPtEtaPhiE(pt, particleMomentum.Eta(), phid, particleMomentum.E());
-
-      // calculate additional track parameters (correct for beamspot position)
-      d0 = ((xd - bsx) * py - (yd - bsy) * px) / pt;
-      dz = zd - bsz;
-      ctgTheta = 1.0 / TMath::Tan(particleMomentum.Theta());
+      phi_c = TMath::ATan2(y_c, x_c);
+      phi = phi_c;
+      if(x_c < 0.0) phi += TMath::Pi();
 
       // 3. time evaluation t = TMath::Min(t_r, t_z)
       //    t_r : time to exit from the sides
       //    t_z : time to exit from the front or the back
-      t_z = (vz == 0.0) ? 1.0E99 : (TMath::Sign(fHalfLength, pz) - z) / vz;
-
-      if(r_c + TMath::Abs(r) < fRadius)
+      t_r = 0.0; // in [ns]
+      int sign_pz = (pz > 0.0) ? 1 : -1;
+      if(pz == 0.0) t_z = 1.0E99;
+      else t_z = gammam / (pz*1.0E9/c_light) * (-z + fHalfLength*sign_pz);
+
+      if(r_c + TMath::Abs(r)  < fRadius)
       {
         // helix does not cross the cylinder sides
@@ -313,47 +229,42 @@
       else
       {
-        alpha = TMath::ACos((r * r + r_c * r_c - fRadius * fRadius) / (2 * TMath::Abs(r) * r_c));
-        t_r = td + TMath::Abs(alpha / omega);
-
-        t = TMath::Min(t_r, t_z);
+        asinrho = TMath::ASin( (fRadius*fRadius - r_c*r_c - r*r) / (2*TMath::Abs(r)*r_c)  );
+        delta = phi_0 - phi;
+        if(delta <-TMath::Pi()) delta += 2*TMath::Pi();
+        if(delta > TMath::Pi()) delta -= 2*TMath::Pi();
+        t1 = (delta + asinrho) / omega;
+        t2 = (delta + TMath::Pi() - asinrho) / omega;
+        t3 = (delta + TMath::Pi() + asinrho) / omega;
+        t4 = (delta - asinrho) / omega;
+        t5 = (delta - TMath::Pi() - asinrho) / omega;
+        t6 = (delta - TMath::Pi() + asinrho) / omega;
+
+        if(t1 < 0) t1 = 1.0E99;
+        if(t2 < 0) t2 = 1.0E99;
+        if(t3 < 0) t3 = 1.0E99;
+        if(t4 < 0) t4 = 1.0E99;
+        if(t5 < 0) t5 = 1.0E99;
+        if(t6 < 0) t6 = 1.0E99;
+
+        t_ra = TMath::Min(t1, TMath::Min(t2, t3));
+        t_rb = TMath::Min(t4, TMath::Min(t5, t6));
+        t_r = TMath::Min(t_ra, t_rb);
+        t = TMath::Min(t_r, t_z); 
       }
 
       // 4. position in terms of x(t), y(t), z(t)
-      phi_t = phi_0 - omega * t;
-      x_t = x_c - r * TMath::Sin(phi_t);
-      y_t = y_c + r * TMath::Cos(phi_t);
-      z_t = z + vz * t;
+      x_t = x_c + r * TMath::Sin(omega * t - phi_0);
+      y_t = y_c + r * TMath::Cos(omega * t - phi_0);
+      z_t = z + pz*1.0E9 / c_light / gammam * t;
       r_t = TMath::Hypot(x_t, y_t);
 
-      // lenght of the path from production to tracker
-      l = t * TMath::Hypot(vz, r * omega);
-
       if(r_t > 0.0)
       {
-        // store these variables before cloning
-        if(particle == candidate)
-        {
-          particle->D0 = d0 * 1.0E3;
-          particle->DZ = dz * 1.0E3;
-          particle->P = particleMomentum.P();
-          particle->PT = pt;
-          particle->CtgTheta = ctgTheta;
-          particle->Phi = particleMomentum.Phi();
-        }
-
         mother = candidate;
-        candidate = static_cast<Candidate *>(candidate->Clone());
-
-        candidate->InitialPosition = particlePosition;
-        candidate->Position.SetXYZT(x_t * 1.0E3, y_t * 1.0E3, z_t * 1.0E3, particlePosition.T() + t * c_light * 1.0E3);
-
-        candidate->Momentum = particleMomentum;
-
-        candidate->L = l * 1.0E3;
-
-        candidate->Xd = xd * 1.0E3;
-        candidate->Yd = yd * 1.0E3;
-        candidate->Zd = zd * 1.0E3;
-
+        candidate = static_cast<Candidate*>(candidate->Clone());
+
+        candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, 0.0);
+
+        candidate->Momentum = candidateMomentum;
         candidate->AddCandidate(mother);
 
@@ -361,12 +272,12 @@
         switch(TMath::Abs(candidate->PID))
         {
-        case 11:
-          fElectronOutputArray->Add(candidate);
-          break;
-        case 13:
-          fMuonOutputArray->Add(candidate);
-          break;
-        default:
-          fChargedHadronOutputArray->Add(candidate);
+          case 11:
+            fElectronOutputArray->Add(candidate);
+            break;
+          case 13:
+            fMuonOutputArray->Add(candidate);
+            break;
+          default:
+            fChargedHadronOutputArray->Add(candidate);
         }
       }
Index: modules/ParticlePropagator.h
===================================================================
--- modules/ParticlePropagator.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/ParticlePropagator.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef ParticlePropagator_h
 #define ParticlePropagator_h
@@ -27,4 +9,8 @@
  *  oriented along the z-axis.
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -35,9 +21,9 @@
 class TClonesArray;
 class TIterator;
-class TLorentzVector;
 
 class ParticlePropagator: public DelphesModule
 {
 public:
+
   ParticlePropagator();
   ~ParticlePropagator();
@@ -48,5 +34,6 @@
 
 private:
-  Double_t fRadius, fRadius2, fRadiusMax, fHalfLength, fHalfLengthMax;
+
+  Double_t fRadius, fRadius2, fHalfLength;
   Double_t fBz;
 
@@ -54,8 +41,6 @@
 
   const TObjArray *fInputArray; //!
-  const TObjArray *fBeamSpotInputArray; //!
 
   TObjArray *fOutputArray; //!
-  TObjArray *fNeutralOutputArray; //!
   TObjArray *fChargedHadronOutputArray; //!
   TObjArray *fElectronOutputArray; //!
Index: modules/PdgCodeFilter.cc
===================================================================
--- modules/PdgCodeFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class PdgCodeFilter
- *
- *  Removes particles with specific PDG codes
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "modules/PdgCodeFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-PdgCodeFilter::PdgCodeFilter() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-PdgCodeFilter::~PdgCodeFilter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void PdgCodeFilter::Init()
-{
-
-  ExRootConfParam param;
-  Size_t i, size;
-
-  // PT threshold
-  fPTMin = GetDouble("PTMin", 0.0);
-
-  fInvert = GetBool("Invert", false);
-
-  // no pileup
-  fRequireNotPileup = GetBool("RequireNotPileup", false);
-
-  fRequireStatus = GetBool("RequireStatus", false);
-  fStatus = GetInt("Status", 1);
-
-  fRequireCharge = GetBool("RequireCharge", false);
-  fCharge = GetInt("Charge", 1);
-
-  // keep bhadron
-  fRequireKeepGhostBHadron = GetBool("RequireKeepGhostBHadron", false);
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  param = GetParam("PdgCode");
-  size = param.GetSize();
-
-  // read PdgCodes to be filtered out from the data card
-
-  fPdgCodes.clear();
-  for(i = 0; i < size; ++i)
-  {
-    fPdgCodes.push_back(param[i].GetInt());
-  }
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void PdgCodeFilter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void PdgCodeFilter::Process()
-{
-  Candidate *candidate;
-  Int_t pdgCode;
-  Bool_t pass;
-  Double_t pt;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    pdgCode = candidate->PID;
-
-    if (fRequireKeepGhostBHadron) {
-      if (isBHadron(abs(pdgCode)) ){
-        candidate->PT = candidate->PT * 1e-18;
-        if (candidate->PT ==0) candidate->PT = 1e-18;
-        candidate->Momentum.SetPtEtaPhiM(candidate->PT, candidate->Momentum.Eta(), candidate->Momentum.Phi(), candidate->Momentum.M());
-        fOutputArray->Add(candidate);
-        continue;
-      }
-    } 
-
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    pt = candidateMomentum.Pt();
-
-    if(pt < fPTMin) continue;
-    if(fRequireStatus && (candidate->Status != fStatus)) continue;
-    if(fRequireCharge && (candidate->Charge != fCharge)) continue;
-    if(fRequireNotPileup && (candidate->IsPU > 0)) continue;
-
-    pass = kTRUE;
-    if(find(fPdgCodes.begin(), fPdgCodes.end(), pdgCode) != fPdgCodes.end()) pass = kFALSE;
-
-    if(fInvert) pass = !pass;
-    if(pass) fOutputArray->Add(candidate);
-  }
-}
-
-Bool_t PdgCodeFilter::isBHadron(const unsigned int absPdgId) {
-  if (absPdgId <= 100)
-    return false;  // Fundamental particles and MC internals
-  if (absPdgId >= 1000000000)
-    return false;  // Nuclei, +-10LZZZAAAI
-
-  // General form of PDG ID is 7 digit form
-  // +- n nr nL nq1 nq2 nq3 nJ
-  //const int nJ = absPdgId % 10; // Spin
-  const int nq3 = (absPdgId / 10) % 10;
-  const int nq2 = (absPdgId / 100) % 10;
-  const int nq1 = (absPdgId / 1000) % 10;
-
-  if (nq3 == 0)
-    return false;  // Diquarks
-  if (nq1 == 0 and nq2 == 5)
-    return true;  // B mesons
-  if (nq1 == 5)
-    return true;  // B baryons
-
-  return false;
-}
-
Index: modules/PdgCodeFilter.h
===================================================================
--- modules/PdgCodeFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-//------------------------------------------------------------------------------
-
-#ifndef PdgCodeFilter_h
-#define PdgCodeFilter_h
-
-/** \class PdgCodeFilter
- *
- *  Removes particles with specific PDG codes
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-#include <vector>
-
-class TIterator;
-class TObjArray;
-
-class PdgCodeFilter: public DelphesModule
-{
-public:
-  PdgCodeFilter();
-  ~PdgCodeFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fPTMin; //!
-  Bool_t fInvert; //!
-  Bool_t fRequireStatus; //!
-  Int_t fStatus; //!
-  Bool_t fRequireCharge; //!
-  Int_t fCharge; //!
-  Bool_t fRequireNotPileup; //!
-
-  Bool_t fRequireKeepGhostBHadron; //!
-
-  std::vector<Int_t> fPdgCodes;
-
-  Bool_t isBHadron(const unsigned int absPdgId); //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(PdgCodeFilter, 1)
-};
-
-#endif
Index: modules/PhotonConversions.cc
===================================================================
--- modules/PhotonConversions.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,250 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class PhotonConversions
- *
- *
- * Converts photons into e+ e- pairs according to mass ditribution in the detector.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/PhotonConversions.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesCylindricalFormula.h"
-#include "classes/DelphesFactory.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TF1.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-#include "TVector3.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-PhotonConversions::PhotonConversions() :
-  fItInputArray(0), fConversionMap(0), fDecayXsec(0)
-{
-  fDecayXsec = new TF1("decayXsec", "1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0);
-  fConversionMap = new DelphesCylindricalFormula;
-}
-
-//------------------------------------------------------------------------------
-
-PhotonConversions::~PhotonConversions()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonConversions::Init()
-{
-  fRadius = GetDouble("Radius", 1.0);
-  fRadius2 = fRadius * fRadius;
-
-  fHalfLength = GetDouble("HalfLength", 3.0);
-
-  fEtaMax = GetDouble("EtaMax", 5.0);
-  fEtaMin = GetDouble("EtaMin", 2.0);
-
-  fStep = GetDouble("Step", 0.1); // in meters
-
-  fConversionMap->Compile(GetString("ConversionMap", "0.0"));
-
-  // import array with output from filter/classifier module
-
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output arrays
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonConversions::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-  if(fDecayXsec) delete fDecayXsec;
-  if(fConversionMap) delete fConversionMap;
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonConversions::Process()
-{
-  Candidate *candidate, *ep, *em;
-  TLorentzVector candidatePosition, candidateMomentum;
-  TVector3 pos_i;
-  Double_t px, py, pz, pt, pt2, e, eta, phi;
-  Double_t x, y, z, t;
-  Double_t x_t, y_t, z_t, r_t;
-  Double_t x_i, y_i, z_i, r_i, phi_i;
-  Double_t dt, t1, t2, t3, t4;
-  Double_t tmp, discr, discr2;
-  Int_t nsteps, i;
-  Double_t rate, p_conv, x1, x2;
-  Bool_t converted;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    if(candidate->PID != 22)
-    {
-      fOutputArray->Add(candidate);
-    }
-    else
-    {
-      candidatePosition = candidate->Position;
-      candidateMomentum = candidate->Momentum;
-      x = candidatePosition.X() * 1.0E-3;
-      y = candidatePosition.Y() * 1.0E-3;
-      z = candidatePosition.Z() * 1.0E-3;
-
-      // check that particle position is inside the cylinder
-      if(TMath::Hypot(x, y) > fRadius || TMath::Abs(z) > fHalfLength) continue;
-
-      px = candidateMomentum.Px();
-      py = candidateMomentum.Py();
-      pz = candidateMomentum.Pz();
-      pt = candidateMomentum.Pt();
-      pt2 = candidateMomentum.Perp2();
-      eta = candidateMomentum.Eta();
-      phi = candidateMomentum.Phi();
-      e = candidateMomentum.E();
-
-      if(eta < fEtaMin || eta > fEtaMax) continue;
-
-      // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0
-      tmp = px * y - py * x;
-      discr2 = pt2 * fRadius2 - tmp * tmp;
-
-      if(discr2 < 0.0)
-      {
-        // no solutions
-        continue;
-      }
-
-      tmp = px * x + py * y;
-      discr = TMath::Sqrt(discr2);
-      t1 = (-tmp + discr) / pt2;
-      t2 = (-tmp - discr) / pt2;
-      t = (t1 < 0.0) ? t2 : t1;
-
-      z_t = z + pz * t;
-      if(TMath::Abs(z_t) > fHalfLength)
-      {
-        t3 = (+fHalfLength - z) / pz;
-        t4 = (-fHalfLength - z) / pz;
-        t = (t3 < 0.0) ? t4 : t3;
-      }
-
-      // final position
-      x_t = x + px * t;
-      y_t = y + py * t;
-      z_t = z + pz * t;
-
-      r_t = TMath::Sqrt(x_t * x_t + y_t * y_t + z_t * z_t);
-
-      // here starts conversion code
-      nsteps = Int_t(r_t / fStep);
-
-      x_i = x;
-      y_i = y;
-      z_i = z;
-
-      dt = t / nsteps;
-
-      converted = false;
-
-      for(i = 0; i < nsteps; ++i)
-      {
-        x_i += px * dt;
-        y_i += py * dt;
-        z_i += pz * dt;
-        pos_i.SetXYZ(x_i, y_i, z_i);
-
-        // convert photon position into cylindrical coordinates, cylindrical r,phi,z !!
-
-        r_i = TMath::Sqrt(x_i * x_i + y_i * y_i);
-        phi_i = pos_i.Phi();
-
-        // read conversion rate/meter from card
-        rate = fConversionMap->Eval(r_i, phi_i, z_i);
-
-        // convert into conversion probability
-        p_conv = 1 - TMath::Exp(-7.0 / 9.0 * fStep * rate);
-
-        // case conversion occurs
-        if(gRandom->Uniform() < p_conv)
-        {
-          converted = true;
-
-          // generate x1 and x2, the fraction of the photon energy taken resp. by e+ and e-
-          x1 = fDecayXsec->GetRandom();
-          x2 = 1 - x1;
-
-          ep = static_cast<Candidate *>(candidate->Clone());
-          em = static_cast<Candidate *>(candidate->Clone());
-
-          ep->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e * 1.0E3);
-          em->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e * 1.0E3);
-
-          ep->Momentum.SetPtEtaPhiE(x1 * pt, eta, phi, x1 * e);
-          em->Momentum.SetPtEtaPhiE(x2 * pt, eta, phi, x2 * e);
-
-          ep->PID = -11;
-          em->PID = 11;
-
-          ep->Charge = 1.0;
-          em->Charge = -1.0;
-
-          ep->IsFromConversion = 1;
-          em->IsFromConversion = 1;
-
-          fOutputArray->Add(em);
-          fOutputArray->Add(ep);
-
-          break;
-        }
-      }
-      if(!converted) fOutputArray->Add(candidate);
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/PhotonConversions.h
===================================================================
--- modules/PhotonConversions.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PhotonConversions_h
-#define PhotonConversions_h
-
-/** \class PhotonConversions
- *
- *  Converts photons into e+ e- pairs according to material ditribution in the detector.
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TClonesArray;
-class TIterator;
-class DelphesCylindricalFormula;
-class TF1;
-
-class PhotonConversions: public DelphesModule
-{
-public:
-  PhotonConversions();
-  ~PhotonConversions();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fRadius, fRadius2, fHalfLength;
-  Double_t fEtaMin, fEtaMax;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  DelphesCylindricalFormula *fConversionMap; //!
-
-  TF1 *fDecayXsec; //!
-
-  Double_t fStep;
-
-  ClassDef(PhotonConversions, 1)
-};
-
-#endif
Index: modules/PhotonID.cc
===================================================================
--- modules/PhotonID.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class PhotonID
- *
- *  Applies complex photon Id. Reconstructed photon candidtes are first separated into matched and non-matched to gen particles. 
- *  Non-matched pass the "fake" efficiency. Matched photons get further splitted into isolated and non-isolated (user can choose criterion for isolation)
- *  Isolated photons pass the "prompt" efficiency while the non-isolated pass the "non-prompt" efficiency
- *
- *  \author M. Selvaggi CERN
- *
- */
-
-#include "modules/PhotonID.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-PhotonID::PhotonID() :
-  fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0)
-{
-  fPromptFormula = new DelphesFormula;
-  fNonPromptFormula = new DelphesFormula;
-  fFakeFormula = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-PhotonID::~PhotonID()
-{
-  if(fPromptFormula) delete fPromptFormula;
-  if(fNonPromptFormula) delete fNonPromptFormula;
-  if(fFakeFormula) delete fFakeFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonID::Init()
-{
-
-  // read PhotonID formulae
-  fPromptFormula->Compile(GetString("PromptFormula", "1.0"));
-  fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0"));
-  fFakeFormula->Compile(GetString("FakeFormula", "1.0"));
-
-  // import input arrays
-  fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons"));
-  fItInputPhotonArray = fInputPhotonArray->MakeIterator();
-
-  // use filtered collection for speed
-  fInputGenArray = ImportArray(GetString("InputGenArray", "GenParticleFilter/filteredParticles"));
-  fItInputGenArray = fInputGenArray->MakeIterator();
-
-  // min pt to be considered, make sure this threshold is higher than threshold in particle filter
-  fPTMin = GetDouble("PTMin", 10.0);
-
-  // to be tuned, since FS and delphes have different isolation profiles
-  fRelIsoMax = GetDouble("fRelIsoMax", 0.3);
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "photons"));
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonID::Finish()
-{
-  if(fItInputPhotonArray) delete fItInputPhotonArray;
-  if(fItInputGenArray) delete fItInputGenArray;
-}
-
-//------------------------------------------------------------------------------
-
-void PhotonID::Process()
-{
-  Candidate *candidate, *mother;
-  Double_t pt, eta, phi, e;
-  Double_t relIso;
-  Bool_t isolated;
-
-  //cout<< "----  new event ---------"<<endl;
-
-  fItInputPhotonArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next())))
-  {
-
-    mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->AddCandidate(mother);
-
-    const TLorentzVector &candidatePosition = candidate->Position;
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-    eta = candidatePosition.Eta();
-    phi = candidatePosition.Phi();
-    pt = candidateMomentum.Pt();
-    e = candidateMomentum.E();
-
-    if(pt < fPTMin) continue;
-
-    //cout<< "              ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl;
-
-    // find out if photon matches does not match photon in gen collection and apply fae efficiency
-    if(isFake(candidate))
-    {
-      //cout<<"                    Fake!"<<endl;
-
-      if(gRandom->Uniform() > fFakeFormula->Eval(pt, eta, phi, e)) continue;
-      //cout<<"                    passed"<<endl;
-      candidate->Status = 3;
-      fOutputArray->Add(candidate);
-    }
-
-    // if matches photon in gen collection
-    else
-    {
-      relIso = candidate->IsolationVar;
-      isolated = (relIso < 0.3);
-      //cout<<"                    Prompt!:   "<<relIso<<endl;
-
-      // if isolated apply prompt formula
-      if(isolated)
-      {
-        //cout<<"                       isolated!:   "<<relIso<<endl;
-        if(gRandom->Uniform() > fPromptFormula->Eval(pt, eta, phi, e)) continue;
-        //cout<<"                       passed"<<endl;
-        candidate->Status = 1;
-        fOutputArray->Add(candidate);
-      }
-
-      // if non-isolated apply non-prompt formula
-      else
-      {
-        //cout<<"                       non-isolated!:   "<<relIso<<endl;
-        if(gRandom->Uniform() > fNonPromptFormula->Eval(pt, eta, phi, e)) continue;
-        //cout<<"                       passed"<<endl;
-        candidate->Status = 2;
-        fOutputArray->Add(candidate);
-      }
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
-
-Bool_t PhotonID::isFake(const Candidate *obj)
-{
-
-  const TLorentzVector &mom_rec = obj->Momentum;
-
-  Bool_t matches = false;
-  fItInputGenArray->Reset();
-  Candidate *gen;
-
-  while((gen = static_cast<Candidate *>(fItInputGenArray->Next())))
-  {
-    const TLorentzVector &mom_gen = gen->Momentum;
-    Int_t status = gen->Status;
-    Int_t pdgCode = TMath::Abs(gen->PID);
-    Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) / mom_rec.Pt());
-    Float_t deltaR = mom_gen.DeltaR(mom_rec);
-
-    if(status != 1) continue;
-    if(pdgCode != 22) continue;
-    if(dPtOverPt > 0.5) continue;
-    if(deltaR > 0.1) continue;
-
-    matches = true;
-    break;
-  }
-
-  return !matches;
-}
Index: modules/PhotonID.h
===================================================================
--- modules/PhotonID.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PhotonID_h
-#define PhotonID_h
-
-/** \class PhotonID
- *
- *  Applies complex photon Id. Reconstructed photon candidtes are first separated into matched and non-matched to gen particles. 
- *  Non-matched pass the "fake" efficiency. Matched photons get further splitted into isolated and non-isolated (user can choose criterion for isolation)
- *  Isolated photons pass the "prompt" efficiency while the non-isolated pass the "non-prompt" efficiency
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-class Candidate;
-
-class PhotonID: public DelphesModule
-{
-public:
-  PhotonID();
-  ~PhotonID();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  DelphesFormula *fPromptFormula;
-  DelphesFormula *fNonPromptFormula;
-  DelphesFormula *fFakeFormula;
-
-  // import input arrays
-  const TObjArray *fInputPhotonArray;
-  TIterator *fItInputPhotonArray;
-
-  // use filtered collection for speed
-  const TObjArray *fInputGenArray;
-  TIterator *fItInputGenArray;
-
-  Double_t fPTMin;
-  Double_t fRelIsoMax;
-
-  TObjArray *fOutputArray; //!
-
-  Bool_t isFake(const Candidate *obj);
-
-  ClassDef(PhotonID, 1)
-};
-
-#endif
Index: modules/PileUpJetID.cc
===================================================================
--- modules/PileUpJetID.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,358 +1,0 @@
-
-/** \class PileUpJetID
- *
- *  CMS PileUp Jet ID Variables
- *
- *  \author S. Zenz
- *
- */
-
-#include "modules/PileUpJetID.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TFormula.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-//#include "TDatabasePDG.h"
-#include "TLorentzVector.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-PileUpJetID::PileUpJetID() :
-  fItJetInputArray(0), fTrackInputArray(0), fNeutralInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-PileUpJetID::~PileUpJetID()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpJetID::Init()
-{
-
-  fJetPTMin = GetDouble("JetPTMin", 20.0);
-  fParameterR = GetDouble("ParameterR", 0.5);
-  fUseConstituents = GetInt("UseConstituents", 0);
-
-  fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel", 0.1);
-  fBetaMinBarrel = GetDouble("BetaMinBarrel", 0.1);
-  fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap", 0.1);
-  fBetaMinEndcap = GetDouble("BetaMinEndcap", 0.1);
-  fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward", 0.1);
-  fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0);
-  fNeutralPTMin = GetDouble("NeutralPTMin", 2.0);
-
-  fAverageEachTower = false; // for timing
-
-  // import input array(s)
-
-  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
-  fItJetInputArray = fJetInputArray->MakeIterator();
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "ParticlePropagator/tracks"));
-  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
-
-  // create output array(s)
-
-  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
-
-  fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets", "eflowtowers"));
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpJetID::Finish()
-{
-  //  cout << "In finish" << endl;
-
-  if(fItJetInputArray) delete fItJetInputArray;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  if(fItNeutralInputArray) delete fItNeutralInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpJetID::Process()
-{
-  Candidate *candidate, *constituent;
-  TLorentzVector momentum, area;
-
-  Candidate *trk;
-
-  // loop over all input candidates
-  fItJetInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItJetInputArray->Next())))
-  {
-    momentum = candidate->Momentum;
-    area = candidate->Area;
-
-    float sumT0 = 0.;
-    float sumT1 = 0.;
-    float sumT10 = 0.;
-    float sumT20 = 0.;
-    float sumT30 = 0.;
-    float sumT40 = 0.;
-    float sumWeightsForT = 0.;
-    candidate->NTimeHits = 0;
-
-    float sumpt = 0.;
-    float sumptch = 0.;
-    float sumptchpv = 0.;
-    float sumptchpu = 0.;
-    float sumdrsqptsq = 0.;
-    float sumptsq = 0.;
-    int nc = 0;
-    int nn = 0;
-    float pt_ann[5];
-
-    for(int i = 0; i < 5; i++)
-    {
-      pt_ann[i] = 0.;
-    }
-
-    if(fUseConstituents)
-    {
-      TIter itConstituents(candidate->GetCandidates());
-      while((constituent = static_cast<Candidate *>(itConstituents.Next())))
-      {
-        float pt = constituent->Momentum.Pt();
-        float dr = candidate->Momentum.DeltaR(constituent->Momentum);
-        //	cout << " There exists a constituent with dr=" << dr << endl;
-        sumpt += pt;
-        sumdrsqptsq += dr * dr * pt * pt;
-        sumptsq += pt * pt;
-        if(constituent->Charge == 0)
-        {
-          nn++;
-        }
-        else
-        {
-          if(constituent->IsRecoPU)
-          {
-            sumptchpu += pt;
-          }
-          else
-          {
-            sumptchpv += pt;
-          }
-          sumptch += pt;
-          nc++;
-        }
-        for(int i = 0; i < 5; i++)
-        {
-          if(dr > 0.1 * i && dr < 0.1 * (i + 1))
-          {
-            pt_ann[i] += pt;
-          }
-        }
-        float tow_sumT = 0;
-        float tow_sumW = 0;
-        for(int i = 0; i < constituent->ECalEnergyTimePairs.size(); i++)
-        {
-          float w = TMath::Sqrt(constituent->ECalEnergyTimePairs[i].first);
-          if(fAverageEachTower)
-          {
-            tow_sumT += w * constituent->ECalEnergyTimePairs[i].second;
-            tow_sumW += w;
-          }
-          else
-          {
-            sumT0 += w * constituent->ECalEnergyTimePairs[i].second;
-            sumT1 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.001);
-            sumT10 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.010);
-            sumT20 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.020);
-            sumT30 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.030);
-            sumT40 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.040);
-            sumWeightsForT += w;
-            candidate->NTimeHits++;
-          }
-        }
-        if(fAverageEachTower && tow_sumW > 0.)
-        {
-          sumT0 += tow_sumT;
-          sumT1 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.001);
-          sumT10 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0010);
-          sumT20 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0020);
-          sumT30 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0030);
-          sumT40 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0040);
-          sumWeightsForT += tow_sumW;
-          candidate->NTimeHits++;
-        }
-      }
-    }
-    else
-    {
-      // Not using constituents, using dr
-      fItTrackInputArray->Reset();
-      while((trk = static_cast<Candidate *>(fItTrackInputArray->Next())))
-      {
-        if(trk->Momentum.DeltaR(candidate->Momentum) < fParameterR)
-        {
-          float pt = trk->Momentum.Pt();
-          sumpt += pt;
-          sumptch += pt;
-          if(trk->IsRecoPU)
-          {
-            sumptchpu += pt;
-          }
-          else
-          {
-            sumptchpv += pt;
-          }
-          float dr = candidate->Momentum.DeltaR(trk->Momentum);
-          sumdrsqptsq += dr * dr * pt * pt;
-          sumptsq += pt * pt;
-          nc++;
-          for(int i = 0; i < 5; i++)
-          {
-            if(dr > 0.1 * i && dr < 0.1 * (i + 1))
-            {
-              pt_ann[i] += pt;
-            }
-          }
-        }
-      }
-      fItNeutralInputArray->Reset();
-      while((constituent = static_cast<Candidate *>(fItNeutralInputArray->Next())))
-      {
-        if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR)
-        {
-          float pt = constituent->Momentum.Pt();
-          sumpt += pt;
-          float dr = candidate->Momentum.DeltaR(constituent->Momentum);
-          sumdrsqptsq += dr * dr * pt * pt;
-          sumptsq += pt * pt;
-          nn++;
-          for(int i = 0; i < 5; i++)
-          {
-            if(dr > 0.1 * i && dr < 0.1 * (i + 1))
-            {
-              pt_ann[i] += pt;
-            }
-          }
-        }
-      }
-    }
-
-    if(sumptch > 0.)
-    {
-      candidate->Beta = sumptchpv / sumptch;
-      candidate->BetaStar = sumptchpu / sumptch;
-    }
-    else
-    {
-      candidate->Beta = -999.;
-      candidate->BetaStar = -999.;
-    }
-    if(sumptsq > 0.)
-    {
-      candidate->MeanSqDeltaR = sumdrsqptsq / sumptsq;
-    }
-    else
-    {
-      candidate->MeanSqDeltaR = -999.;
-    }
-    candidate->NCharged = nc;
-    candidate->NNeutrals = nn;
-    if(sumpt > 0.)
-    {
-      candidate->PTD = TMath::Sqrt(sumptsq) / sumpt;
-      for(int i = 0; i < 5; i++)
-      {
-        candidate->FracPt[i] = pt_ann[i] / sumpt;
-      }
-    }
-    else
-    {
-      candidate->PTD = -999.;
-      for(int i = 0; i < 5; i++)
-      {
-        candidate->FracPt[i] = -999.;
-      }
-    }
-
-    fOutputArray->Add(candidate);
-
-    // New stuff
-    /*
-    fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
-    fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
-    fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
-    fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
-    fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
-    */
-
-    bool passId = false;
-    if(candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1)
-    {
-      if(fabs(candidate->Momentum.Eta()) < 1.5)
-      {
-        passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel));
-      }
-      else if(fabs(candidate->Momentum.Eta()) < 4.0)
-      {
-        passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap));
-      }
-      else
-      {
-        passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward);
-      }
-    }
-
-    //    cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt()
-    //	 << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl;
-
-    if(passId)
-    {
-      if(fUseConstituents)
-      {
-        TIter itConstituents(candidate->GetCandidates());
-        while((constituent = static_cast<Candidate *>(itConstituents.Next())))
-        {
-          if(constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin)
-          {
-            fNeutralsInPassingJets->Add(constituent);
-            //	    cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
-          }
-        }
-      }
-      else
-      { // use DeltaR
-        fItNeutralInputArray->Reset();
-        while((constituent = static_cast<Candidate *>(fItNeutralInputArray->Next())))
-        {
-          if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin)
-          {
-            fNeutralsInPassingJets->Add(constituent);
-            //            cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
-          }
-        }
-      }
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/PileUpJetID.h
===================================================================
--- modules/PileUpJetID.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,107 +1,0 @@
-#ifndef PileUpJetID_h
-#define PileUpJetID_h
-
-/** \class PileUpJetID
- *
- *  CMS PileUp Jet ID Variables
- *
- *  \author S. Zenz
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <deque>
-
-class TObjArray;
-class DelphesFormula;
-
-class PileUpJetID: public DelphesModule
-{
-public:
-  PileUpJetID();
-  ~PileUpJetID();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fJetPTMin;
-  Double_t fParameterR;
-
-  Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5
-  Double_t fBetaMinBarrel; // |eta| < 2.5
-  Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0
-  Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0
-  Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0
-
-  Double_t fNeutralPTMin;
-  Double_t fJetPTMinForNeutrals;
-
-  /*
-JAY
----
-
-|Eta|<1.5
-
-meanSqDeltaR betaStar SigEff BgdEff
-0.13 0.92 96% 8%
-0.13 0.95 97% 16%
-0.13 0.97 98% 27%
-
-|Eta|>1.5
-
-meanSqDeltaR betaStar SigEff BgdEff
-0.14 0.91 95% 15%
-0.14 0.94 97% 19%
-0.14 0.97 98% 29%
-
-BRYAN
------
-
-Barrel (MeanSqDR, Beta, sig eff, bg eff): 
-0.10, 0.08, 90%, 8%
-0.11, 0.12, 90%, 6%
-0.13, 0.16, 89%, 5%
-
-Endcap (MeanSqDR, Beta, sig eff, bg eff):
-0.07, 0.06, 89%, 4%
-0.08, 0.08, 92%, 6%
-0.09, 0.08, 95%, 10%
-0.10, 0.08, 97%, 13%
-
-SETH GUESSES FOR |eta| > 4.0
-----------------------------
-
-MeanSqDeltaR 
-0.07 
-0.10 
-0.14 
-0.2
-  */
-
-  // If set to true, may have weird results for PFCHS
-  // If set to false, uses everything within dR < fParameterR even if in other jets &c.
-  // Results should be very similar for PF
-  Int_t fUseConstituents;
-
-  Bool_t fAverageEachTower;
-
-  TIterator *fItJetInputArray; //!
-
-  const TObjArray *fJetInputArray; //!
-
-  const TObjArray *fTrackInputArray; // SCZ
-  const TObjArray *fNeutralInputArray;
-
-  TIterator *fItTrackInputArray; // SCZ
-  TIterator *fItNeutralInputArray; // SCZ
-
-  TObjArray *fOutputArray; //!
-  TObjArray *fNeutralsInPassingJets; // SCZ
-
-  ClassDef(PileUpJetID, 2)
-};
-
-#endif
Index: modules/PileUpMerger.cc
===================================================================
--- modules/PileUpMerger.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/PileUpMerger.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 /** \class PileUpMerger
  *
  *  Merges particles from pile-up sample into event
+ *
+ *
+ *  $Date: 2013-02-12 15:13:59 +0100 (Tue, 12 Feb 2013) $
+ *  $Revision: 907 $
+ *
  *
  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
@@ -29,23 +16,23 @@
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
 #include "classes/DelphesPileUpReader.h"
-#include "classes/DelphesTF2.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -54,7 +41,6 @@
 
 PileUpMerger::PileUpMerger() :
-  fFunction(0), fReader(0), fItInputArray(0)
+  fReader(0), fItInputArray(0)
 {
-  fFunction = new DelphesTF2;
 }
 
@@ -63,5 +49,4 @@
 PileUpMerger::~PileUpMerger()
 {
-  delete fFunction;
 }
 
@@ -72,20 +57,6 @@
   const char *fileName;
 
-  fPileUpDistribution = GetInt("PileUpDistribution", 0);
-
-  fMeanPileUp = GetDouble("MeanPileUp", 10);
-
-  fZVertexSpread = GetDouble("ZVertexSpread", 0.15);
-  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
-
-  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
-  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
-  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
-  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
-
-  // read vertex smearing formula
-
-  fFunction->Compile(GetString("VertexDistributionFormula", "0.0"));
-  fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread);
+  fMeanPileUp  = GetDouble("MeanPileUp", 10);
+  fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3;
 
   fileName = GetString("PileUpFile", "MinBias.pileup");
@@ -97,6 +68,5 @@
 
   // create output arrays
-  fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles"));
-  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
+  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
 }
 
@@ -114,129 +84,36 @@
   TDatabasePDG *pdg = TDatabasePDG::Instance();
   TParticlePDG *pdgParticle;
-  Int_t pid, nch, nvtx = -1;
-  Float_t x, y, z, t, vx, vy;
-  Float_t px, py, pz, e, pt;
-  Double_t dz, dphi, dt, sumpt2, dz0, dt0;
-  Int_t numberOfEvents, event, numberOfParticles;
+  Int_t pid;
+  Float_t x, y, z, t;
+  Float_t px, py, pz, e;
+  Double_t dz;
+  Int_t poisson, event;
   Long64_t allEntries, entry;
-  Candidate *candidate, *vertex;
+  Candidate *candidate;
   DelphesFactory *factory;
 
-  const Double_t c_light = 2.99792458E8;
-
   fItInputArray->Reset();
-
-  // --- Deal with primary vertex first  ------
-
-  fFunction->GetRandom2(dz, dt);
-
-  dz0 = -1.0e6;
-  dt0 = -1.0e6;
-
-  dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
-  dz *= 1.0E3; // necessary in order to make z in mm
-
-  //cout<<dz<<","<<dt<<endl;
-
-  vx = 0.0;
-  vy = 0.0;
-
-  numberOfParticles = fInputArray->GetEntriesFast();
-  nch = 0;
-  sumpt2 = 0.0;
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
+  {
+    fOutputArray->Add(candidate);
+  }
 
   factory = GetFactory();
-  vertex = factory->NewCandidate();
 
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    vx += candidate->Position.X();
-    vy += candidate->Position.Y();
-    z = candidate->Position.Z();
-    t = candidate->Position.T();
-    pt = candidate->Momentum.Pt();
-
-    // take postion and time from first stable particle
-    if(dz0 < -999999.0)
-      dz0 = z;
-    if(dt0 < -999999.0)
-      dt0 = t;
-
-    // cancel any possible offset in position and time the input file
-    candidate->Position.SetZ(z - dz0 + dz);
-    candidate->Position.SetT(t - dt0 + dt);
-
-    candidate->IsPU = 0;
-
-    fParticleOutputArray->Add(candidate);
-
-    if(TMath::Abs(candidate->Charge) > 1.0E-9)
-    {
-      nch++;
-      sumpt2 += pt * pt;
-      vertex->AddCandidate(candidate);
-    }
-  }
-
-  if(numberOfParticles > 0)
-  {
-    vx /= sumpt2;
-    vy /= sumpt2;
-  }
-
-  nvtx++;
-  vertex->Position.SetXYZT(vx, vy, dz, dt);
-  vertex->ClusterIndex = nvtx;
-  vertex->ClusterNDF = nch;
-  vertex->SumPT2 = sumpt2;
-  vertex->GenSumPT2 = sumpt2;
-  fVertexOutputArray->Add(vertex);
-
-  // --- Then with pile-up vertices  ------
-
-  switch(fPileUpDistribution)
-  {
-  case 0:
-    numberOfEvents = gRandom->Poisson(fMeanPileUp);
-    break;
-  case 1:
-    numberOfEvents = gRandom->Integer(2 * fMeanPileUp + 1);
-    break;
-  case 2:
-    numberOfEvents = fMeanPileUp;
-    break;
-  default:
-    numberOfEvents = gRandom->Poisson(fMeanPileUp);
-    break;
-  }
+  poisson = gRandom->Poisson(fMeanPileUp);
 
   allEntries = fReader->GetEntries();
 
-  for(event = 0; event < numberOfEvents; ++event)
+  for(event = 0; event < poisson; ++event)
   {
     do
     {
-      entry = TMath::Nint(gRandom->Rndm() * allEntries);
-    } while(entry >= allEntries);
+      entry = TMath::Nint(gRandom->Rndm()*allEntries);
+    }
+    while(entry >= allEntries);
 
     fReader->ReadEntry(entry);
 
-    // --- Pile-up vertex smearing
-
-    fFunction->GetRandom2(dz, dt);
-
-    dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
-    dz *= 1.0E3; // necessary in order to make z in mm
-
-    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
-
-    vx = 0.0;
-    vy = 0.0;
-
-    numberOfParticles = 0;
-    sumpt2 = 0.0;
-
-    //factory = GetFactory();
-    vertex = factory->NewCandidate();
+    dz = gRandom->Gaus(0.0, fZVertexSpread);
 
     while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
@@ -249,5 +126,5 @@
 
       pdgParticle = pdg->GetParticle(pid);
-      candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
+      candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
       candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9;
 
@@ -255,47 +132,11 @@
 
       candidate->Momentum.SetPxPyPzE(px, py, pz, e);
-      candidate->Momentum.RotateZ(dphi);
-      pt = candidate->Momentum.Pt();
+      candidate->Position.SetXYZT(x, y, z + dz, t);
 
-      x -= fInputBeamSpotX;
-      y -= fInputBeamSpotY;
-      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
-      candidate->Position.RotateZ(dphi);
-      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
-
-      vx += candidate->Position.X();
-      vy += candidate->Position.Y();
-
-      ++numberOfParticles;
-      if(TMath::Abs(candidate->Charge) > 1.0E-9)
-      {
-        nch++;
-        sumpt2 += pt * pt;
-        vertex->AddCandidate(candidate);
-      }
-
-      fParticleOutputArray->Add(candidate);
+      fOutputArray->Add(candidate);
     }
-
-    if(numberOfParticles > 0)
-    {
-      vx /= numberOfParticles;
-      vy /= numberOfParticles;
-    }
-
-    nvtx++;
-
-    vertex->Position.SetXYZT(vx, vy, dz, dt);
-
-    vertex->ClusterIndex = nvtx;
-    vertex->ClusterNDF = nch;
-    vertex->SumPT2 = sumpt2;
-    vertex->GenSumPT2 = sumpt2;
-
-    vertex->IsPU = 1;
-
-    fVertexOutputArray->Add(vertex);
   }
 }
 
 //------------------------------------------------------------------------------
+
Index: modules/PileUpMerger.h
===================================================================
--- modules/PileUpMerger.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/PileUpMerger.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef PileUpMerger_h
 #define PileUpMerger_h
@@ -23,4 +5,9 @@
  *
  *  Merges particles from pile-up sample into event
+ *
+ *
+ *  $Date: 2013-02-12 15:13:59 +0100 (Tue, 12 Feb 2013) $
+ *  $Revision: 907 $
+ *
  *
  *  \author M. Selvaggi - UCL, Louvain-la-Neuve
@@ -32,9 +19,9 @@
 class TObjArray;
 class DelphesPileUpReader;
-class DelphesTF2;
 
 class PileUpMerger: public DelphesModule
 {
 public:
+
   PileUpMerger();
   ~PileUpMerger();
@@ -45,18 +32,9 @@
 
 private:
-  Int_t fPileUpDistribution;
+
   Double_t fMeanPileUp;
+  Double_t fZVertexSpread;
 
-  Double_t fZVertexSpread;
-  Double_t fTVertexSpread;
-
-  Double_t fInputBeamSpotX;
-  Double_t fInputBeamSpotY;
-  Double_t fOutputBeamSpotX;
-  Double_t fOutputBeamSpotY;
-
-  DelphesTF2 *fFunction; //!
-
-  DelphesPileUpReader *fReader; //!
+  DelphesPileUpReader *fReader;
 
   TIterator *fItInputArray; //!
@@ -64,6 +42,5 @@
   const TObjArray *fInputArray; //!
 
-  TObjArray *fParticleOutputArray; //!
-  TObjArray *fVertexOutputArray; //!
+  TObjArray *fOutputArray; //!
 
   ClassDef(PileUpMerger, 1)
Index: modules/PileUpMergerPythia8.cc
===================================================================
--- modules/PileUpMergerPythia8.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class PileUpMergerPythia8
- *
- *  Merges particles from pile-up sample into event
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/PileUpMergerPythia8.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesPileUpReader.h"
-#include "classes/DelphesTF2.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "Pythia.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-PileUpMergerPythia8::PileUpMergerPythia8() :
-  fFunction(0), fPythia(0), fItInputArray(0)
-{
-  fFunction = new DelphesTF2;
-}
-
-//------------------------------------------------------------------------------
-
-PileUpMergerPythia8::~PileUpMergerPythia8()
-{
-  delete fFunction;
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpMergerPythia8::Init()
-{
-  const char *fileName;
-
-  fPileUpDistribution = GetInt("PileUpDistribution", 0);
-
-  fMeanPileUp = GetDouble("MeanPileUp", 10);
-
-  fZVertexSpread = GetDouble("ZVertexSpread", 0.15);
-  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
-
-  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
-  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
-  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
-  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
-
-  fPTMin = GetDouble("PTMin", 0.0);
-
-  fFunction->Compile(GetString("VertexDistributionFormula", "0.0"));
-  fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread);
-
-  fileName = GetString("ConfigFile", "MinBias.cmnd");
-  fPythia = new Pythia8::Pythia();
-  fPythia->readFile(fileName);
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output arrays
-  fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles"));
-  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpMergerPythia8::Finish()
-{
-  if(fPythia) delete fPythia;
-}
-
-//------------------------------------------------------------------------------
-
-void PileUpMergerPythia8::Process()
-{
-  TDatabasePDG *pdg = TDatabasePDG::Instance();
-  TParticlePDG *pdgParticle;
-  Int_t pid, status;
-  Float_t x, y, z, t, vx, vy;
-  Float_t px, py, pz, e;
-  Double_t dz, dphi, dt;
-  Int_t numberOfEvents, event, numberOfParticles, i;
-  Candidate *candidate, *vertex;
-  DelphesFactory *factory;
-
-  const Double_t c_light = 2.99792458E8;
-
-  fItInputArray->Reset();
-
-  // --- Deal with primary vertex first  ------
-
-  fFunction->GetRandom2(dz, dt);
-
-  dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
-  dz *= 1.0E3; // necessary in order to make z in mm
-  vx = 0.0;
-  vy = 0.0;
-  numberOfParticles = fInputArray->GetEntriesFast();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    vx += candidate->Position.X();
-    vy += candidate->Position.Y();
-    z = candidate->Position.Z();
-    t = candidate->Position.T();
-    candidate->Position.SetZ(z + dz);
-    candidate->Position.SetT(t + dt);
-    fParticleOutputArray->Add(candidate);
-  }
-
-  if(numberOfParticles > 0)
-  {
-    vx /= numberOfParticles;
-    vy /= numberOfParticles;
-  }
-
-  factory = GetFactory();
-
-  vertex = factory->NewCandidate();
-  vertex->Position.SetXYZT(vx, vy, dz, dt);
-  fVertexOutputArray->Add(vertex);
-
-  // --- Then with pile-up vertices  ------
-
-  switch(fPileUpDistribution)
-  {
-  case 0:
-    numberOfEvents = gRandom->Poisson(fMeanPileUp);
-    break;
-  case 1:
-    numberOfEvents = gRandom->Integer(2 * fMeanPileUp + 1);
-    break;
-  default:
-    numberOfEvents = gRandom->Poisson(fMeanPileUp);
-    break;
-  }
-
-  for(event = 0; event < numberOfEvents; ++event)
-  {
-    while(!fPythia->next())
-      ;
-
-    // --- Pile-up vertex smearing
-
-    fFunction->GetRandom2(dz, dt);
-
-    dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
-    dz *= 1.0E3; // necessary in order to make z in mm
-
-    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
-
-    vx = 0.0;
-    vy = 0.0;
-    numberOfParticles = fPythia->event.size();
-    for(i = 1; i < numberOfParticles; ++i)
-    {
-      Pythia8::Particle &particle = fPythia->event[i];
-
-      status = particle.statusHepMC();
-
-      if(status != 1 || !particle.isVisible() || particle.pT() <= fPTMin) continue;
-
-      pid = particle.id();
-      px = particle.px();
-      py = particle.py();
-      pz = particle.pz();
-      e = particle.e();
-      x = particle.xProd();
-      y = particle.yProd();
-      z = particle.zProd();
-      t = particle.tProd();
-
-      candidate = factory->NewCandidate();
-
-      candidate->PID = pid;
-
-      candidate->Status = 1;
-
-      pdgParticle = pdg->GetParticle(pid);
-      candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
-      candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9;
-
-      candidate->IsPU = 1;
-
-      candidate->Momentum.SetPxPyPzE(px, py, pz, e);
-      candidate->Momentum.RotateZ(dphi);
-
-      x -= fInputBeamSpotX;
-      y -= fInputBeamSpotY;
-      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
-      candidate->Position.RotateZ(dphi);
-      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
-
-      vx += candidate->Position.X();
-      vy += candidate->Position.Y();
-
-      fParticleOutputArray->Add(candidate);
-    }
-
-    if(numberOfParticles > 0)
-    {
-      vx /= numberOfParticles;
-      vy /= numberOfParticles;
-    }
-
-    vertex = factory->NewCandidate();
-    vertex->Position.SetXYZT(vx, vy, dz, dt);
-    vertex->IsPU = 1;
-
-    fVertexOutputArray->Add(vertex);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/PileUpMergerPythia8.h
===================================================================
--- modules/PileUpMergerPythia8.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PileUpMergerPythia8_h
-#define PileUpMergerPythia8_h
-
-/** \class PileUpMergerPythia8
- *
- *  Merges particles from pile-up sample into event
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TObjArray;
-class DelphesTF2;
-
-namespace Pythia8
-{
-class Pythia;
-};
-
-class PileUpMergerPythia8: public DelphesModule
-{
-public:
-  PileUpMergerPythia8();
-  ~PileUpMergerPythia8();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Int_t fPileUpDistribution;
-  Double_t fMeanPileUp;
-
-  Double_t fZVertexSpread;
-  Double_t fTVertexSpread;
-
-  Double_t fInputBeamSpotX;
-  Double_t fInputBeamSpotY;
-  Double_t fOutputBeamSpotX;
-  Double_t fOutputBeamSpotY;
-
-  Double_t fPTMin;
-
-  DelphesTF2 *fFunction; //!
-
-  Pythia8::Pythia *fPythia; //!
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fParticleOutputArray; //!
-  TObjArray *fVertexOutputArray; //!
-
-  ClassDef(PileUpMergerPythia8, 1)
-};
-
-#endif
Index: modules/Pythia8LinkDef.h
===================================================================
--- modules/Pythia8LinkDef.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-/** \class
- *
- *  Lists classes to be included in cint dicitonary
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/PileUpMergerPythia8.h"
-
-#ifdef __CINT__
-
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ class PileUpMergerPythia8+;
-
-#endif
Index: modules/RecoPuFilter.cc
===================================================================
--- modules/RecoPuFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*  \class RecoPuFilter
- *
- *  Removes particles with RecoPU flag = true.
- *  Input collection needs to pass by TrackPileUpSubtractor first)
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "modules/RecoPuFilter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-RecoPuFilter::RecoPuFilter() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-RecoPuFilter::~RecoPuFilter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void RecoPuFilter::Init()
-{
-
-  ExRootConfParam param;
-  Size_t i, size;
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void RecoPuFilter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void RecoPuFilter::Process()
-{
-  Candidate *candidate;
-  Int_t pdgCode;
-  Bool_t pass;
-  Double_t pt;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    if(candidate->IsRecoPU) continue;
-    fOutputArray->Add(candidate);
-  }
-}
Index: modules/RecoPuFilter.h
===================================================================
--- modules/RecoPuFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-//------------------------------------------------------------------------------
-
-#ifndef RecoPuFilter_h
-#define RecoPuFilter_h
-
-/** \class RecoPuFilter
- *
- *  Removes particles with RecoPU flag = true.
- *  Input collection needs to pass by TrackPileUpSubtractor first)
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-#include <vector>
-
-class TIterator;
-class TObjArray;
-
-class RecoPuFilter: public DelphesModule
-{
-public:
-  RecoPuFilter();
-  ~RecoPuFilter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(RecoPuFilter, 1)
-};
-
-#endif
Index: modules/RunPUPPI.cc
===================================================================
--- modules/RunPUPPI.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,288 +1,0 @@
-#include "modules/RunPUPPI.h"
-
-#include "PUPPI/AlgoObj.hh"
-#include "PUPPI/PuppiContainer.hh"
-#include "PUPPI/RecoObj2.hh"
-
-#include "fastjet/PseudoJet.hh"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include <vector>
-
-using namespace std;
-using namespace fastjet;
-
-//------------------------------------------------------------------------------
-RunPUPPI::RunPUPPI() :
-  fItTrackInputArray(0),
-  fItNeutralInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-RunPUPPI::~RunPUPPI() {}
-
-//------------------------------------------------------------------------------
-
-void RunPUPPI::Init()
-{
-  // input collection
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/towers"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/towers"));
-  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
-  fPVInputArray = ImportArray(GetString("PVInputArray", "PV"));
-  fPVItInputArray = fPVInputArray->MakeIterator();
-  // puppi parameters
-  fApplyNoLep = GetBool("UseNoLep", true);
-  fMinPuppiWeight = GetDouble("MinPuppiWeight", 0.01);
-  fUseExp = GetBool("UseExp", false);
-  // read eta min ranges
-  ExRootConfParam param = GetParam("EtaMinBin");
-  fEtaMinBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fEtaMinBin.push_back(param[iMap].GetDouble());
-  // read eta max ranges
-  param = GetParam("EtaMaxBin");
-  fEtaMaxBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fEtaMaxBin.push_back(param[iMap].GetDouble());
-  // read pt min value
-  param = GetParam("PtMinBin");
-  fPtMinBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fPtMinBin.push_back(param[iMap].GetDouble());
-  // read cone size
-  param = GetParam("ConeSizeBin");
-  fConeSizeBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fConeSizeBin.push_back(param[iMap].GetDouble());
-  // read RMS min pt
-  param = GetParam("RMSPtMinBin");
-  fRMSPtMinBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fRMSPtMinBin.push_back(param[iMap].GetDouble());
-  // read RMS scale factor
-  param = GetParam("RMSScaleFactorBin");
-  fRMSScaleFactorBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fRMSScaleFactorBin.push_back(param[iMap].GetDouble());
-  // read neutral pt min cut
-  param = GetParam("NeutralMinEBin");
-  fNeutralMinEBin.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralMinEBin.push_back(param[iMap].GetDouble());
-  // read neutral pt min slope
-  param = GetParam("NeutralPtSlope");
-  fNeutralPtSlope.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralPtSlope.push_back(param[iMap].GetDouble());
-  // read apply chs
-  //param = GetParam("ApplyCHS");
-  //fApplyCHS.clear();
-  //for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyCHS.push_back(param[iMap].GetBool());
-  // read use charged
-  param = GetParam("UseCharged");
-  fUseCharged.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fUseCharged.push_back(param[iMap].GetBool());
-  // read apply chs correction
-  param = GetParam("ApplyLowPUCorr");
-  fApplyLowPUCorr.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyLowPUCorr.push_back(param[iMap].GetBool());
-  // read metric id
-  param = GetParam("MetricId");
-  fMetricId.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fMetricId.push_back(param[iMap].GetInt());
-  // scheme for combining
-  param = GetParam("CombId");
-  fCombId.clear();
-  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fCombId.push_back(param[iMap].GetInt());
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "puppiParticles"));
-  fOutputTrackArray = ExportArray(GetString("OutputArrayTracks", "puppiTracks"));
-  fOutputNeutralArray = ExportArray(GetString("OutputArrayNeutrals", "puppiNeutrals"));
-  // Create algorithm list for puppi
-  std::vector<AlgoObj> puppiAlgo;
-  if(puppiAlgo.empty())
-  {
-    if(!(fEtaMinBin.size() == fEtaMaxBin.size() and fEtaMinBin.size() == fPtMinBin.size() and fEtaMinBin.size() == fConeSizeBin.size() and fEtaMinBin.size() == fRMSPtMinBin.size()
-         and fEtaMinBin.size() == fRMSScaleFactorBin.size() and fEtaMinBin.size() == fNeutralMinEBin.size() and fEtaMinBin.size() == fNeutralPtSlope.size()
-         and fEtaMinBin.size() == fUseCharged.size()
-         and fEtaMinBin.size() == fApplyLowPUCorr.size() and fEtaMinBin.size() == fMetricId.size()))
-    {
-      std::cerr << " Error in PUPPI configuration, algo info should have the same size --> exit from the code" << std::endl;
-      std::exit(EXIT_FAILURE);
-    }
-  }
-  for(size_t iAlgo = 0; iAlgo < fEtaMinBin.size(); iAlgo++)
-  {
-    AlgoObj algoTmp;
-    algoTmp.etaMin = fEtaMinBin.at(iAlgo);
-    algoTmp.etaMax = fEtaMaxBin.at(iAlgo);
-    algoTmp.ptMin = fPtMinBin.at(iAlgo);
-    algoTmp.minNeutralPt = fNeutralMinEBin.at(iAlgo);
-    algoTmp.minNeutralPtSlope = fNeutralPtSlope.at(iAlgo);
-    //Eta Extrapolation stuff is missing
-    //Loop through file requiring algos for same bins to be adjacent
-    while(iAlgo < fEtaMinBin.size() and algoTmp.etaMin == fEtaMinBin.at(iAlgo) and algoTmp.etaMax == fEtaMaxBin.at(iAlgo))
-    {
-      AlgoSubObj algoSubTmp;
-      algoSubTmp.metricId = fMetricId.at(iAlgo);
-      algoSubTmp.useCharged = fUseCharged.at(iAlgo);
-      algoSubTmp.applyLowPUCorr = fApplyLowPUCorr.at(iAlgo);
-      algoSubTmp.combId = fCombId.at(iAlgo);
-      algoSubTmp.coneSize = fConeSizeBin.at(iAlgo);
-      algoSubTmp.rmsPtMin = fRMSPtMinBin.at(iAlgo);
-      algoSubTmp.rmsScaleFactor = fRMSScaleFactorBin.at(iAlgo);
-      algoTmp.subAlgos.push_back(algoSubTmp);
-      iAlgo++;
-    }
-    iAlgo--;
-    //if(std::find(puppiAlgo.begin(),puppiAlgo.end(),algoTmp) != puppiAlgo.end()) continue;
-    puppiAlgo.push_back(algoTmp);
-  }
-  fPuppi = new PuppiContainer(true, fUseExp, fMinPuppiWeight, puppiAlgo);
-}
-
-//------------------------------------------------------------------------------
-
-void RunPUPPI::Finish()
-{
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  if(fItNeutralInputArray) delete fItNeutralInputArray;
-  if(fPuppi) delete fPuppi;
-}
-
-//------------------------------------------------------------------------------
-
-void RunPUPPI::Process()
-{
-
-  Candidate *candidate, *particle;
-  TLorentzVector momentum;
-
-  //DelphesFactory *factory = GetFactory();
-
-  // loop over input objects
-  fItTrackInputArray->Reset();
-  fItNeutralInputArray->Reset();
-  fPVItInputArray->Reset();
-
-  std::vector<Candidate *> InputParticles;
-  InputParticles.clear();
-
-  // take the leading vertex
-  float PVZ = 0.;
-  Candidate *pv = static_cast<Candidate *>(fPVItInputArray->Next());
-  if(pv) PVZ = pv->Position.Z();
-  // Fill input particles for puppi
-  std::vector<RecoObj> puppiInputVector;
-  puppiInputVector.clear();
-  int lNBad = 0;
-  // Loop on charge track candidate
-  while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next())))
-  {
-    momentum = candidate->Momentum;
-    RecoObj curRecoObj;
-    curRecoObj.pt = momentum.Pt();
-    curRecoObj.eta = momentum.Eta();
-    curRecoObj.phi = momentum.Phi();
-    curRecoObj.m = momentum.M();
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); //if(fApplyNoLep && TMath::Abs(candidate->PID) == 11) continue; //Dumb cut to minimize the nolepton on electron
-    //if(fApplyNoLep && TMath::Abs(candidate->PID) == 13) continue;
-    if(candidate->IsRecoPU and candidate->Charge != 0)
-    { // if it comes fromPU vertexes after the resolution smearing and the dZ matching within resolution
-      lNBad++;
-      curRecoObj.id = 2;
-      curRecoObj.vtxId = 0.7 * (fPVInputArray->GetEntries()); //Hack apply reco vtx efficiency of 70% for calibration
-      if(TMath::Abs(candidate->PID) == 11)
-        curRecoObj.pfType = 2;
-      else if(TMath::Abs(candidate->PID) == 13)
-        curRecoObj.pfType = 3;
-      else if(TMath::Abs(candidate->PID) == 22)
-        curRecoObj.pfType = 4;
-      else
-        curRecoObj.pfType = 1;
-      curRecoObj.dZ = particle->Position.Z() - PVZ;
-    }
-    else if(!candidate->IsRecoPU && candidate->Charge != 0)
-    {
-      curRecoObj.id = 1; // charge from LV
-      curRecoObj.vtxId = 1; // from PV
-      if(TMath::Abs(candidate->PID) == 11)
-        curRecoObj.pfType = 2;
-      else if(TMath::Abs(candidate->PID) == 13)
-        curRecoObj.pfType = 3;
-      else if(TMath::Abs(candidate->PID) == 22)
-        curRecoObj.pfType = 4;
-      else
-        curRecoObj.pfType = 1;
-      curRecoObj.dZ = particle->Position.Z() - PVZ;
-    }
-    else
-    {
-      std::cerr << " RunPUPPI: problem with a charged track --> it has charge 0 " << std::endl;
-      continue;
-    }
-
-    puppiInputVector.push_back(curRecoObj);
-    InputParticles.push_back(candidate);
-  }
-
-  // Loop on neutral calo cells
-  while((candidate = static_cast<Candidate *>(fItNeutralInputArray->Next())))
-  {
-    momentum = candidate->Momentum;
-    RecoObj curRecoObj;
-    curRecoObj.pt = momentum.Pt();
-    curRecoObj.eta = momentum.Eta();
-    curRecoObj.phi = momentum.Phi();
-    curRecoObj.m = momentum.M();
-    curRecoObj.charge = 0;
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-    if(candidate->Charge == 0)
-    {
-      curRecoObj.id = 0; // neutrals have id==0
-      curRecoObj.vtxId = 0; // neutrals have vtxId==0
-      if(TMath::Abs(candidate->PID) == 11)
-        curRecoObj.pfType = 2;
-      else if(TMath::Abs(candidate->PID) == 13)
-        curRecoObj.pfType = 3;
-      else if(TMath::Abs(candidate->PID) == 22)
-        curRecoObj.pfType = 4;
-      else
-        curRecoObj.pfType = 5;
-      curRecoObj.dZ = particle->Position.Z() - PVZ;
-    }
-    else
-    {
-      std::cerr << " RunPUPPI: problem with a neutrals cells --> it has charge !=0 " << std::endl;
-      continue;
-    }
-    puppiInputVector.push_back(curRecoObj);
-    InputParticles.push_back(candidate);
-  }
-  // Create PUPPI container
-  fPuppi->initialize(puppiInputVector);
-  fPuppi->puppiWeights();
-  std::vector<PseudoJet> puppiParticles = fPuppi->puppiParticles();
-
-  // Loop on final particles
-  for(std::vector<PseudoJet>::iterator it = puppiParticles.begin(); it != puppiParticles.end(); it++)
-  {
-    if(it->user_index() <= int(InputParticles.size()))
-    {
-      candidate = static_cast<Candidate *>(InputParticles.at(it->user_index())->Clone());
-      candidate->Momentum.SetPxPyPzE(it->px(), it->py(), it->pz(), it->e());
-      fOutputArray->Add(candidate);
-      if(puppiInputVector.at(it->user_index()).id == 1 or puppiInputVector.at(it->user_index()).id == 2)
-        fOutputTrackArray->Add(candidate);
-      else if(puppiInputVector.at(it->user_index()).id == 0)
-        fOutputNeutralArray->Add(candidate);
-    }
-    else
-    {
-      std::cerr << " particle not found in the input Array --> skip " << std::endl;
-      continue;
-    }
-  }
-}
Index: modules/RunPUPPI.h
===================================================================
--- modules/RunPUPPI.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#ifndef RunPUPPI_h
-#define RunPUPPI_h
-
-#include "classes/DelphesModule.h"
-#include <vector>
-
-class TObjArray;
-class TIterator;
-class PuppiContainer;
-
-class RunPUPPI: public DelphesModule
-{
-
-public:
-  RunPUPPI();
-  ~RunPUPPI();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  TIterator *fItTrackInputArray;
-  TIterator *fItNeutralInputArray; //!
-  TIterator *fPVItInputArray; //!
-
-  const TObjArray *fTrackInputArray;
-  const TObjArray *fNeutralInputArray; //!
-  const TObjArray *fPVInputArray; //!
-  PuppiContainer *fPuppi;
-  // puppi parameters
-  bool fApplyNoLep;
-  double fMinPuppiWeight;
-  bool fUseExp;
-
-  std::vector<float> fEtaMinBin;
-  std::vector<float> fEtaMaxBin;
-  std::vector<float> fPtMinBin;
-  std::vector<float> fConeSizeBin;
-  std::vector<float> fRMSPtMinBin;
-  std::vector<float> fRMSScaleFactorBin;
-  std::vector<float> fNeutralMinEBin;
-  std::vector<float> fNeutralPtSlope;
-  std::vector<bool> fApplyCHS;
-  std::vector<bool> fUseCharged;
-  std::vector<bool> fApplyLowPUCorr;
-  std::vector<int> fMetricId;
-  std::vector<int> fCombId;
-
-  TObjArray *fOutputArray;
-  TObjArray *fOutputTrackArray;
-  TObjArray *fOutputNeutralArray;
-
-  ClassDef(RunPUPPI, 1)
-};
-
-#endif
Index: modules/SimpleCalorimeter.cc
===================================================================
--- modules/SimpleCalorimeter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,550 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class SimpleCalorimeter
- *
- *  Fills SimpleCalorimeter towers, performs SimpleCalorimeter resolution smearing,
- *  and creates energy flow objects (tracks, photons, and neutral hadrons).
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/SimpleCalorimeter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-SimpleCalorimeter::SimpleCalorimeter() :
-  fResolutionFormula(0),
-  fItParticleInputArray(0), fItTrackInputArray(0)
-{
-
-  fResolutionFormula = new DelphesFormula;
-  fTowerTrackArray = new TObjArray;
-  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-SimpleCalorimeter::~SimpleCalorimeter()
-{
-
-  if(fResolutionFormula) delete fResolutionFormula;
-  if(fTowerTrackArray) delete fTowerTrackArray;
-  if(fItTowerTrackArray) delete fItTowerTrackArray;
-}
-
-//------------------------------------------------------------------------------
-
-void SimpleCalorimeter::Init()
-{
-  ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
-  Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
-  Double_t fraction;
-  TBinMap::iterator itEtaBin;
-  set<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  // read eta and phi bins
-  param = GetParam("EtaPhiBins");
-  size = param.GetSize();
-  fBinMap.clear();
-  fEtaBins.clear();
-  fPhiBins.clear();
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramEtaBins = param[i * 2];
-    sizeEtaBins = paramEtaBins.GetSize();
-    paramPhiBins = param[i * 2 + 1];
-    sizePhiBins = paramPhiBins.GetSize();
-
-    for(j = 0; j < sizeEtaBins; ++j)
-    {
-      for(k = 0; k < sizePhiBins; ++k)
-      {
-        fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
-      }
-    }
-  }
-
-  // for better performance we transform map of sets to parallel vectors:
-  // vector< double > and vector< vector< double >* >
-  for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
-  {
-    fEtaBins.push_back(itEtaBin->first);
-    phiBins = new vector<double>(itEtaBin->second.size());
-    fPhiBins.push_back(phiBins);
-    phiBins->clear();
-    for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
-    {
-      phiBins->push_back(*itPhiBin);
-    }
-  }
-
-  // read energy fractions for different particles
-  param = GetParam("EnergyFraction");
-  size = param.GetSize();
-
-  // set default energy fractions values
-  fFractionMap.clear();
-  fFractionMap[0] = 1.0;
-
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramFractions = param[i * 2 + 1];
-    fraction = paramFractions[0].GetDouble();
-    fFractionMap[param[i * 2].GetInt()] = fraction;
-  }
-
-  // read min E value for towers to be saved
-  fEnergyMin = GetDouble("EnergyMin", 0.0);
-
-  fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0);
-
-  // flag that says if current calo is Ecal of Hcal (will then fill correct values of Eem and Ehad)
-  fIsEcal = GetBool("IsEcal", false);
-
-  // switch on or off the dithering of the center of calorimeter towers
-  fSmearTowerCenter = GetBool("SmearTowerCenter", true);
-
-  // read resolution formulas
-  fResolutionFormula->Compile(GetString("ResolutionFormula", "0"));
-
-  // import array with output from other modules
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
-  fItParticleInputArray = fParticleInputArray->MakeIterator();
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  // create output arrays
-  fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
-
-  fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
-  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
-}
-
-//------------------------------------------------------------------------------
-
-void SimpleCalorimeter::Finish()
-{
-  vector<vector<Double_t> *>::iterator itPhiBin;
-  if(fItParticleInputArray) delete fItParticleInputArray;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
-  {
-    delete *itPhiBin;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void SimpleCalorimeter::Process()
-{
-  Candidate *particle, *track;
-  TLorentzVector position, momentum;
-  Short_t etaBin, phiBin, flags;
-  Int_t number;
-  Long64_t towerHit, towerEtaPhi, hitEtaPhi;
-  Double_t fraction;
-  Double_t energy;
-  Double_t sigma;
-  Double_t energyGuess;
-
-  Int_t pdgCode;
-
-  TFractionMap::iterator itFractionMap;
-
-  vector<Double_t>::iterator itEtaBin;
-  vector<Double_t>::iterator itPhiBin;
-  vector<Double_t> *phiBins;
-
-  vector<Long64_t>::iterator itTowerHits;
-
-  DelphesFactory *factory = GetFactory();
-  fTowerHits.clear();
-  fTowerFractions.clear();
-  fTrackFractions.clear();
-
-  // loop over all particles
-  fItParticleInputArray->Reset();
-  number = -1;
-  fTowerRmax=0.;
-  while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))
-  {
-    const TLorentzVector &particlePosition = particle->Position;
-    ++number;
-
-    // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower)
-    if (particlePosition.Perp() > fTowerRmax)
-      fTowerRmax=particlePosition.Perp();
-
-    pdgCode = TMath::Abs(particle->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    fraction = itFractionMap->second;
-    fTowerFractions.push_back(fraction);
-
-    if(fraction < 1.0E-9) continue;
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), particlePosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), particlePosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 0;
-    flags |= (pdgCode == 11 || pdgCode == 22) << 1;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // loop over all tracks
-  fItTrackInputArray->Reset();
-  number = -1;
-  while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
-  {
-    const TLorentzVector &trackPosition = track->Position;
-    ++number;
-
-    pdgCode = TMath::Abs(track->PID);
-
-    itFractionMap = fFractionMap.find(pdgCode);
-    if(itFractionMap == fFractionMap.end())
-    {
-      itFractionMap = fFractionMap.find(0);
-    }
-
-    fraction = itFractionMap->second;
-
-    fTrackFractions.push_back(fraction);
-
-    // find eta bin [1, fEtaBins.size - 1]
-    itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
-    if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
-    etaBin = distance(fEtaBins.begin(), itEtaBin);
-
-    // phi bins for given eta bin
-    phiBins = fPhiBins[etaBin];
-
-    // find phi bin [1, phiBins.size - 1]
-    itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
-    if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
-    phiBin = distance(phiBins->begin(), itPhiBin);
-
-    flags = 1;
-
-    // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
-    towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
-
-    fTowerHits.push_back(towerHit);
-  }
-
-  // all hits are sorted first by eta bin number, then by phi bin number,
-  // then by flags and then by particle or track number
-  sort(fTowerHits.begin(), fTowerHits.end());
-
-  // loop over all hits
-  towerEtaPhi = 0;
-  fTower = 0;
-  for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
-  {
-    towerHit = (*itTowerHits);
-    flags = (towerHit >> 24) & 0x00000000000000FFLL;
-    number = (towerHit)&0x0000000000FFFFFFLL;
-    hitEtaPhi = towerHit >> 32;
-
-    if(towerEtaPhi != hitEtaPhi)
-    {
-      // switch to next tower
-      towerEtaPhi = hitEtaPhi;
-
-      // finalize previous tower
-      FinalizeTower();
-
-      // create new tower
-      fTower = factory->NewCandidate();
-
-      phiBin = (towerHit >> 32) & 0x000000000000FFFFLL;
-      etaBin = (towerHit >> 48) & 0x000000000000FFFFLL;
-
-      // phi bins for given eta bin
-      phiBins = fPhiBins[etaBin];
-
-      // calculate eta and phi of the tower's center
-      fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
-      fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
-
-      fTowerEdges[0] = fEtaBins[etaBin - 1];
-      fTowerEdges[1] = fEtaBins[etaBin];
-      fTowerEdges[2] = (*phiBins)[phiBin - 1];
-      fTowerEdges[3] = (*phiBins)[phiBin];
-
-      fTowerEnergy = 0.0;
-
-      fTrackEnergy = 0.0;
-      fTrackSigma = 0.0;
-
-      fTowerTime = 0.0;
-      fTrackTime = 0.0;
-
-      fTowerTimeWeight = 0.0;
-
-      fTowerTrackHits = 0;
-      fTowerPhotonHits = 0;
-
-      fTowerTrackArray->Clear();
-    }
-
-    // check for track hits
-    if(flags & 1)
-    {
-      ++fTowerTrackHits;
-
-      track = static_cast<Candidate *>(fTrackInputArray->At(number));
-      momentum = track->Momentum;
-      position = track->Position;
-
-      energy = momentum.E() * fTrackFractions[number];
-
-      fTrackTime += TMath::Sqrt(energy) * position.T();
-      fTrackTimeWeight += TMath::Sqrt(energy);
-
-      if(fTrackFractions[number] > 1.0E-9)
-      {
-
-        // compute total charged energy
-        fTrackEnergy += energy;
-        sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
-        if(sigma / momentum.E() < track->TrackResolution)
-          energyGuess = energy;
-        else
-          energyGuess = momentum.E();
-
-        fTrackSigma += ((track->TrackResolution) * energyGuess) * ((track->TrackResolution) * energyGuess);
-        fTowerTrackArray->Add(track);
-      }
-
-      else
-      {
-        fEFlowTrackOutputArray->Add(track);
-      }
-
-      continue;
-    }
-
-    // check for photon and electron hits in current tower
-    if(flags & 2) ++fTowerPhotonHits;
-
-    particle = static_cast<Candidate *>(fParticleInputArray->At(number));
-    momentum = particle->Momentum;
-    position = particle->Position;
-
-    // fill current tower
-    energy = momentum.E() * fTowerFractions[number];
-
-    fTowerEnergy += energy;
-
-    fTowerTime += energy * energy * position.T(); //sigma_t ~ 1/E
-    fTowerTimeWeight += energy * energy;
-
-    fTower->AddCandidate(particle);
-    fTower->Position = position;
-
-  }
-
-  // finalize last tower
-  FinalizeTower();
-}
-
-//------------------------------------------------------------------------------
-
-void SimpleCalorimeter::FinalizeTower()
-{
-  Candidate *tower, *track, *mother;
-  Double_t energy, neutralEnergy, pt, eta, phi, r;
-  Double_t sigma, neutralSigma;
-  Double_t time;
-
-  Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor;
-
-  TLorentzVector momentum;
-  TFractionMap::iterator itFractionMap;
-
-  if(!fTower) return;
-
-  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerEnergy);
-
-  energy = LogNormal(fTowerEnergy, sigma);
-
-  time = (fTowerTimeWeight < 1.0E-09) ? 0.0 : fTowerTime / fTowerTimeWeight;
-
-  sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
-
-  if(energy < fEnergyMin || energy < fEnergySignificanceMin * sigma) energy = 0.0;
-
-  if(fSmearTowerCenter)
-  {
-    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
-    phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
-  }
-  else
-  {
-    eta = fTowerEta;
-    phi = fTowerPhi;
-  }
-
-  pt = energy / TMath::CosH(eta);
-
-  // endcap
-  if (TMath::Abs(fTower->Position.Pt() - fTowerRmax) > 1.e-06 && TMath::Abs(eta) > 0.){
-    r = fTower->Position.Z()/TMath::SinH(eta);
-  }
-  // barrel
-  else {
-    r = fTower->Position.Pt();
-  }
-
-  fTower->Position.SetPtEtaPhiE(r, eta, phi, time);
-  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
-  fTower->L = fTower->Position.Vect().Mag();
-
-  fTower->Eem = (!fIsEcal) ? 0 : energy;
-  fTower->Ehad = (fIsEcal) ? 0 : energy;
-  fTower->Etrk = fTrackEnergy;
-
-  fTower->Edges[0] = fTowerEdges[0];
-  fTower->Edges[1] = fTowerEdges[1];
-  fTower->Edges[2] = fTowerEdges[2];
-  fTower->Edges[3] = fTowerEdges[3];
-
-  // fill SimpleCalorimeter towers
-  if(energy > 0.0) fTowerOutputArray->Add(fTower);
-
-  // e-flow candidates
-
-  //compute neutral excess
-
-  fTrackSigma = TMath::Sqrt(fTrackSigma);
-  neutralEnergy = max((energy - fTrackEnergy), 0.0);
-
-  //compute sigma_trk total
-  neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma * fTrackSigma + sigma * sigma);
-
-  // if neutral excess is significant, simply create neutral Eflow tower and clone each track into eflowtrack
-  if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin)
-  {
-    // create new photon tower
-    tower = static_cast<Candidate *>(fTower->Clone());
-    pt = neutralEnergy / TMath::CosH(eta);
-
-    tower->Eem = (!fIsEcal) ? 0 : neutralEnergy;
-    tower->Ehad = (fIsEcal) ? 0 : neutralEnergy;
-    tower->PID = (fIsEcal) ? 22 : 0;
-
-    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy);
-    fEFlowTowerOutputArray->Add(tower);
-
-    fItTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-
-  // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking
-  else if(fTrackEnergy > 0.0)
-  {
-    weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma * fTrackSigma) : 0.0;
-    weightCalo = (sigma > 0.0) ? 1 / (sigma * sigma) : 0.0;
-
-    bestEnergyEstimate = (weightTrack * fTrackEnergy + weightCalo * energy) / (weightTrack + weightCalo);
-    rescaleFactor = bestEnergyEstimate / fTrackEnergy;
-
-    fItTowerTrackArray->Reset();
-    while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))
-    {
-      mother = track;
-      track = static_cast<Candidate *>(track->Clone());
-      track->AddCandidate(mother);
-      track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M());
-      fEFlowTrackOutputArray->Add(track);
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
-
-Double_t SimpleCalorimeter::LogNormal(Double_t mean, Double_t sigma)
-{
-  Double_t a, b;
-
-  if(mean > 0.0)
-  {
-    b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));
-    a = TMath::Log(mean) - 0.5 * b * b;
-
-    return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0));
-  }
-  else
-  {
-    return 0.0;
-  }
-}
Index: modules/SimpleCalorimeter.h
===================================================================
--- modules/SimpleCalorimeter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,115 +1,0 @@
-
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef SimpleCalorimeter_h
-#define SimpleCalorimeter_h
-
-/** \class SimpleCalorimeter
- *
- *  Fills SimpleCalorimeter towers, performs SimpleCalorimeter resolution smearing,
- *  and creates energy flow objects (tracks, photons, and neutral hadrons).
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <set>
-#include <vector>
-
-class TObjArray;
-class DelphesFormula;
-class Candidate;
-
-class SimpleCalorimeter: public DelphesModule
-{
-public:
-  SimpleCalorimeter();
-  ~SimpleCalorimeter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  typedef std::map<Long64_t, Double_t> TFractionMap; //!
-  typedef std::map<Double_t, std::set<Double_t> > TBinMap; //!
-
-  Candidate *fTower;
-  Double_t fTowerEta, fTowerPhi, fTowerEdges[4];
-  Double_t fTowerEnergy;
-  Double_t fTrackEnergy;
-
-  Double_t fTowerTime;
-  Double_t fTrackTime;
-
-  Double_t fTowerRmax;
-
-  Double_t fTowerTimeWeight;
-  Double_t fTrackTimeWeight;
-
-  Int_t fTowerTrackHits, fTowerPhotonHits;
-
-  Double_t fEnergyMin;
-
-  Double_t fEnergySignificanceMin;
-
-  Double_t fTrackSigma;
-
-  Bool_t fSmearTowerCenter;
-
-  Bool_t fIsEcal; //!
-
-  TFractionMap fFractionMap; //!
-  TBinMap fBinMap; //!
-
-  std::vector<Double_t> fEtaBins;
-  std::vector<std::vector<Double_t> *> fPhiBins;
-
-  std::vector<Long64_t> fTowerHits;
-
-  std::vector<Double_t> fTowerFractions;
-
-  std::vector<Double_t> fTrackFractions;
-
-  DelphesFormula *fResolutionFormula; //!
-
-  TIterator *fItParticleInputArray; //!
-  TIterator *fItTrackInputArray; //!
-
-  const TObjArray *fParticleInputArray; //!
-  const TObjArray *fTrackInputArray; //!
-
-  TObjArray *fTowerOutputArray; //!
-
-  TObjArray *fEFlowTrackOutputArray; //!
-  TObjArray *fEFlowTowerOutputArray; //!
-
-  TObjArray *fTowerTrackArray; //!
-  TIterator *fItTowerTrackArray; //!
-
-  void FinalizeTower();
-  Double_t LogNormal(Double_t mean, Double_t sigma);
-
-  ClassDef(SimpleCalorimeter, 1)
-};
-
-#endif
Index: modules/StatusPidFilter.cc
===================================================================
--- modules/StatusPidFilter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/StatusPidFilter.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,24 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 /** \class StatusPidFilter
  *
  *  Removes all generated particles except electrons, muons, taus,
  *  and particles with status == 3.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author J. Hirschauer - FNAL
@@ -32,115 +18,22 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
-
-namespace
-{
-// integer power (faster than TMath::Pow() + cast to integer)
-int ipow(int base, int exp)
-{
-  int result = 1;
-  while(exp)
-  {
-    if(exp & 1)
-      result *= base;
-    exp >>= 1;
-    base *= base;
-  }
-
-  return result;
-}
-
-// standalone function to extract the i-th digit from a number (counting from 0 = rightmost, etc..)
-int digit(int val, int i)
-{
-  int y = ipow(10, i);
-  int z = val / y;
-  int val2 = val / (y * 10);
-  return (z - val2 * 10);
-}
-
-//  return the first two digits if this is a "fundamental" particle
-//  ID = 100 is a special case (internal generator ID's are 81-100)
-//  also, 101 and 102 are now used (by HepPID) for geantinos
-int fundamentalID(int pdgCode)
-{
-  pdgCode = abs(pdgCode);
-  if((digit(pdgCode, 9) == 1) && (digit(pdgCode, 8) == 0))
-  {
-    return 0;
-  }
-  if(digit(pdgCode, 2) == 0 && digit(pdgCode, 3) == 0)
-  {
-    return pdgCode % 10000;
-  }
-  else if(pdgCode <= 102)
-  {
-    return pdgCode;
-  }
-  else
-  {
-    return 0;
-  }
-}
-
-bool hasBottom(int pdgCode)
-{
-  if((pdgCode / 10000000) > 0)
-    return false;
-  if(pdgCode <= 100)
-    return false;
-  if(fundamentalID(pdgCode) <= 100 && fundamentalID(pdgCode) > 0)
-    return false;
-  if(digit(pdgCode, 3) == 5 || digit(pdgCode, 2) == 5 || digit(pdgCode, 1) == 5)
-    return true;
-  return false;
-}
-
-bool isTauDaughter(int pdgCode, int M1, const TObjArray *fInputArray)
-{
-  //not needed, just to speed up the code - can be further refined but gives only negligible improvement:
-  if(pdgCode == 15 || pdgCode < 11 || (pdgCode > 22 && pdgCode < 100) || pdgCode > 1000)
-    return false;
-
-  if(M1 < 0)
-    return false;
-
-  Candidate *mother;
-  mother = static_cast<Candidate *>(fInputArray->At(M1));
-  if(TMath::Abs(mother->PID) == 15)
-    return true;
-
-  return false;
-}
-
-bool isWDaughter(int M1, const TObjArray *fInputArray)
-{
-  if(M1 < 0) return false;
-
-  Candidate *mother;
-  mother = static_cast<Candidate *>(fInputArray->At(M1));
-  if(TMath::Abs(mother->PID) == 24) return true;
-
-  return false;
-}
-
-} // namespace
 
 //------------------------------------------------------------------------------
@@ -162,8 +55,6 @@
 {
   // PT threshold
+
   fPTMin = GetDouble("PTMin", 0.5);
-
-  // keep or remove pileup particles
-  fRequireNotPileup = GetBool("RequireNotPileup", false);
 
   // import input array
@@ -189,57 +80,18 @@
   Candidate *candidate;
   Int_t status, pdgCode;
-  Bool_t pass;
 
   fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
+  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
     status = candidate->Status;
     pdgCode = TMath::Abs(candidate->PID);
 
-    pass = kFALSE;
+    // Write all electrons, muons, taus and status == 3;
+    if(pdgCode != 11 && pdgCode != 13 && pdgCode != 15 && status != 3) continue;
 
-    // Store all SUSY particles
-    if(pdgCode >= 1000001 && pdgCode <= 1000039) pass = kTRUE;
-
-    // hard scattering particles (first condition for Py6, second for Py8)
-    if(status == 3) pass = kTRUE;
-    if(status > 20 && status < 30) pass = kTRUE;
-
-    // electrons, muons, taus and neutrinos
-    if(pdgCode > 10 && pdgCode < 17) pass = kTRUE;
-
-    // heavy quarks
-    if(pdgCode == 4 || pdgCode == 5 || pdgCode == 6) pass = kTRUE;
-
-    // Gauge bosons and other fundamental bosons
-    if(pdgCode > 22 && pdgCode < 43) pass = kTRUE;
-
-    //Stable photons
-    if(pdgCode == 22 && status == 1) pass = kTRUE;
-
-    // logic ported from HepPDF: http://lcgapp.cern.ch/project/simu/HepPDT/HepPDT.2.05.02/html/ParticleID_8cc-source.html#l00081
-    bool is_b_hadron = hasBottom(pdgCode);
-    bool is_b_quark = (pdgCode == 5);
-
-    bool is_tau_daughter = isTauDaughter(pdgCode, candidate->M1, fInputArray);
-
-    if(is_b_hadron)
-      pass = kTRUE;
-
-    if(is_tau_daughter)
-      pass = kTRUE;
-
-    bool is_W_daughter = isWDaughter(candidate->M1, fInputArray);
-    if(is_W_daughter)
-      pass = kTRUE;
-
-    // fPTMin not applied to b_hadrons / b_quarks to allow for b-enriched sample stitching
-    // fPTMin not applied to tau decay products to allow visible-tau four momentum determination
-    if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark || is_tau_daughter || is_W_daughter))) continue;
-
-    // not pileup particles
-    if(fRequireNotPileup && (candidate->IsPU > 0)) continue;
+    if(candidate->Momentum.Pt() <= fPTMin) continue;
 
     fOutputArray->Add(candidate);
   }
 }
+
Index: modules/StatusPidFilter.h
===================================================================
--- modules/StatusPidFilter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/StatusPidFilter.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 //------------------------------------------------------------------------------
 
@@ -26,4 +8,8 @@
  *  Removes all generated particles except electrons, muons, taus,
  *  and particles with status == 3.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author J. Hirschauer - FNAL
@@ -39,4 +25,5 @@
 {
 public:
+
   StatusPidFilter();
   ~StatusPidFilter();
@@ -47,7 +34,6 @@
 
 private:
+
   Double_t fPTMin; //!
-
-  Bool_t fRequireNotPileup; //!
 
   TIterator *fItInputArray; //!
Index: modules/TaggingParticlesSkimmer.cc
===================================================================
--- modules/TaggingParticlesSkimmer.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-//------------------------------------------------------------------------------
-
-/** \class TaggingParticlesSkimmer
- *
- *  Filters particle collection by only keeping gen particles useful for b and tau tagging.
- *  tau particles are replaced by their "visible decay".
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "modules/TaggingParticlesSkimmer.h"
-#include "modules/TauTagging.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-TaggingParticlesSkimmer::TaggingParticlesSkimmer() :
-  fClassifier(0), fFilter(0), fItPartonInputArray(0),
-  fPartonInputArray(0), fParticleInputArray(0), fOutputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-TaggingParticlesSkimmer::~TaggingParticlesSkimmer()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TaggingParticlesSkimmer::Init()
-{
-
-  fPTMin = GetDouble("PTMin", 15.0);
-  fEtaMax = GetDouble("EtaMax", 2.5);
-
-  // import input array
-  fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
-  fItPartonInputArray = fPartonInputArray->MakeIterator();
-
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles"));
-
-  fClassifier = new TauTaggingPartonClassifier(fParticleInputArray);
-  fClassifier->fPTMin = GetDouble("PTMin", 15.0);
-  fClassifier->fEtaMax = GetDouble("EtaMax", 2.5);
-
-  fFilter = new ExRootFilter(fPartonInputArray);
-
-  // output array
-  fOutputArray = ExportArray(GetString("OutputArray", "taggingParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void TaggingParticlesSkimmer::Finish()
-{
-  if(fItPartonInputArray) delete fItPartonInputArray;
-  if(fFilter) delete fFilter;
-  if(fClassifier) delete fClassifier;
-}
-
-//------------------------------------------------------------------------------
-
-void TaggingParticlesSkimmer::Process()
-{
-  Candidate *candidate, *tau, *daughter;
-  TLorentzVector tauMomentum;
-  Double_t pt, eta;
-  TObjArray *tauArray;
-  Int_t pdgCode, i;
-
-  // first select hadronic taus and replace them by visible part
-  fFilter->Reset();
-  tauArray = fFilter->GetSubArray(fClassifier, 0);
-
-  if(tauArray == 0) return;
-
-  TIter itTauArray(tauArray);
-
-  // loop over all input taus
-  itTauArray.Reset();
-  while((tau = static_cast<Candidate *>(itTauArray.Next())))
-  {
-    if(tau->D1 < 0) continue;
-
-    if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
-    {
-      throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
-    }
-
-    tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
-
-    for(i = tau->D1; i <= tau->D2; ++i)
-    {
-      daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
-      if(TMath::Abs(daughter->PID) == 16) continue;
-      tauMomentum += daughter->Momentum;
-    }
-
-    candidate = static_cast<Candidate *>(tau->Clone());
-    candidate->Momentum = tauMomentum;
-
-    fOutputArray->Add(candidate);
-  }
-
-  // then add all other partons (except tau's to avoid double counting)
-
-  fItPartonInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next())))
-  {
-    pdgCode = TMath::Abs(candidate->PID);
-    if(pdgCode == 15) continue;
-
-    pt = candidate->Momentum.Pt();
-    if(pt < fPTMin) continue;
-
-    eta = TMath::Abs(candidate->Momentum.Eta());
-    if(eta > fEtaMax) continue;
-
-    fOutputArray->Add(candidate);
-  }
-}
Index: modules/TaggingParticlesSkimmer.h
===================================================================
--- modules/TaggingParticlesSkimmer.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-//------------------------------------------------------------------------------
-
-#ifndef TaggingParticlesSkimmer_h
-#define TaggingParticlesSkimmer_h
-
-/** \class TaggingParticlesSkimmer
- *
- *  Filters particle collection by only keeping gen particles useful for b and tau tagging.
-    tau particles are replaced by their "visible decay".
- *
- *  \author M. Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-
-class ExRootFilter;
-class TauTaggingPartonClassifier;
-
-class TaggingParticlesSkimmer: public DelphesModule
-{
-public:
-  TaggingParticlesSkimmer();
-  ~TaggingParticlesSkimmer();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fPTMin; //!
-  Double_t fEtaMax; //!
-
-  TauTaggingPartonClassifier *fClassifier; //!
-
-  ExRootFilter *fFilter;
-
-  TIterator *fItPartonInputArray; //!
-
-  const TObjArray *fPartonInputArray; //!
-  const TObjArray *fParticleInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(TaggingParticlesSkimmer, 1)
-};
-
-#endif
Index: modules/TauTagging.cc
===================================================================
--- modules/TauTagging.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TauTagging.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class TauTagging
@@ -23,4 +6,8 @@
  *  and sets b-tagging flags
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -33,18 +20,37 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootClassifier.h"
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
+
+//------------------------------------------------------------------------------
+
+class TauTaggingPartonClassifier : public ExRootClassifier
+{
+public:
+
+  TauTaggingPartonClassifier(const TObjArray *array);
+
+  Int_t GetCategory(TObject *object);
+
+  Double_t fEtaMax, fPTMin;
+
+  const TObjArray *fParticleInputArray;
+};
 
 //------------------------------------------------------------------------------
@@ -59,9 +65,7 @@
 {
   Candidate *tau = static_cast<Candidate *>(object);
-  Candidate *daughter1 = 0;
-  Candidate *daughter2 = 0;
-
+  Candidate *daughter = 0;
   const TLorentzVector &momentum = tau->Momentum;
-  Int_t pdgCode, i, j;
+  Int_t pdgCode, i;
 
   pdgCode = TMath::Abs(tau->PID);
@@ -72,28 +76,11 @@
   if(tau->D1 < 0) return -1;
 
-  if(tau->D2 < tau->D1) return -1;
-
-  if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
-  {
-    throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
-  }
-
   for(i = tau->D1; i <= tau->D2; ++i)
   {
-    daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i));
-    pdgCode = TMath::Abs(daughter1->PID);
-    //if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15)
-    //  return -1;
-    if(pdgCode == 24)
-    {
-      if(daughter1->D1 < 0) return -1;
-      for(j = daughter1->D1; j <= daughter1->D2; ++j)
-      {
-        daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j));
-        pdgCode = TMath::Abs(daughter2->PID);
-        if(pdgCode == 11 || pdgCode == 13) return -1;
-      }
-    }
-  }
+    daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
+    pdgCode = TMath::Abs(daughter->PID);
+    if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15 || pdgCode == 24) return -1;
+  }
+
   return 0;
 }
@@ -117,11 +104,9 @@
 void TauTagging::Init()
 {
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   ExRootConfParam param;
   DelphesFormula *formula;
   Int_t i, size;
 
-  fBitNumber = GetInt("BitNumber", 0);
-
   fDeltaR = GetDouble("DeltaR", 0.5);
 
@@ -131,10 +116,10 @@
 
   fEfficiencyMap.clear();
-  for(i = 0; i < size / 2; ++i)
+  for(i = 0; i < size/2; ++i)
   {
     formula = new DelphesFormula;
-    formula->Compile(param[i * 2 + 1].GetString());
-
-    fEfficiencyMap[param[i * 2].GetInt()] = formula;
+    formula->Compile(param[i*2 + 1].GetString());
+
+    fEfficiencyMap[param[i*2].GetInt()] = formula;
   }
 
@@ -170,5 +155,5 @@
 void TauTagging::Finish()
 {
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   DelphesFormula *formula;
 
@@ -189,11 +174,10 @@
 void TauTagging::Process()
 {
-  Candidate *jet, *tau, *daughter, *part;
-  TLorentzVector tauMomentum;
-  Double_t pt, eta, phi, e, eff;
+  Candidate *jet, *tau;
+  Double_t pt, eta, phi;
   TObjArray *tauArray;
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
   DelphesFormula *formula;
-  Int_t pdgCode, charge, i;
+  Int_t pdgCode, charge;
 
   // select taus
@@ -201,10 +185,12 @@
   tauArray = fFilter->GetSubArray(fClassifier, 0);
 
+  if(tauArray == 0) return;
+
+  TIter itTauArray(tauArray);
+
   // loop over all input jets
   fItJetInputArray->Reset();
-
   while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
   {
-
     const TLorentzVector &jetMomentum = jet->Momentum;
     pdgCode = 0;
@@ -213,62 +199,15 @@
     phi = jetMomentum.Phi();
     pt = jetMomentum.Pt();
-    e = jetMomentum.E();
 
     // loop over all input taus
-    if(tauArray)
+    itTauArray.Reset();
+    while((tau = static_cast<Candidate *>(itTauArray.Next())))
     {
-      TIter itTauArray(tauArray);
-      while((tau = static_cast<Candidate *>(itTauArray.Next())))
+      if(jetMomentum.DeltaR(tau->Momentum) <= fDeltaR)
       {
-        if(tau->D1 < 0) continue;
-
-        if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
-        {
-          throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
-        }
-
-        tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
-
-        for(i = tau->D1; i <= tau->D2; ++i)
-        {
-          daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
-          if(TMath::Abs(daughter->PID) == 16) continue;
-          tauMomentum += daughter->Momentum;
-        }
-
-        if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR)
-        {
-          pdgCode = 15;
-          charge = tau->Charge;
-        }
+        pdgCode = 15;
+        charge = tau->Charge;
       }
     }
-    
-    // fake electrons and muons
-    
-    if (pdgCode == 0)
-    {
-     
-      Double_t drMin = fDeltaR;   
-      fItPartonInputArray->Reset();
-      while((part = static_cast<Candidate *>(fItPartonInputArray->Next())))
-      {
-        if(TMath::Abs(part->PID) == 11 || TMath::Abs(part->PID) == 13) 
-        {
-            tauMomentum = part->Momentum;
-            if (tauMomentum.Pt() < fClassifier->fPTMin) continue;
-            if (TMath::Abs(tauMomentum.Eta()) > fClassifier->fEtaMax) continue;
-
-            Double_t dr = jetMomentum.DeltaR(tauMomentum);
-            if( dr < drMin)
-            {
-               drMin = dr;
-               pdgCode = TMath::Abs(part->PID);
-               charge = part->Charge;
-            }  
-        }
-      }
-    }
-
     // find an efficency formula
     itEfficiencyMap = fEfficiencyMap.find(pdgCode);
@@ -280,8 +219,5 @@
 
     // apply an efficency formula
-    eff = formula->Eval(pt, eta, phi, e);
-    jet->TauTag |= (gRandom->Uniform() <= eff) << fBitNumber;
-    jet->TauWeight = eff;
-
+    jet->TauTag = gRandom->Uniform() <= formula->Eval(pt, eta);
     // set tau charge
     jet->Charge = charge;
Index: modules/TauTagging.h
===================================================================
--- modules/TauTagging.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TauTagging.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef TauTagging_h
 #define TauTagging_h
@@ -26,11 +8,12 @@
  *  and sets b-tagging flags 
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
  */
 
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 #include "classes/DelphesModule.h"
 
@@ -46,4 +29,5 @@
 {
 public:
+
   TauTagging();
   ~TauTagging();
@@ -54,18 +38,15 @@
 
 private:
-  Int_t fBitNumber;
 
   Double_t fDeltaR;
 
-#if !defined(__CINT__) && !defined(__CLING__)
-  std::map<Int_t, DelphesFormula *> fEfficiencyMap; //!
-#endif
-
+  std::map< Int_t, DelphesFormula * > fEfficiencyMap; //!
+  
   TauTaggingPartonClassifier *fClassifier; //!
-
+  
   ExRootFilter *fFilter;
 
   TIterator *fItPartonInputArray; //!
-
+  
   TIterator *fItJetInputArray; //!
 
@@ -73,5 +54,5 @@
 
   const TObjArray *fPartonInputArray; //!
-
+  
   const TObjArray *fJetInputArray; //!
 
@@ -79,17 +60,3 @@
 };
 
-//------------------------------------------------------------------------------
-
-class TauTaggingPartonClassifier: public ExRootClassifier
-{
-public:
-  TauTaggingPartonClassifier(const TObjArray *array);
-
-  Int_t GetCategory(TObject *object);
-
-  Double_t fEtaMax, fPTMin;
-
-  const TObjArray *fParticleInputArray;
-};
-
 #endif
Index: modules/TimeOfFlight.cc
===================================================================
--- modules/TimeOfFlight.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
- /** \class TimeOfFlight
-  *
-  *  Calculates Time-Of-Flight
-  *
-  *  \author Michele Selvaggi - CERN
-  *
- */
-
-#include "modules/TimeOfFlight.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-//------------------------------------------------------------------------------
-
-TimeOfFlight::TimeOfFlight() :
-  fItInputArray(0), fItVertexInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-TimeOfFlight::~TimeOfFlight()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TimeOfFlight::Init()
-{
-
-  // method to compute vertex time
-  fVertexTimeMode = GetInt("VertexTimeMode", 0);
-
-  // import track input array
-  fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // import vertex input array
-  fVertexInputArray = ImportArray(GetString("VertexInputArray", "TruthVertexFinder/vertices"));
-  fItVertexInputArray = fVertexInputArray->MakeIterator();
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void TimeOfFlight::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-  if(fItVertexInputArray) delete fItVertexInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TimeOfFlight::Process()
-{
-  Candidate *candidate, *particle, *vertex, *constituent, *mother;
-  Double_t ti, t_truth, tf;
-  Double_t l, tof, beta, p,  mass;
-
-  const Double_t c_light = 2.99792458E8;
-
-  // first compute momenta of vertices based on reconstructed tracks
-  ComputeVertexMomenta();
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-
-    const TLorentzVector &candidateInitialPosition = particle->Position;
-    const TLorentzVector &candidateInitialPositionSmeared = candidate->InitialPosition;
-    const TLorentzVector &candidateFinalPosition = candidate->Position;
-    const TLorentzVector &candidateMomentum = particle->Momentum;
-
-    // time at vertex from MC truth
-    t_truth = candidateInitialPosition.T() * 1.0E-3 / c_light;
-
-    // various options on how to calculate the vertex time
-    ti=0;
-    switch (fVertexTimeMode)
-	  {
-    	case 0:
-    	{
-        // assume ti from MC truth
-        // most aggressive, we are cheating and assume we can perfectly reconstruct time of primary and secondary vertices
-        ti = t_truth;
-        break;
-    	}
-    	case 1:
-    	{
-        // always assume t=0, most conservative assumption
-        // reasonable assumption for particles originating from PV, if beamSpot has small time spread compared to timing resolution
-        // probably bad assumption for particles from highly displaced vertices (i.e Ks)
-        ti=0;
-        break;
-    	}
-    	case 2:
-    	{
-        // same as 2 but attempt at estimate beta from vertex mass and momentum
-        beta = 1.;
-        fItVertexInputArray->Reset();
-        while((vertex = static_cast<Candidate *>(fItVertexInputArray->Next())))
-        {
-          TIter itGenParts(vertex->GetCandidates());
-          itGenParts.Reset();
-
-          while((constituent = static_cast<Candidate *>(itGenParts.Next())))
-          {
-            if (particle == constituent)
-            {
-              beta = vertex->Momentum.Beta();
-              break;
-            }
-          }
-        } // end vertex  loop
-
-        // track displacement to be possibily replaced by vertex fitted position
-        ti = candidateInitialPositionSmeared.Vect().Mag() * 1.0E-3 /(beta*c_light);
-      }
-      break;
-  	}
-
-    p = candidateMomentum.P();
-
-    // this quantity has already been smeared by another module
-    tf = candidateFinalPosition.T() * 1.0E-3 / c_light;
-
-    // calculate time-of-flight
-    tof = tf - ti;
-    // path length of the full helix
-    l = candidate->L * 1.0E-3;
-
-    // particle velocity
-    beta = l/(c_light*tof);
-
-    // calculate particle mass (i.e particle ID)
-    mass = 0.;
-    if (beta<1) mass = p* TMath::Sqrt(1/(beta*beta) - 1);
-
-    mother    = candidate;
-    candidate = static_cast<Candidate*>(candidate->Clone());
-
-    // update time at vertex based on option
-    candidate->InitialPosition.SetT(ti * 1.0E3 * c_light);
-
-    // update particle mass based on TOF-based PID (commented for now, assume this calculation is done offline)
-    //candidate->Momentum.SetVectM(candidateMomentum.Vect(), mass);
-
-    candidate->AddCandidate(mother);
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TimeOfFlight::ComputeVertexMomenta()
-{
-  Candidate *track, *constituent, *particle, *vertex;
-
-  fItVertexInputArray->Reset();
-  while((vertex = static_cast<Candidate *>(fItVertexInputArray->Next())))
-  {
-
-    TIter itGenParts(vertex->GetCandidates());
-    itGenParts.Reset();
-
-    while((constituent = static_cast<Candidate *>(itGenParts.Next())))
-    {
-      fItInputArray->Reset();
-      while((track = static_cast<Candidate *>(fItInputArray->Next())))
-      {
-        // get gen part that generated track
-        particle = static_cast<Candidate *>(track->GetCandidates()->At(0));
-        if (particle == constituent)
-        {
-          vertex->Momentum += track->Momentum;
-        }
-
-      } // end track loop
-    } // end vertex consitutent loop
-  } // end vertex  loop
-}
Index: modules/TimeOfFlight.h
===================================================================
--- modules/TimeOfFlight.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TimeOfFlight_h
-#define TimeOfFlight_h
-
-/** \class TimeOfFlight
- *
- *  Calculates Time-Of-Flight
- *
- *  \author Michele Selvaggi - CERN
- *
-*/
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-
-class TimeOfFlight: public DelphesModule
-{
-public:
-  TimeOfFlight();
-  ~TimeOfFlight();
-
-  void Init();
-  void Process();
-  void Finish();
-  void ComputeVertexMomenta();
-
-private:
-
-  Int_t fVertexTimeMode;
-
-  TIterator *fItInputArray; //!
-  TIterator *fItVertexInputArray; //!
-
-  const TObjArray *fInputArray; //!
-  const TObjArray *fVertexInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(TimeOfFlight, 1)
-};
-
-#endif
Index: modules/TimeSmearing.cc
===================================================================
--- modules/TimeSmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class TimeSmearing
- *
- *  Performs time smearing.
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "modules/TimeSmearing.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-//------------------------------------------------------------------------------
-
-TimeSmearing::TimeSmearing() :
-  fItInputArray(0), fResolutionFormula(0)
-{
-	fResolutionFormula = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-TimeSmearing::~TimeSmearing()
-{
-	if(fResolutionFormula) delete fResolutionFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void TimeSmearing::Init()
-{
-  // read resolution formula
-
-  // read time resolution formula in seconds
-  fResolutionFormula->Compile(GetString("TimeResolution", "30e-12"));
-
-  // import track input array
-  fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons"));
-  fItInputArray = fInputArray->MakeIterator();
-
-
-  // create output array
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void TimeSmearing::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TimeSmearing::Process()
-{
-  Candidate *candidate, *mother;
-  Double_t tf_smeared, tf;
-  Double_t eta, energy;
-  Double_t timeResolution;
-
-  const Double_t c_light = 2.99792458E8;
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    const TLorentzVector &candidateFinalPosition = candidate->Position;
-    const TLorentzVector &candidateMomentum = candidate->Momentum;
-
-    tf = candidateFinalPosition.T() * 1.0E-3 / c_light;
-
-    eta = candidateMomentum.Eta();
-    energy = candidateMomentum.E();
-
-    // apply smearing formula
-    timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy);
-    tf_smeared = gRandom->Gaus(tf, timeResolution);
-
-    mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
-
-    candidate->Position.SetT(tf_smeared * 1.0E3 * c_light);
-    candidate->ErrorT = timeResolution * 1.0E3 * c_light;
-
-    candidate->AddCandidate(mother);
-    fOutputArray->Add(candidate);
-  }
-}
Index: modules/TimeSmearing.h
===================================================================
--- modules/TimeSmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TimeSmearing_h
-#define TimeSmearing_h
-
-/** \class TimeSmearing
- *
- *  Performs time smearing.
- *
- *  \author Michele Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class TimeSmearing: public DelphesModule
-{
-public:
-  TimeSmearing();
-  ~TimeSmearing();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  DelphesFormula *fResolutionFormula;
-  Int_t fVertexTimeMode;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(TimeSmearing, 1)
-};
-
-#endif
Index: modules/TrackCountingBTagging.cc
===================================================================
--- modules/TrackCountingBTagging.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class TrackCountingBTagging
- *
- *  b-tagging algorithm based on counting tracks with large impact parameter
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/TrackCountingBTagging.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-TrackCountingBTagging::TrackCountingBTagging() :
-  fItTrackInputArray(0), fItJetInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-TrackCountingBTagging::~TrackCountingBTagging()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingBTagging::Init()
-{
-  fBitNumber = GetInt("BitNumber", 0);
-
-  fPtMin = GetDouble("TrackPtMin", 1.0);
-  fDeltaR = GetDouble("DeltaR", 0.3);
-  fIPmax = GetDouble("TrackIPMax", 2.0);
-
-  fSigMin = GetDouble("SigMin", 6.5);
-  fNtracks = GetInt("Ntracks", 3);
-
-  fUse3D = GetBool("Use3D", false);
-
-  // import input array(s)
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/eflowTracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
-  fItJetInputArray = fJetInputArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingBTagging::Finish()
-{
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  if(fItJetInputArray) delete fItJetInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingBTagging::Process()
-{
-  Candidate *jet, *track;
-
-  Double_t jpx, jpy, jpz;
-  Double_t dr, tpt;
-  Double_t xd, yd, zd, d0, dd0, dz, ddz, sip;
-
-  Int_t sign;
-
-  Int_t count;
-
-  // loop over all input jets
-  fItJetInputArray->Reset();
-  while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
-  {
-    const TLorentzVector &jetMomentum = jet->Momentum;
-    jpx = jetMomentum.Px();
-    jpy = jetMomentum.Py();
-    jpz = jetMomentum.Pz();
-
-    // loop over all input tracks
-    fItTrackInputArray->Reset();
-    count = 0;
-    // stop once we have enough tracks
-    while((track = static_cast<Candidate *>(fItTrackInputArray->Next())) and count < fNtracks)
-    {
-      const TLorentzVector &trkMomentum = track->Momentum;
-      tpt = trkMomentum.Pt();
-      if(tpt < fPtMin) continue;
-
-      d0 = TMath::Abs(track->D0);
-      if(d0 > fIPmax) continue;
-
-      dr = jetMomentum.DeltaR(trkMomentum);
-      if(dr > fDeltaR) continue;
-
-      xd = track->Xd;
-      yd = track->Yd;
-      zd = track->Zd;
-      dd0 = TMath::Abs(track->ErrorD0);
-      dz = TMath::Abs(track->DZ);
-      ddz = TMath::Abs(track->ErrorDZ);
-
-      if(fUse3D)
-      {
-        sign = (jpx * xd + jpy * yd + jpz * zd > 0.0) ? 1 : -1;
-        //add transverse and longitudinal significances in quadrature
-        sip = sign * TMath::Sqrt(TMath::Power(d0 / dd0, 2) + TMath::Power(dz / ddz, 2));
-      }
-      else
-      {
-        sign = (jpx * xd + jpy * yd > 0.0) ? 1 : -1;
-        sip = sign * d0 / TMath::Abs(dd0);
-      }
-
-      if(sip > fSigMin) count++;
-    }
-
-    // set BTag flag to true if count >= Ntracks
-    jet->BTag |= (count >= fNtracks) << fBitNumber;
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/TrackCountingBTagging.h
===================================================================
--- modules/TrackCountingBTagging.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TrackCountingBTagging_h
-#define TrackCountingBTagging_h
-
-/** \class TrackCountingBTagging
- *
- *  b-tagging algorithm based on counting tracks with large impact parameter
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-
-class TObjArray;
-
-class TrackCountingBTagging: public DelphesModule
-{
-public:
-  TrackCountingBTagging();
-  ~TrackCountingBTagging();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Int_t fBitNumber;
-
-  Double_t fPtMin;
-  Double_t fDeltaR;
-  Double_t fIPmax;
-  Double_t fSigMin;
-  Int_t fNtracks;
-  Bool_t fUse3D;
-
-  TIterator *fItTrackInputArray; //!
-  TIterator *fItJetInputArray; //!
-
-  const TObjArray *fTrackInputArray; //!
-  const TObjArray *fJetInputArray; //!
-
-  ClassDef(TrackCountingBTagging, 1)
-};
-
-#endif
Index: modules/TrackCountingTauTagging.cc
===================================================================
--- modules/TrackCountingTauTagging.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,297 +1,0 @@
-
-/** \class TrackCountingTauTagging
- *
- *  Determines origin of jet,
- *  applies b-tagging efficiency (miss identification rate) formulas
- *  and sets b-tagging flags
- *
- *  $Date: 2013-07-12 00:22:27 +0200 (Fri, 12 Jul 2013) $
- *  $Revision: 1217 $
- *
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/TrackCountingTauTagging.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-class TrackCountingTauTaggingPartonClassifier : public ExRootClassifier
-{
-public:
-  TrackCountingTauTaggingPartonClassifier(const TObjArray *array);
-
-  Int_t GetCategory(TObject *object);
-
-  Double_t fEtaMax, fPTMin;
-
-  const TObjArray *fParticleInputArray;
-};
-
-//------------------------------------------------------------------------------
-TrackCountingTauTaggingPartonClassifier::TrackCountingTauTaggingPartonClassifier(const TObjArray *array) :
-  fParticleInputArray(array)
-{
-}
-
-//------------------------------------------------------------------------------
-
-Int_t TrackCountingTauTaggingPartonClassifier::GetCategory(TObject *object)
-{
-  Candidate *tau = static_cast<Candidate *>(object);
-  Candidate *daughter1 = 0;
-  Candidate *daughter2 = 0;
-
-  const TLorentzVector &momentum = tau->Momentum;
-  Int_t pdgCode, i, j;
-
-  pdgCode = TMath::Abs(tau->PID);
-  if(pdgCode != 15) return -1;
-
-  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
-
-  if(tau->D1 < 0) return -1;
-
-  if(tau->D2 < tau->D1) return -1;
-
-  if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
-  {
-    throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
-  }
-
-  for(i = tau->D1; i <= tau->D2; ++i)
-  {
-    daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i));
-    pdgCode = TMath::Abs(daughter1->PID);
-    if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15)
-      return -1;
-    else if(pdgCode == 24)
-    {
-      if(daughter1->D1 < 0) return -1;
-      for(j = daughter1->D1; j <= daughter1->D2; ++j)
-      {
-        daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j));
-        pdgCode = TMath::Abs(daughter2->PID);
-        if(pdgCode == 11 || pdgCode == 13) return -1;
-      }
-    }
-  }
-
-  return 0;
-}
-
-//------------------------------------------------------------------------------
-
-TrackCountingTauTagging::TrackCountingTauTagging() :
-  fClassifier(0), fFilter(0),
-  fItPartonInputArray(0), fItTrackInputArray(0), fItJetInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-TrackCountingTauTagging::~TrackCountingTauTagging()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingTauTagging::Init()
-{
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
-  ExRootConfParam param;
-  DelphesFormula *formula;
-  Int_t i, size;
-
-  fBitNumber = GetInt("BitNumber", 0);
-
-  fDeltaR = GetDouble("DeltaR", 0.5);
-  fDeltaRTrack = GetDouble("DeltaRTrack", 0.2);
-  fTrackPTMin = GetDouble("TrackPTMin", 1.0);
-
-  // read efficiency formulas
-  param = GetParam("EfficiencyFormula");
-  size = param.GetSize();
-
-  fEfficiencyMap.clear();
-  for(i = 0; i < size / 2; ++i)
-  {
-    formula = new DelphesFormula;
-    formula->Compile(param[i * 2 + 1].GetString());
-
-    fEfficiencyMap[param[i * 2].GetInt()] = formula;
-  }
-
-  // set default efficiency formula
-  itEfficiencyMap = fEfficiencyMap.find(0);
-  if(itEfficiencyMap == fEfficiencyMap.end())
-  {
-    formula = new DelphesFormula;
-    formula->Compile("0.0");
-
-    fEfficiencyMap[0] = formula;
-  }
-
-  // import input array(s)
-
-  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles"));
-
-  fClassifier = new TrackCountingTauTaggingPartonClassifier(fParticleInputArray);
-  fClassifier->fPTMin = GetDouble("TauPTMin", 1.0);
-  fClassifier->fEtaMax = GetDouble("TauEtaMax", 2.5);
-
-  fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
-  fItPartonInputArray = fPartonInputArray->MakeIterator();
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  fFilter = new ExRootFilter(fPartonInputArray);
-
-  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
-  fItJetInputArray = fJetInputArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingTauTagging::Finish()
-{
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
-  DelphesFormula *formula;
-
-  if(fFilter) delete fFilter;
-  if(fClassifier) delete fClassifier;
-  if(fItJetInputArray) delete fItJetInputArray;
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  if(fItPartonInputArray) delete fItPartonInputArray;
-
-  for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
-  {
-    formula = itEfficiencyMap->second;
-    if(formula) delete formula;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCountingTauTagging::Process()
-{
-  Candidate *jet, *tau, *track, *daughter;
-  TLorentzVector tauMomentum;
-  Double_t pt, eta, phi, e;
-  TObjArray *tauArray;
-  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
-  DelphesFormula *formula;
-  Int_t pdgCode, charge, i, identifier;
-
-  // select taus
-  fFilter->Reset();
-  tauArray = fFilter->GetSubArray(fClassifier, 0);
-
-  if(tauArray == 0) return;
-
-  TIter itTauArray(tauArray);
-
-  // loop over all input jets
-  fItJetInputArray->Reset();
-  while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
-  {
-    identifier = 0;
-    const TLorentzVector &jetMomentum = jet->Momentum;
-    pdgCode = 0;
-    charge = 0;
-    eta = jetMomentum.Eta();
-    phi = jetMomentum.Phi();
-    pt = jetMomentum.Pt();
-    e = jetMomentum.E();
-
-    // loop over all input tracks
-    fItTrackInputArray->Reset();
-    while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
-    {
-      if((track->Momentum).Pt() < fTrackPTMin) continue;
-      if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack)
-      {
-        identifier -= 1;
-        charge += track->Charge;
-      }
-    }
-
-    // loop over all input taus
-    itTauArray.Reset();
-    bool matchedTau = false;
-    while((tau = static_cast<Candidate *>(itTauArray.Next())))
-    {
-      if(tau->D1 < 0) continue;
-
-      if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
-      {
-        throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
-      }
-
-      tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
-
-      for(i = tau->D1; i <= tau->D2; ++i)
-      {
-        daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
-        if(TMath::Abs(daughter->PID) == 16) continue;
-        tauMomentum += daughter->Momentum;
-      }
-
-      if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR)
-      {
-        matchedTau = true;
-        pdgCode = 15;
-      }
-    }
-    if(matchedTau)
-      identifier *= -1;
-    // find an efficency formula
-    // If the identifier is larger than 2, set it to 2 (multiprong requires at least 2 tracks)
-    if(identifier > 2)
-      identifier = 2;
-    else if(identifier < -2)
-      identifier = -2;
-
-    itEfficiencyMap = fEfficiencyMap.find(identifier);
-    if(itEfficiencyMap == fEfficiencyMap.end())
-    {
-      itEfficiencyMap = fEfficiencyMap.find(0);
-    }
-    formula = itEfficiencyMap->second;
-
-    // apply an efficency formula
-
-    // apply an efficency formula
-    jet->TauTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
-
-    // set tau charge
-    jet->Charge = charge;
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/TrackCountingTauTagging.h
===================================================================
--- modules/TrackCountingTauTagging.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,68 +1,0 @@
-#ifndef TrackCountingTauTagging_h
-#define TrackCountingTauTagging_h
-
-/** \class TrackCountingTauTagging
- *
- *  Determines origin of jet,
- *  applies b-tagging efficiency (miss identification rate) formulas
- *  and sets b-tagging flags 
- *
- *  $Date: 2013-02-22 01:01:36 +0100 (Fri, 22 Feb 2013) $
- *  $Revision: 926 $
- *
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-
-class TObjArray;
-class DelphesFormula;
-
-class ExRootFilter;
-class TrackCountingTauTaggingPartonClassifier;
-
-class TrackCountingTauTagging: public DelphesModule
-{
-public:
-  TrackCountingTauTagging();
-  ~TrackCountingTauTagging();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Int_t fBitNumber;
-
-  Double_t fDeltaR;
-  Double_t fDeltaRTrack;
-  Double_t fTrackPTMin;
-
-  std::map<Int_t, DelphesFormula *> fEfficiencyMap; //!
-
-  TrackCountingTauTaggingPartonClassifier *fClassifier; //!
-
-  ExRootFilter *fFilter;
-
-  TIterator *fItPartonInputArray; //!
-
-  TIterator *fItTrackInputArray; //!
-
-  TIterator *fItJetInputArray; //!
-
-  const TObjArray *fParticleInputArray; //!
-
-  const TObjArray *fTrackInputArray; //!
-
-  const TObjArray *fPartonInputArray; //!
-
-  const TObjArray *fJetInputArray; //!
-
-  ClassDef(TrackCountingTauTagging, 1)
-};
-
-#endif
Index: modules/TrackCovariance.cc
===================================================================
--- modules/TrackCovariance.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,194 +1,0 @@
-  /*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2020  Universite catholique de Louvain (UCLouvain), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class TrackCovariance
- *
- *  Smears track parameters according to appropriate covariance matrix.
- *
- *  \authors F. Bedeschi - INFN Pisa
-*            P. Demin - UCLouvain, Louvain-la-Neuve
- *           M. Selvaggi - CERN
- *
- *
- */
-
-//FIXME add reference to Bedeschi-code
-//FIXME make sure about units of P, X
-//FIXME fix pt > 200 GeV issue and angle > 6.41
-
-#include "modules/TrackCovariance.h"
-
-#include "classes/DelphesClasses.h"
-
-#include "TrackCovariance/SolGeom.h"
-#include "TrackCovariance/SolGridCov.h"
-#include "TrackCovariance/ObsTrk.h"
-
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-
-#include <iostream>
-#include <sstream>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-TrackCovariance::TrackCovariance() :
-  fGeometry(0), fCovariance(0), fAcx(0), fItInputArray(0)
-{
-  fGeometry = new SolGeom();
-  fCovariance = new SolGridCov();
-}
-
-//------------------------------------------------------------------------------
-
-TrackCovariance::~TrackCovariance()
-{
-  if(fGeometry) delete fGeometry;
-  if(fCovariance) delete fCovariance;
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCovariance::Init()
-{
-  fBz = GetDouble("Bz", 0.0);
-  fGeometry->Read(GetString("DetectorGeometry", ""));
-  fNMinHits = GetInt("NMinHits", 6);
-
-  // load geometry
-  fCovariance->Calc(fGeometry);
-  fCovariance->SetMinHits(fNMinHits);
-  // load geometry
-  fAcx = fCovariance->AccPnt();
-
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCovariance::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TrackCovariance::Process()
-{
-  Candidate *candidate, *mother, *particle;
-  Double_t mass, p, pt, q, ct;
-  Double_t dd0, ddz, dphi, dct, dp, dpt, dC;
-  //
-  // Get cylindrical box for fast track simulation
-  //
-  Double_t Rin = fGeometry->GetRmin();
-  Double_t ZinPos = fGeometry->GetZminPos();
-  Double_t ZinNeg = fGeometry->GetZminNeg();
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    // converting to meters
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-
-    // converting to meters
-    const TLorentzVector &candidatePosition = particle->Position*1e-03;
-    const TLorentzVector &candidateMomentum = particle->Momentum;
-
-
-    Bool_t inside = TrkUtil::IsInside(candidatePosition.Vect(), Rin, ZinNeg, ZinPos); // Check if in inner box
-    Bool_t Accept = kTRUE;
-    if(inside) Accept = fCovariance->IsAccepted(candidateMomentum.Vect());
-    else       Accept = fCovariance->IsAccepted(candidatePosition.Vect(),candidateMomentum.Vect(), fGeometry);
-    if(!Accept) continue;
-
-    mass = candidateMomentum.M();
-
-    ObsTrk track(candidatePosition.Vect(), candidateMomentum.Vect(), candidate->Charge, fCovariance, fGeometry);
-
-
-    mother    = candidate;
-    candidate = static_cast<Candidate*>(candidate->Clone());
-
-    candidate->Momentum.SetVectM(track.GetObsP(), mass);
-
-    // converting back to mm
-    candidate->InitialPosition.SetXYZT(track.GetObsX().X()*1e03,track.GetObsX().Y()*1e03,track.GetObsX().Z()*1e03,candidatePosition.T()*1e03);
-
-    // save full covariance 5x5 matrix internally (D0, phi, Curvature, dz, ctg(theta))
-    candidate->TrackCovariance = track.GetCov();
-
-    pt = candidate->Momentum.Pt();
-    p  = candidate->Momentum.P();
-    q  = track.GetObsQ();
-    ct = track.GetObsPar()[4];
-
-    candidate->Xd = track.GetObsX().X()*1e03;
-    candidate->Yd = track.GetObsX().Y()*1e03;
-    candidate->Zd = track.GetObsX().Z()*1e03;
-
-    candidate->XFirstHit = track.GetFirstHit().X()*1e03;
-    candidate->YFirstHit = track.GetFirstHit().Y()*1e03;
-    candidate->ZFirstHit = track.GetFirstHit().Z()*1e03;
-
-    candidate->D0       = track.GetObsPar()[0]*1e03;
-    candidate->Phi      = track.GetObsPar()[1];
-
-    // inverse of curvature
-    candidate->C        = track.GetObsPar()[2]*1e-03;
-    candidate->DZ       = track.GetObsPar()[3]*1e03;
-    candidate->CtgTheta = track.GetObsPar()[4];
-    candidate->P        = track.GetObsP().Mag();
-    candidate->PT       = pt;
-    candidate->Charge   = q;
-
-    dd0       = TMath::Sqrt(track.GetCov()(0, 0))*1e03;
-    ddz       = TMath::Sqrt(track.GetCov()(3, 3))*1e03;
-    dphi      = TMath::Sqrt(track.GetCov()(1, 1));
-    dct       = TMath::Sqrt(track.GetCov()(4, 4));
-    dpt       = 2 * TMath::Sqrt( track.GetCov()(2, 2))*pt*pt / (0.2998*fBz);
-    dp        = TMath::Sqrt((1.+ct*ct)*dpt*dpt + 4*pt*pt*ct*ct*dct*dct/(1.+ct*ct)/(1.+ct*ct));
-    dC        = TMath::Sqrt(track.GetCov()(2, 2))*1e-03;
-
-    candidate->ErrorD0 = dd0;
-    candidate->ErrorDZ = ddz;
-    candidate->ErrorP = dp;
-    candidate->ErrorC = dC;
-    candidate->ErrorCtgTheta = dct;
-    candidate->ErrorPhi = dphi;
-    candidate->ErrorPT = dpt;
-    //candidate->TrackResolution = dpt / pt;
-    candidate->TrackResolution = dp / p;
-
-    candidate->AddCandidate(mother);
-
-    fOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/TrackCovariance.h
===================================================================
--- modules/TrackCovariance.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2020  Universite catholique de Louvain (UCLouvain), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TrackCovariance_h
-#define TrackCovariance_h
-
-/** \class TrackCovariance
- *
- *  Smears track parameters according to appropriate covariance matrix.
- *
- *  \authors P. Demin - UCLouvain, Louvain-la-Neuve
- *           M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-
-class SolGeom;
-class SolGridCov;
-class AcceptanceClx;
-
-class TrackCovariance: public DelphesModule
-{
-public:
-  TrackCovariance();
-  ~TrackCovariance();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t fBz;
-  Int_t fNMinHits;
-
-  SolGeom *fGeometry;
-  SolGridCov *fCovariance;
-
-  AcceptanceClx *fAcx;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(TrackCovariance, 1)
-};
-
-#endif
Index: modules/TrackPileUpSubtractor.cc
===================================================================
--- modules/TrackPileUpSubtractor.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TrackPileUpSubtractor.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class TrackPileUpSubtractor
  *
  *  Subtract pile-up contribution from tracks.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -52,8 +39,6 @@
 //------------------------------------------------------------------------------
 
-TrackPileUpSubtractor::TrackPileUpSubtractor() :
-  fFormula(0)
+TrackPileUpSubtractor::TrackPileUpSubtractor()
 {
-  fFormula = new DelphesFormula;
 }
 
@@ -62,5 +47,4 @@
 TrackPileUpSubtractor::~TrackPileUpSubtractor()
 {
-  if(fFormula) delete fFormula;
 }
 
@@ -69,13 +53,5 @@
 void TrackPileUpSubtractor::Init()
 {
-  // import input array
-
-  fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
-  fItVertexInputArray = fVertexInputArray->MakeIterator();
-
-  // read resolution formula in m
-  fFormula->Compile(GetString("ZVertexResolution", "0.001"));
-
-  fPTMin = GetDouble("PTMin", 0.);
+  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
 
   // import arrays with output from other modules
@@ -87,10 +63,10 @@
 
   size = param.GetSize();
-  for(i = 0; i < size / 2; ++i)
+  for(i = 0; i < size/2; ++i)
   {
-    array = ImportArray(param[i * 2].GetString());
+    array = ImportArray(param[i*2].GetString());
     iterator = array->MakeIterator();
 
-    fInputMap[iterator] = ExportArray(param[i * 2 + 1].GetString());
+    fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());;
   }
 }
@@ -100,5 +76,5 @@
 void TrackPileUpSubtractor::Finish()
 {
-  map<TIterator *, TObjArray *>::iterator itInputMap;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
   TIterator *iterator;
 
@@ -109,6 +85,4 @@
     if(iterator) delete iterator;
   }
-
-  if(fItVertexInputArray) delete fItVertexInputArray;
 }
 
@@ -118,21 +92,8 @@
 {
   Candidate *candidate, *particle;
-  map<TIterator *, TObjArray *>::iterator itInputMap;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
   TIterator *iterator;
   TObjArray *array;
-  Double_t z, zvtx = 0;
-  Double_t pt, eta, phi, e;
-
-  // find z position of primary vertex
-
-  fItVertexInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItVertexInputArray->Next())))
-  {
-    if(!candidate->IsPU)
-    {
-      zvtx = candidate->Position.Z();
-      // break;
-    }
-  }
+  Double_t z;
 
   // loop over all input arrays
@@ -144,29 +105,17 @@
     // loop over all candidates
     iterator->Reset();
-    while((candidate = static_cast<Candidate *>(iterator->Next())))
+    while((candidate = static_cast<Candidate*>(iterator->Next())))
     {
-      particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-      const TLorentzVector &candidateMomentum = particle->Momentum;
-
-      eta = candidateMomentum.Eta();
-      pt = candidateMomentum.Pt();
-      phi = candidateMomentum.Phi();
-      e = candidateMomentum.E();
-
+      particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
       z = particle->Position.Z();
 
       // apply pile-up subtraction
       // assume perfect pile-up subtraction for tracks outside fZVertexResolution
+      if(candidate->IsPU && TMath::Abs(z) > fZVertexResolution) continue;
 
-      if(candidate->Charge != 0 && candidate->IsPU && TMath::Abs(z - zvtx) > fFormula->Eval(pt, eta, phi, e) * 1.0e3)
-      {
-        candidate->IsRecoPU = 1;
-      }
-      else
-      {
-        candidate->IsRecoPU = 0;
-        if(candidate->Momentum.Pt() > fPTMin) array->Add(candidate);
-      }
+      array->Add(candidate);
     }
   }
 }
+
+//------------------------------------------------------------------------------
Index: modules/TrackPileUpSubtractor.h
===================================================================
--- modules/TrackPileUpSubtractor.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TrackPileUpSubtractor.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef TrackPileUpSubtractor_h
 #define TrackPileUpSubtractor_h
@@ -23,4 +5,8 @@
  *
  *  Subtract pile-up contribution from tracks.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -34,9 +20,9 @@
 class TIterator;
 class TObjArray;
-class DelphesFormula;
 
 class TrackPileUpSubtractor: public DelphesModule
 {
 public:
+
   TrackPileUpSubtractor();
   ~TrackPileUpSubtractor();
@@ -47,15 +33,10 @@
 
 private:
-  DelphesFormula *fFormula; //!
 
-  Double_t fPTMin;
+  Double_t fZVertexResolution;
 
-  std::map<TIterator *, TObjArray *> fInputMap; //!
+  std::map< TIterator *, TObjArray * > fInputMap; //!
 
   ClassDef(TrackPileUpSubtractor, 1)
-
-    TIterator *fItVertexInputArray; //!
-
-  const TObjArray *fVertexInputArray; //!
 };
 
Index: modules/TrackSmearing.cc
===================================================================
--- modules/TrackSmearing.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,413 +1,0 @@
-/** \class TrackSmearing
- *
- *  Performs d0, dZ, p, Theta, Phi smearing of tracks.
- *
- *  \authors A. Hart, M. Selvaggi
- *
-*/
-
-#include "modules/TrackSmearing.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFile.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TProfile2D.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-TrackSmearing::TrackSmearing() :
-  fD0Formula(0), fDZFormula(0), fPFormula(0), fCtgThetaFormula(0), fPhiFormula(0), fItInputArray(0)
-{
-  fD0Formula = new DelphesFormula;
-  fDZFormula = new DelphesFormula;
-  fPFormula = new DelphesFormula;
-  fCtgThetaFormula = new DelphesFormula;
-  fPhiFormula = new DelphesFormula;
-}
-
-//------------------------------------------------------------------------------
-
-TrackSmearing::~TrackSmearing()
-{
-  if(fD0Formula) delete fD0Formula;
-  if(fDZFormula) delete fDZFormula;
-  if(fPFormula) delete fPFormula;
-  if(fCtgThetaFormula) delete fCtgThetaFormula;
-  if(fPhiFormula) delete fPhiFormula;
-}
-
-//------------------------------------------------------------------------------
-
-void TrackSmearing::Init()
-{
-  fBz = GetDouble("Bz", 0.0);
-
-  // read resolution formula
-
-  // !!! IF WE WANT TO KEEP ROOT INPUT !!!
-  if(string(GetString("D0ResolutionFormula", "0.0")) != "0.0")
-  {
-    fD0Formula->Compile(GetString("D0ResolutionFormula", "0.0"));
-    fUseD0Formula = true;
-  }
-  else
-  {
-    fD0ResolutionFile = GetString("D0ResolutionFile", "errors.root");
-    fD0ResolutionHist = GetString("D0ResolutionHist", "d0");
-    fUseD0Formula = false;
-  }
-  if(string(GetString("DZResolutionFormula", "0.0")) != "0.0")
-  {
-    fDZFormula->Compile(GetString("DZResolutionFormula", "0.0"));
-    fUseDZFormula = true;
-  }
-  else
-  {
-    fDZResolutionFile = GetString("DZResolutionFile", "errors.root");
-    fDZResolutionHist = GetString("DZResolutionHist", "dz");
-    fUseDZFormula = false;
-  }
-  if(string(GetString("PResolutionFormula", "0.0")) != "0.0")
-  {
-    fPFormula->Compile(GetString("PResolutionFormula", "0.0"));
-    fUsePFormula = true;
-  }
-  else
-  {
-    fPResolutionFile = GetString("PResolutionFile", "errors.root");
-    fPResolutionHist = GetString("PResolutionHist", "p");
-    fUsePFormula = false;
-  }
-  if(string(GetString("CtgThetaResolutionFormula", "0.0")) != "0.0")
-  {
-    fCtgThetaFormula->Compile(GetString("CtgThetaResolutionFormula", "0.0"));
-    fUseCtgThetaFormula = true;
-  }
-  else
-  {
-    fCtgThetaResolutionFile = GetString("CtgThetaResolutionFile", "errors.root");
-    fCtgThetaResolutionHist = GetString("CtgThetaResolutionHist", "ctgTheta");
-    fUseCtgThetaFormula = false;
-  }
-  if(string(GetString("PhiResolutionFormula", "0.0")) != "0.0")
-  {
-    fPhiFormula->Compile(GetString("PhiResolutionFormula", "0.0"));
-    fUsePhiFormula = true;
-  }
-  else
-  {
-    fPhiResolutionFile = GetString("PhiResolutionFile", "errors.root");
-    fPhiResolutionHist = GetString("PhiResolutionHist", "phi");
-    fUsePhiFormula = false;
-  }
-
-  fApplyToPileUp = GetBool("ApplyToPileUp", true);
-
-  // import input array
-
-  fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // import beamspot
-  try
-  {
-    fBeamSpotInputArray = ImportArray(GetString("BeamSpotInputArray", "BeamSpotFilter/beamSpotParticle"));
-  }
-  catch(runtime_error &e)
-  {
-    fBeamSpotInputArray = 0;
-  }
-
-  // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
-}
-
-//------------------------------------------------------------------------------
-
-void TrackSmearing::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TrackSmearing::Process()
-{
-  Int_t iCandidate = 0;
-  TLorentzVector beamSpotPosition;
-  Candidate *candidate, *mother;
-  Double_t pt, eta, e, m, d0, d0Error, trueD0, dz, dzError, trueDZ, p, pError, trueP, ctgTheta, ctgThetaError, trueCtgTheta, phi, phiError, truePhi;
-  Double_t x, y, z, t, px, py, pz, theta;
-  Double_t q, r;
-  Double_t x_c, y_c, r_c, phi_0;
-  Double_t rcu, rc2, xd, yd, zd;
-  const Double_t c_light = 2.99792458E8;
-  TProfile2D *d0ErrorHist = NULL,
-             *dzErrorHist = NULL,
-             *pErrorHist = NULL,
-             *ctgThetaErrorHist = NULL,
-             *phiErrorHist = NULL;
-
-  if(!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0)
-    beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
-  else
-  {
-    Candidate &beamSpotCandidate = *((Candidate *)fBeamSpotInputArray->At(0));
-    beamSpotPosition = beamSpotCandidate.Position;
-  }
-
-  if(!fUseD0Formula)
-  {
-    TFile *fin = TFile::Open(fD0ResolutionFile.c_str());
-    d0ErrorHist = (TProfile2D *)fin->Get(fD0ResolutionHist.c_str());
-    d0ErrorHist->SetDirectory(0);
-    fin->Close();
-  }
-  if(!fUseDZFormula)
-  {
-    TFile *fin = TFile::Open(fDZResolutionFile.c_str());
-    dzErrorHist = (TProfile2D *)fin->Get(fDZResolutionHist.c_str());
-    dzErrorHist->SetDirectory(0);
-    fin->Close();
-  }
-  if(!fUsePFormula)
-  {
-    TFile *fin = TFile::Open(fPResolutionFile.c_str());
-    pErrorHist = (TProfile2D *)fin->Get(fPResolutionHist.c_str());
-    pErrorHist->SetDirectory(0);
-    fin->Close();
-  }
-  if(!fUseCtgThetaFormula)
-  {
-    TFile *fin = TFile::Open(fCtgThetaResolutionFile.c_str());
-    ctgThetaErrorHist = (TProfile2D *)fin->Get(fCtgThetaResolutionHist.c_str());
-    ctgThetaErrorHist->SetDirectory(0);
-    fin->Close();
-  }
-  if(!fUsePhiFormula)
-  {
-    TFile *fin = TFile::Open(fPhiResolutionFile.c_str());
-    phiErrorHist = (TProfile2D *)fin->Get(fPhiResolutionHist.c_str());
-    phiErrorHist->SetDirectory(0);
-    fin->Close();
-  }
-
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->InitialPosition;
-
-    pt = momentum.Pt();
-    eta = momentum.Eta();
-    e = momentum.E();
-    m = momentum.M();
-
-    d0 = trueD0 = candidate->D0;
-    dz = trueDZ = candidate->DZ;
-
-    p = trueP = candidate->P;
-    ctgTheta = trueCtgTheta = candidate->CtgTheta;
-    phi = truePhi = candidate->Phi;
-
-    if(fUseD0Formula)
-      d0Error = fD0Formula->Eval(pt, eta, phi, e, candidate);
-    else
-    {
-      Int_t xbin, ybin;
-
-      xbin = pt < d0ErrorHist->GetXaxis()->GetXmax() ? d0ErrorHist->GetXaxis()->FindBin(pt) : d0ErrorHist->GetXaxis()->GetBinCenter(d0ErrorHist->GetXaxis()->GetNbins());
-      ybin = d0ErrorHist->GetYaxis()->FindBin(TMath::Abs(eta));
-      d0Error = d0ErrorHist->GetBinContent(xbin, ybin);
-      if(!d0Error)
-        d0Error = -1.0;
-    }
-    if(d0Error < 0.0)
-      continue;
-
-    if(fUseDZFormula)
-      dzError = fDZFormula->Eval(pt, eta, phi, e, candidate);
-    else
-    {
-      Int_t xbin, ybin;
-
-      xbin = pt < dzErrorHist->GetXaxis()->GetXmax() ? dzErrorHist->GetXaxis()->FindBin(pt) : dzErrorHist->GetXaxis()->GetBinCenter(dzErrorHist->GetXaxis()->GetNbins());
-      ybin = dzErrorHist->GetYaxis()->FindBin(TMath::Abs(eta));
-      dzError = dzErrorHist->GetBinContent(xbin, ybin);
-      if(!dzError)
-        dzError = -1.0;
-    }
-    if(dzError < 0.0)
-      continue;
-
-    if(fUsePFormula)
-      pError = fPFormula->Eval(pt, eta, phi, e, candidate) * p;
-    else
-    {
-      Int_t xbin, ybin;
-
-      xbin = pt < pErrorHist->GetXaxis()->GetXmax() ? pErrorHist->GetXaxis()->FindBin(pt) : pErrorHist->GetXaxis()->GetBinCenter(pErrorHist->GetXaxis()->GetNbins());
-      ybin = pErrorHist->GetYaxis()->FindBin(TMath::Abs(eta));
-      pError = pErrorHist->GetBinContent(xbin, ybin) * p;
-      if(!pError)
-        pError = -1.0;
-    }
-    if(pError < 0.0)
-      continue;
-
-    if(fUseCtgThetaFormula)
-      ctgThetaError = fCtgThetaFormula->Eval(pt, eta, phi, e, candidate);
-    else
-    {
-      Int_t xbin, ybin;
-
-      xbin = pt < ctgThetaErrorHist->GetXaxis()->GetXmax() ? ctgThetaErrorHist->GetXaxis()->FindBin(pt) : ctgThetaErrorHist->GetXaxis()->GetBinCenter(ctgThetaErrorHist->GetXaxis()->GetNbins());
-      ybin = ctgThetaErrorHist->GetYaxis()->FindBin(TMath::Abs(eta));
-      ctgThetaError = ctgThetaErrorHist->GetBinContent(xbin, ybin);
-      if(!ctgThetaError)
-        ctgThetaError = -1.0;
-    }
-    if(ctgThetaError < 0.0)
-      continue;
-
-    if(fUsePhiFormula)
-      phiError = fPhiFormula->Eval(pt, eta, phi, e, candidate);
-    else
-    {
-      Int_t xbin, ybin;
-
-      xbin = pt < phiErrorHist->GetXaxis()->GetXmax() ? phiErrorHist->GetXaxis()->FindBin(pt) : phiErrorHist->GetXaxis()->GetBinCenter(phiErrorHist->GetXaxis()->GetNbins());
-      ybin = phiErrorHist->GetYaxis()->FindBin(TMath::Abs(eta));
-      phiError = phiErrorHist->GetBinContent(xbin, ybin);
-      if(!phiError)
-        phiError = -1.0;
-    }
-    if(phiError < 0.0)
-      continue;
-
-    if(fApplyToPileUp || !candidate->IsPU)
-    {
-      d0 = gRandom->Gaus(d0, d0Error);
-      dz = gRandom->Gaus(dz, dzError);
-      p = gRandom->Gaus(p, pError);
-      ctgTheta = gRandom->Gaus(ctgTheta, ctgThetaError);
-      phi = gRandom->Gaus(phi, phiError);
-    }
-
-    if(p < 0.0) continue;
-    while(phi > TMath::Pi()) phi -= TMath::TwoPi();
-    while(phi <= -TMath::Pi()) phi += TMath::TwoPi();
-
-    mother = candidate;
-    candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->D0 = d0;
-    candidate->DZ = dz;
-    candidate->P = p;
-    candidate->CtgTheta = ctgTheta;
-    candidate->Phi = phi;
-
-    theta = TMath::ACos(ctgTheta / TMath::Sqrt(1.0 + ctgTheta * ctgTheta));
-    candidate->Momentum.SetPx(p * TMath::Cos(phi) * TMath::Sin(theta));
-    candidate->Momentum.SetPy(p * TMath::Sin(phi) * TMath::Sin(theta));
-    candidate->Momentum.SetPz(p * TMath::Cos(theta));
-    candidate->Momentum.SetE(TMath::Sqrt(p*p + m*m));
-    candidate->PT = candidate->Momentum.Pt();
-
-    x = position.X();
-    y = position.Y();
-    z = position.Z();
-    t = position.T();
-    px = candidate->Momentum.Px();
-    py = candidate->Momentum.Py();
-    pz = candidate->Momentum.Pz();
-    pt = candidate->Momentum.Pt();
-
-    // -- solve for delta: d0' = ( (x+delta)*py' - (y+delta)*px' )/pt'
-
-    candidate->InitialPosition.SetX(x + ((px * y - py * x + d0 * pt) / (py - px)));
-    candidate->InitialPosition.SetY(y + ((px * y - py * x + d0 * pt) / (py - px)));
-    x = candidate->InitialPosition.X();
-    y = candidate->InitialPosition.Y();
-    candidate->InitialPosition.SetZ(z + ((pz * (px * (x - beamSpotPosition.X()) + py * (y - beamSpotPosition.Y())) + pt * pt * (dz - z)) / (pt * pt)));
-    z = candidate->InitialPosition.Z();
-
-    candidate->InitialPosition.SetT(t);
-
-    // update closest approach
-    x *= 1.0E-3;
-    y *= 1.0E-3;
-    z *= 1.0E-3;
-
-    q = candidate->Charge;
-
-    r = pt / (q * fBz) * 1.0E9 / c_light; // in [m]
-    phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi]
-
-    // 2. helix axis coordinates
-    x_c = x + r * TMath::Sin(phi_0);
-    y_c = y - r * TMath::Cos(phi_0);
-    r_c = TMath::Hypot(x_c, y_c);
-
-    rcu = TMath::Abs(r);
-    rc2 = r_c * r_c;
-
-    // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd
-    xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c * y_c;
-    xd = (rc2 > 0.0) ? xd / rc2 : -999;
-    yd = y_c * (-rcu * r_c + rc2);
-    yd = (rc2 > 0.0) ? yd / rc2 : -999;
-    zd = z + (TMath::Sqrt(xd * xd + yd * yd) - TMath::Sqrt(x * x + y * y)) * pz / pt;
-
-    candidate->Xd = xd * 1.0E3;
-    candidate->Yd = yd * 1.0E3;
-    candidate->Zd = zd * 1.0E3;
-
-    if(fApplyToPileUp || !candidate->IsPU)
-    {
-      candidate->ErrorD0 = d0Error;
-      candidate->ErrorDZ = dzError;
-      candidate->ErrorP = pError;
-      candidate->ErrorCtgTheta = ctgThetaError;
-      candidate->ErrorPhi = phiError;
-      candidate->ErrorPT = ptError(p, ctgTheta, pError, ctgThetaError);
-      candidate->TrackResolution = pError / p;
-    }
-
-    candidate->AddCandidate(mother);
-    fOutputArray->Add(candidate);
-
-    iCandidate++;
-  }
-}
-
-Double_t TrackSmearing::ptError(const Double_t p, const Double_t ctgTheta, const Double_t dP, const Double_t dCtgTheta)
-{
-  Double_t a, b;
-  a = (p * p * ctgTheta * ctgTheta * dCtgTheta * dCtgTheta) / ((ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1));
-  b = (dP * dP) / (ctgTheta * ctgTheta + 1);
-  return sqrt(a + b);
-}
-
-//------------------------------------------------------------------------------
Index: modules/TrackSmearing.h
===================================================================
--- modules/TrackSmearing.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#ifndef TrackSmearing_h
-#define TrackSmearing_h
-
-/** \class TrackSmearing
- *
- *  Performs d0, dZ, p, Theta, Phi smearing of tracks.
- *
- *
- *
- *  \author A. Hart, M. Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TIterator;
-class TObjArray;
-class DelphesFormula;
-
-class TrackSmearing: public DelphesModule
-{
-public:
-  TrackSmearing();
-  ~TrackSmearing();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  Double_t ptError(const Double_t, const Double_t, const Double_t, const Double_t);
-
-  Double_t fBz;
-
-  DelphesFormula *fD0Formula; //!
-  std::string fD0ResolutionFile;
-  std::string fD0ResolutionHist;
-  Bool_t fUseD0Formula;
-
-  DelphesFormula *fDZFormula; //!
-  std::string fDZResolutionFile;
-  std::string fDZResolutionHist;
-  Bool_t fUseDZFormula;
-
-  DelphesFormula *fPFormula; //!
-  std::string fPResolutionFile;
-  std::string fPResolutionHist;
-  Bool_t fUsePFormula;
-
-  DelphesFormula *fCtgThetaFormula; //!
-  std::string fCtgThetaResolutionFile;
-  std::string fCtgThetaResolutionHist;
-  Bool_t fUseCtgThetaFormula;
-
-  DelphesFormula *fPhiFormula; //!
-  std::string fPhiResolutionFile;
-  std::string fPhiResolutionHist;
-  Bool_t fUsePhiFormula;
-
-  Bool_t fApplyToPileUp;
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-  const TObjArray *fBeamSpotInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(TrackSmearing, 1)
-};
-
-#endif
Index: modules/TreeWriter.cc
===================================================================
--- modules/TreeWriter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TreeWriter.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,19 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class TreeWriter
@@ -21,4 +4,8 @@
  *  Fills ROOT tree branches.
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -31,23 +18,22 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 #include "ExRootAnalysis/ExRootTreeBranch.h"
 
+#include "TROOT.h"
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TROOT.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <set>
+
 #include <algorithm>
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -70,21 +56,15 @@
 {
   fClassMap[GenParticle::Class()] = &TreeWriter::ProcessParticles;
-  fClassMap[Vertex::Class()] = &TreeWriter::ProcessVertices;
   fClassMap[Track::Class()] = &TreeWriter::ProcessTracks;
   fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers;
-  fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates;
   fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons;
   fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
   fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons;
-  fClassMap[CscCluster::Class()] = &TreeWriter::ProcessCscCluster;
   fClassMap[Jet::Class()] = &TreeWriter::ProcessJets;
   fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET;
   fClassMap[ScalarHT::Class()] = &TreeWriter::ProcessScalarHT;
-  fClassMap[Rho::Class()] = &TreeWriter::ProcessRho;
-  fClassMap[Weight::Class()] = &TreeWriter::ProcessWeight;
-  fClassMap[HectorHit::Class()] = &TreeWriter::ProcessHectorHit;
 
   TBranchMap::iterator itBranchMap;
-  map<TClass *, TProcessMethod>::iterator itClassMap;
+  map< TClass *, TProcessMethod >::iterator itClassMap;
 
   // read branch configuration and
@@ -99,9 +79,9 @@
 
   size = param.GetSize();
-  for(i = 0; i < size / 3; ++i)
-  {
-    branchInputArray = param[i * 3].GetString();
-    branchName = param[i * 3 + 1].GetString();
-    branchClassName = param[i * 3 + 2].GetString();
+  for(i = 0; i < size/3; ++i)
+  {
+    branchInputArray = param[i*3].GetString();
+    branchName = param[i*3 + 1].GetString();
+    branchClassName = param[i*3 + 2].GetString();
 
     branchClass = gROOT->GetClass(branchClassName);
@@ -126,16 +106,4 @@
   }
 
-  param = GetParam("Info");
-  TString infoName;
-  Double_t infoValue;
-
-  size = param.GetSize();
-  for(i = 0; i < size / 2; ++i)
-  {
-    infoName = param[i * 2].GetString();
-    infoValue = param[i * 2 + 1].GetDouble();
-
-    AddInfo(infoName, infoValue);
-  }
 }
 
@@ -144,4 +112,5 @@
 void TreeWriter::Finish()
 {
+
 }
 
@@ -151,11 +120,7 @@
 {
   TIter it1(candidate->GetCandidates());
-  set<Candidate *> s;
-  set<Candidate *>::iterator it3;
   it1.Reset();
-  s.clear();
   array->Clear();
-
-  while((candidate = static_cast<Candidate *>(it1.Next())))
+  while((candidate = static_cast<Candidate*>(it1.Next())))
   {
     TIter it2(candidate->GetCandidates());
@@ -164,13 +129,13 @@
     if(candidate->GetCandidates()->GetEntriesFast() == 0)
     {
-      s.insert(candidate);
+      array->Add(candidate);
       continue;
     }
 
     // track
-    candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
+    candidate = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
     if(candidate->GetCandidates()->GetEntriesFast() == 0)
     {
-      s.insert(candidate);
+      array->Add(candidate);
       continue;
     }
@@ -178,17 +143,8 @@
     // tower
     it2.Reset();
-    while((candidate = static_cast<Candidate *>(it2.Next())))
+    while((candidate = static_cast<Candidate*>(it2.Next())))
     {
-      candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-      if(candidate->GetCandidates()->GetEntriesFast() == 0)
-      {
-        s.insert(candidate);
-      }
+      array->Add(candidate->GetCandidates()->At(0));
     }
-  }
-
-  for(it3 = s.begin(); it3 != s.end(); ++it3)
-  {
-    array->Add(*it3);
   }
 }
@@ -203,14 +159,12 @@
   Double_t pt, signPz, cosTheta, eta, rapidity;
 
-  const Double_t c_light = 2.99792458E8;
-
   // loop over all particles
   iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
   {
     const TLorentzVector &momentum = candidate->Momentum;
     const TLorentzVector &position = candidate->Position;
 
-    entry = static_cast<GenParticle *>(branch->NewEntry());
+    entry = static_cast<GenParticle*>(branch->NewEntry());
 
     entry->SetBit(kIsReferenced);
@@ -220,6 +174,6 @@
     cosTheta = TMath::Abs(momentum.CosTheta());
     signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
 
     entry->PID = candidate->PID;
@@ -251,77 +205,5 @@
     entry->Y = position.Y();
     entry->Z = position.Z();
-    entry->T = position.T() * 1.0E-3 / c_light;
-
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessVertices(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0, *constituent = 0;
-  Vertex *entry = 0;
-
-  const Double_t c_light = 2.99792458E8;
-
-  Double_t x, y, z, t, xError, yError, zError, tError, sigma, sumPT2, btvSumPT2, genDeltaZ, genSumPT2;
-  UInt_t index, ndf;
-
-  CompBase *compare = Candidate::fgCompare;
-  Candidate::fgCompare = CompSumPT2<Candidate>::Instance();
-  array->Sort();
-  Candidate::fgCompare = compare;
-
-  // loop over all vertices
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-
-    index = candidate->ClusterIndex;
-    ndf = candidate->ClusterNDF;
-    sigma = candidate->ClusterSigma;
-    sumPT2 = candidate->SumPT2;
-    btvSumPT2 = candidate->BTVSumPT2;
-    genDeltaZ = candidate->GenDeltaZ;
-    genSumPT2 = candidate->GenSumPT2;
-
-    x = candidate->Position.X();
-    y = candidate->Position.Y();
-    z = candidate->Position.Z();
-    t = candidate->Position.T() * 1.0E-3 / c_light;
-
-    xError = candidate->PositionError.X();
-    yError = candidate->PositionError.Y();
-    zError = candidate->PositionError.Z();
-    tError = candidate->PositionError.T() * 1.0E-3 / c_light;
-
-    entry = static_cast<Vertex *>(branch->NewEntry());
-
-    entry->Index = index;
-    entry->NDF = ndf;
-    entry->Sigma = sigma;
-    entry->SumPT2 = sumPT2;
-    entry->BTVSumPT2 = btvSumPT2;
-    entry->GenDeltaZ = genDeltaZ;
-    entry->GenSumPT2 = genSumPT2;
-
-    entry->X = x;
-    entry->Y = y;
-    entry->Z = z;
-    entry->T = t;
-
-    entry->ErrorX = xError;
-    entry->ErrorY = yError;
-    entry->ErrorZ = zError;
-    entry->ErrorT = tError;
-
-    TIter itConstituents(candidate->GetCandidates());
-    itConstituents.Reset();
-    entry->Constituents.Clear();
-    while((constituent = static_cast<Candidate *>(itConstituents.Next())))
-    {
-      entry->Constituents.Add(constituent);
-    }
+    entry->T = position.T();
   }
 }
@@ -335,10 +217,9 @@
   Candidate *particle = 0;
   Track *entry = 0;
-  Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m;
-  const Double_t c_light = 2.99792458E8;
-
-  // loop over all tracks
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
+  Double_t pt, signz, cosTheta, eta, rapidity;
+
+  // loop over all jets
+  iterator.Reset();
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
   {
     const TLorentzVector &position = candidate->Position;
@@ -346,8 +227,8 @@
     cosTheta = TMath::Abs(position.CosTheta());
     signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
-    rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
-
-    entry = static_cast<Track *>(branch->NewEntry());
+    eta = (cosTheta == 1.0 ? signz*999.9 : position.Eta());
+    rapidity = (cosTheta == 1.0 ? signz*999.9 : position.Rapidity());
+
+    entry = static_cast<Track*>(branch->NewEntry());
 
     entry->SetBit(kIsReferenced);
@@ -364,77 +245,25 @@
     entry->YOuter = position.Y();
     entry->ZOuter = position.Z();
-    entry->TOuter = position.T() * 1.0E-3 / c_light;
-
-    entry->L = candidate->L;
-
-    entry->D0 = candidate->D0;
-    entry->DZ = candidate->DZ;
-    entry->Nclusters = candidate->Nclusters;
-    entry->dNdx = candidate->dNdx;
-
-    entry->ErrorP = candidate->ErrorP;
-    entry->ErrorPT = candidate->ErrorPT;
-
-    // diagonal covariance matrix terms
-    entry->ErrorD0 = candidate->ErrorD0;
-    entry->ErrorC = candidate->ErrorC;
-    entry->ErrorPhi = candidate->ErrorPhi;
-    entry->ErrorDZ = candidate->ErrorDZ;
-    entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
-
-    // add some offdiagonal covariance matrix elements
-    entry->ErrorD0Phi          = candidate->TrackCovariance(0,1)*1.e3;
-    entry->ErrorD0C            = candidate->TrackCovariance(0,2);
-    entry->ErrorD0DZ           = candidate->TrackCovariance(0,3)*1.e6;
-    entry->ErrorD0CtgTheta     = candidate->TrackCovariance(0,4)*1.e3;
-    entry->ErrorPhiC           = candidate->TrackCovariance(1,2)*1.e-3;
-    entry->ErrorPhiDZ          = candidate->TrackCovariance(1,3)*1.e3;
-    entry->ErrorPhiCtgTheta    = candidate->TrackCovariance(1,4);
-    entry->ErrorCDZ            = candidate->TrackCovariance(2,3);
-    entry->ErrorCCtgTheta      = candidate->TrackCovariance(2,4)*1.e-3;
-    entry->ErrorDZCtgTheta     = candidate->TrackCovariance(3,4)*1.e3;
-
-    entry->Xd = candidate->Xd;
-    entry->Yd = candidate->Yd;
-    entry->Zd = candidate->Zd;
-
-    entry->XFirstHit = candidate->XFirstHit;
-    entry->YFirstHit = candidate->YFirstHit;
-    entry->ZFirstHit = candidate->ZFirstHit;
-
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    pt = momentum.Pt();
-    p = momentum.P();
-    phi = momentum.Phi();
-    m = momentum.M();
-    ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
-
+
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    pt = momentum.Pt();
     cosTheta = TMath::Abs(momentum.CosTheta());
     signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signz * 999.9 : momentum.Rapidity());
-
-    entry->P = p;
+    eta = (cosTheta == 1.0 ? signz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signz*999.9 : momentum.Rapidity());
+
+    entry->Eta = eta;
+    entry->Phi = momentum.Phi();
     entry->PT = pt;
-    entry->Eta = eta;
-    entry->Phi = phi;
-    entry->CtgTheta = ctgTheta;
-    entry->C = candidate->C;
-    entry->Mass = m;
-
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-    //const TLorentzVector &initialPosition = particle->Position;
-    const TLorentzVector &initialPosition = candidate->InitialPosition;
+
+    particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
+    const TLorentzVector &initialPosition = particle->Position;
 
     entry->X = initialPosition.X();
     entry->Y = initialPosition.Y();
     entry->Z = initialPosition.Z();
-    entry->T = initialPosition.T() * 1.0E-3 / c_light;
-    entry->ErrorT =candidate-> ErrorT * 1.0E-3 / c_light;
 
     entry->Particle = particle;
-
-    entry->VertexIndex = candidate->ClusterIndex;
   }
 }
@@ -448,20 +277,18 @@
   Tower *entry = 0;
   Double_t pt, signPz, cosTheta, eta, rapidity;
-  const Double_t c_light = 2.99792458E8;
-
-  // loop over all towers
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->Position;
+
+  // loop over all jets
+  iterator.Reset();
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
 
     pt = momentum.Pt();
     cosTheta = TMath::Abs(momentum.CosTheta());
     signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
-
-    entry = static_cast<Tower *>(branch->NewEntry());
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
+
+    entry = static_cast<Tower*>(branch->NewEntry());
 
     entry->SetBit(kIsReferenced);
@@ -474,5 +301,4 @@
     entry->Eem = candidate->Eem;
     entry->Ehad = candidate->Ehad;
-    entry->Etrk = candidate->Etrk;
     entry->Edges[0] = candidate->Edges[0];
     entry->Edges[1] = candidate->Edges[1];
@@ -480,7 +306,4 @@
     entry->Edges[3] = candidate->Edges[3];
 
-    entry->T = position.T() * 1.0E-3 / c_light;
-    entry->NTimeHits = candidate->NTimeHits;
-
     FillParticles(candidate, &entry->Particles);
   }
@@ -489,286 +312,107 @@
 //------------------------------------------------------------------------------
 
-void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
-{
-
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  Candidate *particle = 0;
-  ParticleFlowCandidate *entry = 0;
-  Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m;
-  const Double_t c_light = 2.99792458E8;
-
-  // loop over all tracks
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &position = candidate->Position;
-
-    cosTheta = TMath::Abs(position.CosTheta());
-    signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
-    rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
-
-    entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
+void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
+{
+  TIter iterator(array);
+  Candidate *candidate = 0;
+  Photon *entry = 0;
+  Double_t pt, signPz, cosTheta, eta, rapidity;
+
+  array->Sort();
+
+  // loop over all photons
+  iterator.Reset();
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
+  {
+    TIter it1(candidate->GetCandidates());
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    pt = momentum.Pt();
+    cosTheta = TMath::Abs(momentum.CosTheta());
+    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
+
+    entry = static_cast<Photon*>(branch->NewEntry());
+
+    entry->Eta = eta;
+    entry->Phi = momentum.Phi();
+    entry->PT = pt;
+    entry->E = momentum.E();
+
+    entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9;
+
+    FillParticles(candidate, &entry->Particles);
+  }
+}
+
+//------------------------------------------------------------------------------
+
+void TreeWriter::ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array)
+{
+  TIter iterator(array);
+  Candidate *candidate = 0;
+  Electron *entry = 0;
+  Double_t pt, signPz, cosTheta, eta, rapidity;
+
+  array->Sort();
+
+  // loop over all electrons
+  iterator.Reset();
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    pt = momentum.Pt();
+    cosTheta = TMath::Abs(momentum.CosTheta());
+    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
+
+    entry = static_cast<Electron*>(branch->NewEntry());
+
+    entry->Eta = eta;
+    entry->Phi = momentum.Phi();
+    entry->PT = pt;
+
+    entry->Charge = candidate->Charge;
+
+    entry->EhadOverEem = 0.0;
+
+    entry->Particle = candidate->GetCandidates()->At(0);
+  }
+}
+
+//------------------------------------------------------------------------------
+
+void TreeWriter::ProcessMuons(ExRootTreeBranch *branch, TObjArray *array)
+{
+  TIter iterator(array);
+  Candidate *candidate = 0;
+  Muon *entry = 0;
+  Double_t pt, signPz, cosTheta, eta, rapidity;
+
+  array->Sort();
+
+  // loop over all muons
+  iterator.Reset();
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    pt = momentum.Pt();
+    cosTheta = TMath::Abs(momentum.CosTheta());
+    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
+
+    entry = static_cast<Muon*>(branch->NewEntry());
 
     entry->SetBit(kIsReferenced);
     entry->SetUniqueID(candidate->GetUniqueID());
 
-    entry->PID = candidate->PID;
-
-    entry->Charge = candidate->Charge;
-
-    entry->EtaOuter = eta;
-    entry->PhiOuter = position.Phi();
-
-    entry->XOuter = position.X();
-    entry->YOuter = position.Y();
-    entry->ZOuter = position.Z();
-    entry->TOuter = position.T() * 1.0E-3 / c_light;
-
-    entry->L = candidate->L;
-
-    entry->D0 = candidate->D0;
-    entry->DZ = candidate->DZ;
-    entry->Nclusters = candidate->Nclusters;
-    entry->dNdx = candidate->dNdx;
-
-    entry->ErrorP = candidate->ErrorP;
-    entry->ErrorPT = candidate->ErrorPT;
-    entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
-
-
-    // diagonal covariance matrix terms
-
-    entry->ErrorD0 = candidate->ErrorD0;
-    entry->ErrorC = candidate->ErrorC;
-    entry->ErrorPhi = candidate->ErrorPhi;
-    entry->ErrorDZ = candidate->ErrorDZ;
-    entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
-
-    // add some offdiagonal covariance matrix elements
-    entry->ErrorD0Phi          = candidate->TrackCovariance(0,1);
-    entry->ErrorD0C            = candidate->TrackCovariance(0,2);
-    entry->ErrorD0DZ           = candidate->TrackCovariance(0,3);
-    entry->ErrorD0CtgTheta     = candidate->TrackCovariance(0,4);
-    entry->ErrorPhiC           = candidate->TrackCovariance(1,2);
-    entry->ErrorPhiDZ          = candidate->TrackCovariance(1,3);
-    entry->ErrorPhiCtgTheta    = candidate->TrackCovariance(1,4);
-    entry->ErrorCDZ            = candidate->TrackCovariance(2,3);
-    entry->ErrorCCtgTheta      = candidate->TrackCovariance(2,4);
-    entry->ErrorDZCtgTheta     = candidate->TrackCovariance(3,4);
-
-    entry->Xd = candidate->Xd;
-    entry->Yd = candidate->Yd;
-    entry->Zd = candidate->Zd;
-
-    entry->XFirstHit = candidate->XFirstHit;
-    entry->YFirstHit = candidate->YFirstHit;
-    entry->ZFirstHit = candidate->ZFirstHit;
-
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    e = momentum.E();
-    pt = momentum.Pt();
-    p = momentum.P();
-    phi = momentum.Phi();
-    m = momentum.M();
-    ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
-
-    entry->E = e;
-    entry->P = p;
+    entry->Eta = eta;
+    entry->Phi = momentum.Phi();
     entry->PT = pt;
-    entry->Eta = eta;
-    entry->Phi = phi;
-    entry->CtgTheta = ctgTheta;
-    entry->C = candidate->C;
-    entry->Mass = m;
-
-    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
-    //const TLorentzVector &initialPosition = particle->Position;
-    const TLorentzVector &initialPosition = candidate->InitialPosition;
-
-    entry->X = initialPosition.X();
-    entry->Y = initialPosition.Y();
-    entry->Z = initialPosition.Z();
-    entry->T = initialPosition.T() * 1.0E-3 / c_light;
-    entry->ErrorT = candidate-> ErrorT * 1.0E-3 / c_light;
-
-    entry->VertexIndex = candidate->ClusterIndex;
-
-    entry->Eem = candidate->Eem;
-    entry->Ehad = candidate->Ehad;
-    entry->Etrk = candidate->Etrk;
-    entry->Edges[0] = candidate->Edges[0];
-    entry->Edges[1] = candidate->Edges[1];
-    entry->Edges[2] = candidate->Edges[2];
-    entry->Edges[3] = candidate->Edges[3];
-
-    //entry->T = position.T() * 1.0E-3 / c_light;
-    entry->NTimeHits = candidate->NTimeHits;
-
-    FillParticles(candidate, &entry->Particles);
-
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  Photon *entry = 0;
-  Double_t pt, signPz, cosTheta, eta, rapidity;
-  const Double_t c_light = 2.99792458E8;
-
-  array->Sort();
-
-  // loop over all photons
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    TIter it1(candidate->GetCandidates());
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->Position;
-
-    pt = momentum.Pt();
-    cosTheta = TMath::Abs(momentum.CosTheta());
-    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
-
-    entry = static_cast<Photon *>(branch->NewEntry());
-
-    entry->Eta = eta;
-    entry->Phi = momentum.Phi();
-    entry->PT = pt;
-    entry->E = momentum.E();
-    entry->T = position.T() * 1.0E-3 / c_light;
-
-    // Isolation variables
-
-    entry->IsolationVar = candidate->IsolationVar;
-    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
-    entry->SumPtCharged = candidate->SumPtCharged;
-    entry->SumPtNeutral = candidate->SumPtNeutral;
-    entry->SumPtChargedPU = candidate->SumPtChargedPU;
-    entry->SumPt = candidate->SumPt;
-
-    entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad / candidate->Eem : 999.9;
-
-    // 1: prompt -- 2: non prompt -- 3: fake
-    entry->Status = candidate->Status;
-
-    FillParticles(candidate, &entry->Particles);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  Electron *entry = 0;
-  Double_t pt, signPz, cosTheta, eta, rapidity;
-  const Double_t c_light = 2.99792458E8;
-
-  array->Sort();
-
-  // loop over all electrons
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->Position;
-
-    pt = momentum.Pt();
-    cosTheta = TMath::Abs(momentum.CosTheta());
-    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
-
-    entry = static_cast<Electron *>(branch->NewEntry());
-
-    entry->Eta = eta;
-    entry->Phi = momentum.Phi();
-    entry->PT = pt;
-
-    entry->T = position.T() * 1.0E-3 / c_light;
-
-    // displacement
-    entry->D0 = candidate->D0;
-    entry->ErrorD0 = candidate->ErrorD0;
-    entry->DZ = candidate->DZ;
-    entry->ErrorDZ = candidate->ErrorDZ;
-
-    // Isolation variables
-    entry->IsolationVar = candidate->IsolationVar;
-    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
-    entry->SumPtCharged = candidate->SumPtCharged;
-    entry->SumPtNeutral = candidate->SumPtNeutral;
-    entry->SumPtChargedPU = candidate->SumPtChargedPU;
-    entry->SumPt = candidate->SumPt;
-
-    entry->Charge = candidate->Charge;
-
-    entry->EhadOverEem = 0.0;
-
-    entry->Particle = candidate->GetCandidates()->At(0);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessMuons(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  Muon *entry = 0;
-  Double_t pt, signPz, cosTheta, eta, rapidity;
-
-  const Double_t c_light = 2.99792458E8;
-
-  array->Sort();
-
-  // loop over all muons
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->Position;
-
-    pt = momentum.Pt();
-    cosTheta = TMath::Abs(momentum.CosTheta());
-    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
-
-    entry = static_cast<Muon *>(branch->NewEntry());
-
-    entry->SetBit(kIsReferenced);
-    entry->SetUniqueID(candidate->GetUniqueID());
-
-    entry->Eta = eta;
-    entry->Phi = momentum.Phi();
-    entry->PT = pt;
-
-    entry->T = position.T() * 1.0E-3 / c_light;
-
-    // displacement
-    entry->D0 = candidate->D0;
-    entry->ErrorD0 = candidate->ErrorD0;
-    entry->DZ = candidate->DZ;
-    entry->ErrorDZ = candidate->ErrorDZ;
-
-    // Isolation variables
-
-    entry->IsolationVar = candidate->IsolationVar;
-    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
-    entry->SumPtCharged = candidate->SumPtCharged;
-    entry->SumPtNeutral = candidate->SumPtNeutral;
-    entry->SumPtChargedPU = candidate->SumPtChargedPU;
-    entry->SumPt = candidate->SumPt;
 
     entry->Charge = candidate->Charge;
@@ -787,6 +431,4 @@
   Double_t pt, signPz, cosTheta, eta, rapidity;
   Double_t ecalEnergy, hcalEnergy;
-  const Double_t c_light = 2.99792458E8;
-  Int_t i;
 
   array->Sort();
@@ -794,18 +436,16 @@
   // loop over all jets
   iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
+  while((candidate = static_cast<Candidate*>(iterator.Next())))
   {
     TIter itConstituents(candidate->GetCandidates());
-
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->Position;
+    const TLorentzVector &momentum = candidate->Momentum;
 
     pt = momentum.Pt();
     cosTheta = TMath::Abs(momentum.CosTheta());
     signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
-
-    entry = static_cast<Jet *>(branch->NewEntry());
+    eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
+    rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
+
+    entry = static_cast<Jet*>(branch->NewEntry());
 
     entry->Eta = eta;
@@ -813,24 +453,11 @@
     entry->PT = pt;
 
-    entry->T = position.T() * 1.0E-3 / c_light;
-
     entry->Mass = momentum.M();
-
-    entry->Area = candidate->Area;
 
     entry->DeltaEta = candidate->DeltaEta;
     entry->DeltaPhi = candidate->DeltaPhi;
 
-    entry->Flavor = candidate->Flavor;
-    entry->FlavorAlgo = candidate->FlavorAlgo;
-    entry->FlavorPhys = candidate->FlavorPhys;
-
     entry->BTag = candidate->BTag;
-
-    entry->BTagAlgo = candidate->BTagAlgo;
-    entry->BTagPhys = candidate->BTagPhys;
-
     entry->TauTag = candidate->TauTag;
-    entry->TauWeight = candidate->TauWeight;
 
     entry->Charge = candidate->Charge;
@@ -840,5 +467,5 @@
     ecalEnergy = 0.0;
     hcalEnergy = 0.0;
-    while((constituent = static_cast<Candidate *>(itConstituents.Next())))
+    while((constituent = static_cast<Candidate*>(itConstituents.Next())))
     {
       entry->Constituents.Add(constituent);
@@ -847,42 +474,5 @@
     }
 
-    entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy / ecalEnergy : 999.9;
-
-    //---   Pile-Up Jet ID variables ----
-
-    entry->NCharged = candidate->NCharged;
-    entry->NNeutrals = candidate->NNeutrals;
-
-    entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction;
-    entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction;
-    entry->Beta = candidate->Beta;
-    entry->BetaStar = candidate->BetaStar;
-    entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
-    entry->PTD = candidate->PTD;
-
-    //--- Sub-structure variables ----
-
-    entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
-    entry->NSubJetsPruned = candidate->NSubJetsPruned;
-    entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
-
-    entry->SoftDroppedJet = candidate->SoftDroppedJet;
-    entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1;
-    entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2;
-
-    for(i = 0; i < 5; i++)
-    {
-      entry->FracPt[i] = candidate->FracPt[i];
-      entry->Tau[i] = candidate->Tau[i];
-      entry->TrimmedP4[i] = candidate->TrimmedP4[i];
-      entry->PrunedP4[i] = candidate->PrunedP4[i];
-      entry->SoftDroppedP4[i] = candidate->SoftDroppedP4[i];
-    }
-
-    //--- exclusive clustering variables ---
-    entry->ExclYmerge23 = candidate->ExclYmerge23;
-    entry->ExclYmerge34 = candidate->ExclYmerge34;
-    entry->ExclYmerge45 = candidate->ExclYmerge45;
-    entry->ExclYmerge56 = candidate->ExclYmerge56;
+    entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy/ecalEnergy : 999.9;
 
     FillParticles(candidate, &entry->Particles);
@@ -898,68 +488,14 @@
 
   // get the first entry
-  if((candidate = static_cast<Candidate *>(array->At(0))))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    entry = static_cast<MissingET *>(branch->NewEntry());
-
-    entry->Eta = (-momentum).Eta();
+  if((candidate = static_cast<Candidate*>(array->At(0))))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    entry = static_cast<MissingET*>(branch->NewEntry());
+
     entry->Phi = (-momentum).Phi();
     entry->MET = momentum.Pt();
   }
 }
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  CscCluster *entry = 0;
-  Double_t pt, signPz, cosTheta, eta, rapidity;
-
-  const Double_t c_light = 2.99792458E8; // in unit of m/s
-
-  array->Sort();
-
-
-  // loop over all clusters
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-    const TLorentzVector &position = candidate->DecayPosition;
-
-    pt = momentum.Pt();
-    cosTheta = TMath::Abs(momentum.CosTheta());
-    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
-    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
-
-    entry = static_cast<CscCluster *>(branch->NewEntry());
-
-    entry->SetBit(kIsReferenced);
-    entry->SetUniqueID(candidate->GetUniqueID());
-
-    entry->Eta = eta;
-    entry->Phi = momentum.Phi();
-
-    entry->PT = momentum.Pt(); // pt of LLP
-    entry->Px = momentum.Px();// px of LLP
-    entry->Py = momentum.Py();// py of LLP
-    entry->Pz = momentum.Pz();// pz of LLP
-    entry->E = momentum.E(); // E of LLP
-    entry->pid = candidate->PID; // LLP pid
-    entry->Eem = candidate->Eem; // LLP Eem
-    entry->Ehad = candidate->Ehad; // LLP Ehad
-    Double_t beta = momentum.P()/momentum.E();
-    Double_t gamma = 1.0/sqrt(1-beta*beta);
-    Double_t decayDistance = sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)); // mm
-    entry->beta = beta; // LLP pid
-    entry->ctau = decayDistance/(beta * gamma); // LLP travel time in its rest frame
-    entry->T = decayDistance*(1./beta-1)* 1.0E-3/c_light*1e9; // ns
-    entry->X = position.X(); // LLP decay x
-    entry->Y = position.Y(); //  LLP decay y
-    entry->Z = position.Z(); //  LLP decay z
-  }
-}
 
 //------------------------------------------------------------------------------
@@ -971,83 +507,11 @@
 
   // get the first entry
-  if((candidate = static_cast<Candidate *>(array->At(0))))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    entry = static_cast<ScalarHT *>(branch->NewEntry());
+  if((candidate = static_cast<Candidate*>(array->At(0))))
+  {
+    const TLorentzVector &momentum = candidate->Momentum;
+
+    entry = static_cast<ScalarHT*>(branch->NewEntry());
 
     entry->HT = momentum.Pt();
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessRho(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  Rho *entry = 0;
-
-  // loop over all rho
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    entry = static_cast<Rho *>(branch->NewEntry());
-
-    entry->Rho = momentum.E();
-    entry->Edges[0] = candidate->Edges[0];
-    entry->Edges[1] = candidate->Edges[1];
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessWeight(ExRootTreeBranch *branch, TObjArray *array)
-{
-  Candidate *candidate = 0;
-  Weight *entry = 0;
-
-  // get the first entry
-  if((candidate = static_cast<Candidate *>(array->At(0))))
-  {
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    entry = static_cast<Weight *>(branch->NewEntry());
-
-    entry->Weight = momentum.E();
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void TreeWriter::ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array)
-{
-  TIter iterator(array);
-  Candidate *candidate = 0;
-  HectorHit *entry = 0;
-
-  // loop over all roman pot hits
-  iterator.Reset();
-  while((candidate = static_cast<Candidate *>(iterator.Next())))
-  {
-    const TLorentzVector &position = candidate->Position;
-    const TLorentzVector &momentum = candidate->Momentum;
-
-    entry = static_cast<HectorHit *>(branch->NewEntry());
-
-    entry->E = momentum.E();
-
-    entry->Tx = momentum.Px();
-    entry->Ty = momentum.Py();
-
-    entry->T = position.T();
-
-    entry->X = position.X();
-    entry->Y = position.Y();
-    entry->S = position.Z();
-
-    entry->Particle = candidate->GetCandidates()->At(0);
   }
 }
Index: modules/TreeWriter.h
===================================================================
--- modules/TreeWriter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/TreeWriter.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef TreeWriter_h
 #define TreeWriter_h
@@ -23,4 +5,8 @@
  *
  *  Fills ROOT tree branches.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -42,4 +28,5 @@
 {
 public:
+
   TreeWriter();
   ~TreeWriter();
@@ -50,35 +37,29 @@
 
 private:
+
   void FillParticles(Candidate *candidate, TRefArray *array);
 
   void ProcessParticles(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessVertices(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessTracks(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessTowers(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessMuons(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessTauJets(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessJets(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessMissingET(ExRootTreeBranch *branch, TObjArray *array);
   void ProcessScalarHT(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessRho(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessWeight(ExRootTreeBranch *branch, TObjArray *array);
-  void ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array);
 
-
-#if !defined(__CINT__) && !defined(__CLING__)
+#ifndef __CINT__
   typedef void (TreeWriter::*TProcessMethod)(ExRootTreeBranch *, TObjArray *); //!
 
-  typedef std::map<ExRootTreeBranch *, std::pair<TProcessMethod, TObjArray *> > TBranchMap; //!
+  typedef std::map< ExRootTreeBranch *, std::pair< TProcessMethod, TObjArray * > > TBranchMap; //!
 
   TBranchMap fBranchMap; //!
 
-  std::map<TClass *, TProcessMethod> fClassMap; //!
+  std::map< TClass *, TProcessMethod > fClassMap; //!
 #endif
 
-  ClassDef(TreeWriter, 2)
+  ClassDef(TreeWriter, 1)
 };
 
Index: modules/TruthVertexFinder.cc
===================================================================
--- modules/TruthVertexFinder.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class TruthVertexFinder
- *
- *  Merges particles from pile-up sample into event
- *
- *  \author M. Selvaggi - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/TruthVertexFinder.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesPileUpReader.h"
-#include "classes/DelphesTF2.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-TruthVertexFinder::TruthVertexFinder() :
-fItInputArray(0), fItOutputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-TruthVertexFinder::~TruthVertexFinder()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TruthVertexFinder::Init()
-{
-
-  fResolution = GetDouble("Resolution", 1E-06); // resolution in meters
-  // import input array
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/stableParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output arrays
-  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
-  //fItOutputArray = fVertexOutputArray->MakeIterator();
-}
-
-//------------------------------------------------------------------------------
-
-void TruthVertexFinder::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-  if(fItOutputArray) delete fItOutputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void TruthVertexFinder::Process()
-{
-  Int_t nvtx = -1;
-  Float_t pt;
-  Candidate *candidate, *vertex;
-  DelphesFactory *factory;
-
-
-  fItInputArray->Reset();
-
-  factory = GetFactory();
-  vertex = factory->NewCandidate();
-
-  TLorentzVector vertexPosition(0., 0., 0., 0.);
-
-  nvtx=0;
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-
-     const TLorentzVector &candidatePosition = candidate->Position;
-     const TLorentzVector &candidateMomentum = candidate->Momentum;
-
-     pt = candidateMomentum.Pt();
-     
-     // check whether vertex already included, if so add particle
-     Bool_t old_vertex=false;
-     fItOutputArray = fVertexOutputArray->MakeIterator();
-     fItOutputArray->Reset();
-     while((vertex = static_cast<Candidate *>(fItOutputArray->Next())))
-     {
-        const TLorentzVector &vertexPosition = vertex->Position;
-        // check whether spatial difference is < 1 um, in that case assume it is the same vertex
-        if ( TMath::Abs((candidatePosition.P() - vertexPosition.P())) < fResolution*1.E3)
-        {
-           old_vertex=true;
-           vertex->AddCandidate(candidate);
-           if (TMath::Abs(candidate->Charge) > 0)
-           {
-              vertex->ClusterNDF += 1;
-              vertex->GenSumPT2 += pt*pt;
-           }
-        }
-     }
-
-     // else fill new vertex
-     if (!old_vertex)
-     {
-        vertex = factory->NewCandidate();
-        vertex->Position = candidatePosition;
-        vertex->ClusterIndex = nvtx;
-
-        if (TMath::Abs(candidate->Charge) > 0)
-        {
-           vertex->ClusterNDF = 1;
-           vertex->GenSumPT2 = pt*pt;
-        }
-        else
-        {
-           vertex->ClusterNDF = 0;
-           vertex->GenSumPT2 = 0.;
-        }
-        fVertexOutputArray->Add(vertex);
-        nvtx++;
-      }
-   }
-}
-
-//------------------------------------------------------------------------------
Index: modules/TruthVertexFinder.h
===================================================================
--- modules/TruthVertexFinder.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TruthVertexFinder_h
-#define TruthVertexFinder_h
-
-/** \class TruthVertexFinder
- *
- *  Produces list of MC truth vertices
- *
- *  \author M. Selvaggi - CERN
- *
- */
-
-#include "classes/DelphesModule.h"
-
-class TObjArray;
-
-class TruthVertexFinder: public DelphesModule
-{
-public:
-  TruthVertexFinder();
-  ~TruthVertexFinder();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-
-  Double_t fResolution; //!
-
-  TIterator *fItInputArray; //!
-  TIterator *fItOutputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fVertexOutputArray; //!
-  ClassDef(TruthVertexFinder, 1)
-};
-
-#endif
Index: modules/UniqueObjectFinder.cc
===================================================================
--- modules/UniqueObjectFinder.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/UniqueObjectFinder.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,10 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class UniqueObjectFinder
  *
  *  Finds uniquely identified photons, electrons and jets.
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -31,20 +18,20 @@
 #include "classes/DelphesFormula.h"
 
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
 #include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
 
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
 #include "TDatabasePDG.h"
-#include "TFormula.h"
 #include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
 
-#include <algorithm>
+#include <algorithm> 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
 using namespace std;
@@ -66,7 +53,4 @@
 void UniqueObjectFinder::Init()
 {
-  // use GetUniqueID algorithm to find unique objects (faster than the default Overlaps method)
-  fUseUniqueID = GetBool("UseUniqueID", false);
-
   // import arrays with output from other modules
 
@@ -76,13 +60,11 @@
   TIterator *iterator;
 
-  fInputMap.clear();
-
   size = param.GetSize();
-  for(i = 0; i < size / 2; ++i)
+  for(i = 0; i < size/2; ++i)
   {
-    array = ImportArray(param[i * 2].GetString());
+    array = ImportArray(param[i*2].GetString());
     iterator = array->MakeIterator();
 
-    fInputMap.push_back(make_pair(iterator, ExportArray(param[i * 2 + 1].GetString())));
+    fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());;
   }
 }
@@ -92,5 +74,5 @@
 void UniqueObjectFinder::Finish()
 {
-  vector<pair<TIterator *, TObjArray *> >::iterator itInputMap;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
   TIterator *iterator;
 
@@ -108,5 +90,5 @@
 {
   Candidate *candidate;
-  vector<pair<TIterator *, TObjArray *> >::iterator itInputMap;
+  map< TIterator *, TObjArray * >::iterator itInputMap;
   TIterator *iterator;
   TObjArray *array;
@@ -120,5 +102,5 @@
     // loop over all candidates
     iterator->Reset();
-    while((candidate = static_cast<Candidate *>(iterator->Next())))
+    while((candidate = static_cast<Candidate*>(iterator->Next())))
     {
       if(Unique(candidate, itInputMap))
@@ -132,8 +114,8 @@
 //------------------------------------------------------------------------------
 
-Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector<pair<TIterator *, TObjArray *> >::iterator itInputMap)
+Bool_t UniqueObjectFinder::Unique(Candidate *candidate, map< TIterator *, TObjArray * >::iterator itInputMap)
 {
   Candidate *previousCandidate;
-  vector<pair<TIterator *, TObjArray *> >::iterator previousItInputMap;
+  map< TIterator *, TObjArray * >::iterator previousItInputMap;
   TObjArray *array;
 
@@ -146,19 +128,9 @@
     // loop over all candidates
     iterator.Reset();
-    while((previousCandidate = static_cast<Candidate *>(iterator.Next())))
+    while((previousCandidate = static_cast<Candidate*>(iterator.Next())))
     {
-      if(fUseUniqueID)
+      if(candidate->Overlaps(previousCandidate))
       {
-        if(candidate->GetUniqueID() == previousCandidate->GetUniqueID())
-        {
-          return kFALSE;
-        }
-      }
-      else
-      {
-        if(candidate->Overlaps(previousCandidate))
-        {
-          return kFALSE;
-        }
+        return kFALSE;
       }
     }
Index: modules/UniqueObjectFinder.h
===================================================================
--- modules/UniqueObjectFinder.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ modules/UniqueObjectFinder.h	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef UniqueObjectFinder_h
 #define UniqueObjectFinder_h
@@ -24,4 +6,8 @@
  *  Finds uniquely identified photons, electrons, taus and jets.
  *
+ *  $Date$
+ *  $Revision$
+ *
+ *
  *  \author P. Demin - UCL, Louvain-la-Neuve
  *
@@ -30,6 +16,5 @@
 #include "classes/DelphesModule.h"
 
-#include <utility>
-#include <vector>
+#include <map>
 
 class TIterator;
@@ -40,4 +25,5 @@
 {
 public:
+
   UniqueObjectFinder();
   ~UniqueObjectFinder();
@@ -48,9 +34,8 @@
 
 private:
-  Bool_t fUseUniqueID;
 
-  Bool_t Unique(Candidate *candidate, std::vector<std::pair<TIterator *, TObjArray *> >::iterator itInputMap);
+  Bool_t Unique(Candidate *candidate, std::map< TIterator *, TObjArray * >::iterator itInputMap);
 
-  std::vector<std::pair<TIterator *, TObjArray *> > fInputMap; //!
+  std::map< TIterator *, TObjArray * > fInputMap; //!
 
   ClassDef(UniqueObjectFinder, 1)
Index: modules/VertexFinder.cc
===================================================================
--- modules/VertexFinder.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,366 +1,0 @@
-/** \class VertexFinder
- *
- *  Cluster vertices from tracks
- *
- *  \authors A. Hart, M. Selvaggi
- *
- */
-
-#include "modules/VertexFinder.h"
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-#include "classes/DelphesPileUpReader.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TMatrixT.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-#include "TVector3.h"
-
-#include <algorithm>
-#include <iostream>
-#include <map>
-#include <stdexcept>
-#include <string>
-#include <utility>
-#include <vector>
-
-using namespace std;
-
-static const Double_t mm = 1.;
-static const Double_t m = 1000. * mm;
-static const Double_t ns = 1.;
-static const Double_t s = 1.e+9 * ns;
-static const Double_t c_light = 2.99792458e+8 * m / s;
-
-//------------------------------------------------------------------------------
-
-VertexFinder::VertexFinder() :
-  fSigma(0), fMinPT(0), fMaxEta(0), fSeedMinPT(0), fMinNDF(0), fGrowSeeds(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-VertexFinder::~VertexFinder()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::Init()
-{
-  fSigma = GetDouble("Sigma", 3.0);
-  fMinPT = GetDouble("MinPT", 0.1);
-  fMaxEta = GetDouble("MaxEta", 10.0);
-  fSeedMinPT = GetDouble("SeedMinPT", 5.0);
-  fMinNDF = GetInt("MinNDF", 4);
-  fGrowSeeds = GetInt("GrowSeeds", 1);
-
-  fInputArray = ImportArray(GetString("InputArray", "TrackSmearing/tracks"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-static Bool_t secondAscending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
-{
-  return (pair0.second < pair1.second);
-}
-
-static Bool_t secondDescending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
-{
-  return (pair0.second > pair1.second);
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::Process()
-{
-  Candidate *candidate;
-
-  // Clear the track and cluster maps before starting
-  trackIDToDouble.clear();
-  trackIDToInt.clear();
-  trackIDToBool.clear();
-  clusterIDToDouble.clear();
-  clusterIDToInt.clear();
-  clusterIDToBool.clear();
-  trackPT.clear();
-  clusterSumPT2.clear();
-
-  // Create the initial cluster seeds
-  createSeeds();
-
-  // In order of descending seed pt, grow each cluster. If a cluster ends up with
-  // fewer than MinNDF tracks, release the tracks for other clusters to claim.
-  sort(clusterSumPT2.begin(), clusterSumPT2.end(), secondDescending);
-  for(vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin(); cluster != clusterSumPT2.end(); cluster++)
-  {
-    // Skip the cluster if it no longer has any tracks
-    if(!clusterIDToInt.at(cluster->first).at("ndf"))
-      continue;
-
-    // Grow the cluster if GrowSeeds is true
-    if(fGrowSeeds)
-      growCluster(cluster->first);
-
-    // If the cluster still has fewer than MinNDF tracks, release the tracks;
-    // otherwise, mark the seed track as claimed
-
-    if((Int_t)clusterIDToInt.at(cluster->first).at("ndf") < fMinNDF)
-    {
-      for(map<UInt_t, map<string, Int_t> >::iterator track = trackIDToInt.begin(); track != trackIDToInt.end(); track++)
-      {
-        if(track->second.at("clusterIndex") != (Int_t)cluster->first)
-          continue;
-        track->second["clusterIndex"] = -1;
-        trackIDToBool[track->first]["claimed"] = false;
-      }
-    }
-    else
-      trackIDToBool[clusterIDToInt.at(cluster->first).at("seed")]["claimed"] = true;
-  }
-
-  // Add tracks to the output array after updating their ClusterIndex.
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    if(candidate->Momentum.Pt() < fMinPT || fabs(candidate->Momentum.Eta()) > fMaxEta)
-      continue;
-    candidate->ClusterIndex = trackIDToInt.at(candidate->GetUniqueID()).at("clusterIndex");
-    fOutputArray->Add(candidate);
-  }
-
-  // Add clusters with at least MinNDF tracks to the output array in order of
-  // descending sum(pt**2).
-  clusterSumPT2.clear();
-  for(map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin(); cluster != clusterIDToInt.end(); cluster++)
-  {
-
-    if(cluster->second.at("ndf") < fMinNDF)
-      continue;
-    clusterSumPT2.push_back(make_pair(cluster->first, clusterIDToDouble.at(cluster->first).at("sumPT2")));
-  }
-  sort(clusterSumPT2.begin(), clusterSumPT2.end(), secondDescending);
-
-  for(vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin(); cluster != clusterSumPT2.end(); cluster++)
-  {
-    DelphesFactory *factory = GetFactory();
-    candidate = factory->NewCandidate();
-
-    candidate->ClusterIndex = cluster->first;
-    candidate->ClusterNDF = clusterIDToInt.at(cluster->first).at("ndf");
-    candidate->ClusterSigma = fSigma;
-    candidate->SumPT2 = cluster->second;
-    candidate->Position.SetXYZT(0.0, 0.0, clusterIDToDouble.at(cluster->first).at("z"), 0.0);
-    candidate->PositionError.SetXYZT(0.0, 0.0, clusterIDToDouble.at(cluster->first).at("ez"), 0.0);
-
-    fVertexOutputArray->Add(candidate);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::createSeeds()
-{
-  Candidate *candidate;
-  UInt_t clusterIndex = 0, maxSeeds = 0;
-
-  // Loop over all tracks, initializing some variables.
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    if(candidate->Momentum.Pt() < fMinPT || fabs(candidate->Momentum.Eta()) > fMaxEta)
-      continue;
-
-    trackIDToDouble[candidate->GetUniqueID()]["pt"] = candidate->Momentum.Pt();
-    trackIDToDouble[candidate->GetUniqueID()]["ept"] = candidate->ErrorPT ? candidate->ErrorPT : 1.0e-15;
-    ;
-    trackIDToDouble[candidate->GetUniqueID()]["eta"] = candidate->Momentum.Eta();
-
-    trackIDToDouble[candidate->GetUniqueID()]["z"] = candidate->DZ;
-    trackIDToDouble[candidate->GetUniqueID()]["ez"] = candidate->ErrorDZ ? candidate->ErrorDZ : 1.0e-15;
-
-    trackIDToInt[candidate->GetUniqueID()]["clusterIndex"] = -1;
-    trackIDToInt[candidate->GetUniqueID()]["interactionIndex"] = candidate->IsPU;
-
-    trackIDToBool[candidate->GetUniqueID()]["claimed"] = false;
-
-    trackPT.push_back(make_pair(candidate->GetUniqueID(), candidate->Momentum.Pt()));
-  }
-
-  // Sort tracks by pt and leave only the SeedMinPT highest pt ones in the
-  // trackPT vector.
-  sort(trackPT.begin(), trackPT.end(), secondDescending);
-  for(vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin(); track != trackPT.end(); track++, maxSeeds++)
-  {
-    if(track->second < fSeedMinPT)
-      break;
-  }
-  // If there are no tracks with pt above MinSeedPT, create just one seed from
-  // the highest pt track.
-  if(!maxSeeds)
-    maxSeeds++;
-  if(trackPT.size() > maxSeeds)
-  {
-    trackPT.erase(trackPT.begin() + maxSeeds, trackPT.end());
-  }
-
-  // Create the seeds from the SeedMinPT highest pt tracks.
-  for(vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin(); track != trackPT.end(); track++, clusterIndex++)
-  {
-    addTrackToCluster(track->first, clusterIndex);
-    clusterSumPT2.push_back(make_pair(clusterIndex, track->second * track->second));
-  }
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::growCluster(const UInt_t clusterIndex)
-{
-  Bool_t done = false;
-  UInt_t nearestID;
-  Int_t oldClusterIndex;
-  Double_t nearestDistance;
-  vector<UInt_t> nearTracks;
-  nearTracks.clear();
-
-  // Grow the cluster until there are no more tracks within Sigma standard
-  // deviations of the cluster.
-  while(!done)
-  {
-    done = true;
-    nearestID = 0;
-    nearestDistance = -1.0;
-
-    // These two loops are for finding the nearest track to the cluster. The
-    // first time, the ID of each track within 10*Sigma of the cluster is
-    // saved in the nearTracks vector; subsequently, to save time, only the
-    // tracks in this vector are checked.
-    if(!nearTracks.size())
-    {
-
-      for(map<UInt_t, map<string, Double_t> >::const_iterator track = trackIDToDouble.begin(); track != trackIDToDouble.end(); track++)
-      {
-        if(trackIDToBool.at(track->first).at("claimed") || trackIDToInt.at(track->first).at("clusterIndex") == (Int_t)clusterIndex)
-          continue;
-
-        Double_t distance = fabs(clusterIDToDouble.at(clusterIndex).at("z") - track->second.at("z")) / hypot(clusterIDToDouble.at(clusterIndex).at("ez"), track->second.at("ez"));
-        if(nearestDistance < 0.0 || distance < nearestDistance)
-        {
-          nearestID = track->first;
-          nearestDistance = distance;
-        }
-        if(distance < 10.0 * fSigma)
-          nearTracks.push_back(track->first);
-      }
-    }
-
-    else
-    {
-      for(vector<UInt_t>::const_iterator track = nearTracks.begin(); track != nearTracks.end(); track++)
-      {
-        if(trackIDToBool.at(*track).at("claimed") || trackIDToInt.at(*track).at("clusterIndex") == (Int_t)clusterIndex)
-          continue;
-        Double_t distance = fabs(clusterIDToDouble.at(clusterIndex).at("z") - trackIDToDouble.at(*track).at("z")) / hypot(clusterIDToDouble.at(clusterIndex).at("ez"), trackIDToDouble.at(*track).at("ez"));
-        if(nearestDistance < 0.0 || distance < nearestDistance)
-        {
-          nearestID = *track;
-          nearestDistance = distance;
-        }
-      }
-    }
-
-    // If no tracks within Sigma of the cluster were found, stop growing.
-    done = nearestDistance > fSigma || nearestDistance < 0.0;
-    if(done)
-    {
-      continue;
-    }
-
-    // Add the nearest track within Sigma to the cluster. If it already
-    // belonged to another cluster, remove it from that cluster first.
-    if(nearestDistance < fSigma)
-    {
-      oldClusterIndex = trackIDToInt.at(nearestID).at("clusterIndex");
-      if(oldClusterIndex >= 0)
-        removeTrackFromCluster(nearestID, oldClusterIndex);
-
-      trackIDToBool[nearestID]["claimed"] = true;
-      addTrackToCluster(nearestID, clusterIndex);
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
-
-Double_t VertexFinder::weight(const UInt_t trackID)
-{
-  return ((trackIDToDouble.at(trackID).at("pt") / (trackIDToDouble.at(trackID).at("ept") * trackIDToDouble.at(trackID).at("ez"))) * (trackIDToDouble.at(trackID).at("pt") / (trackIDToDouble.at(trackID).at("ept") * trackIDToDouble.at(trackID).at("ez"))));
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::removeTrackFromCluster(const UInt_t trackID, const UInt_t clusterID)
-{
-  Double_t wz = weight(trackID);
-
-  trackIDToInt[trackID]["clusterIndex"] = -1;
-  clusterIDToInt[clusterID]["ndf"]--;
-
-  clusterIDToDouble[clusterID]["sumZ"] -= wz * trackIDToDouble.at(trackID).at("z");
-  clusterIDToDouble[clusterID]["errorSumZ"] -= wz * trackIDToDouble.at(trackID).at("ez") * trackIDToDouble.at(trackID).at("ez");
-  clusterIDToDouble[clusterID]["sumOfWeightsZ"] -= wz;
-  clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at(clusterID).at("sumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ");
-  clusterIDToDouble[clusterID]["ez"] = sqrt((1.0 / clusterIDToInt.at(clusterID).at("ndf")) * (clusterIDToDouble.at(clusterID).at("errorSumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ")));
-  clusterIDToDouble[clusterID]["sumPT2"] -= trackIDToDouble.at(trackID).at("pt") * trackIDToDouble.at(trackID).at("pt");
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinder::addTrackToCluster(const UInt_t trackID, const UInt_t clusterID)
-{
-  Double_t wz = weight(trackID);
-
-  if(!clusterIDToInt.count(clusterID))
-  {
-    clusterIDToInt[clusterID]["ndf"] = 0;
-    clusterIDToInt[clusterID]["seed"] = trackID;
-    clusterIDToDouble[clusterID]["sumZ"] = 0.0;
-    clusterIDToDouble[clusterID]["errorSumZ"] = 0.0;
-    clusterIDToDouble[clusterID]["sumOfWeightsZ"] = 0.0;
-    clusterIDToDouble[clusterID]["sumPT2"] = 0.0;
-  }
-
-  trackIDToInt[trackID]["clusterIndex"] = clusterID;
-  clusterIDToInt[clusterID]["ndf"]++;
-
-  clusterIDToDouble[clusterID]["sumZ"] += wz * trackIDToDouble.at(trackID).at("z");
-  clusterIDToDouble[clusterID]["errorSumZ"] += wz * trackIDToDouble.at(trackID).at("ez") * trackIDToDouble.at(trackID).at("ez");
-  clusterIDToDouble[clusterID]["sumOfWeightsZ"] += wz;
-  clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at(clusterID).at("sumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ");
-  clusterIDToDouble[clusterID]["ez"] = sqrt((1.0 / clusterIDToInt.at(clusterID).at("ndf")) * (clusterIDToDouble.at(clusterID).at("errorSumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ")));
-  clusterIDToDouble[clusterID]["sumPT2"] += trackIDToDouble.at(trackID).at("pt") * trackIDToDouble.at(trackID).at("pt");
-}
-
-//------------------------------------------------------------------------------
Index: modules/VertexFinder.h
===================================================================
--- modules/VertexFinder.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#ifndef VertexFinder_h
-#define VertexFinder_h
-
-/** \class VertexFinder
- *
- *  Cluster vertices from tracks
- *
- *  \authors A. Hart, M. Selvaggi
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <string>
-#include <vector>
-
-class TObjArray;
-class TIterator;
-
-class VertexFinder: public DelphesModule
-{
-public:
-  VertexFinder();
-  ~VertexFinder();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  void createSeeds();
-  void growCluster(const UInt_t);
-  Double_t weight(const UInt_t);
-  void addTrackToCluster(const UInt_t, const UInt_t);
-  void removeTrackFromCluster(const UInt_t, const UInt_t);
-
-  Double_t fSigma;
-  Double_t fMinPT;
-  Double_t fMaxEta;
-  Double_t fSeedMinPT;
-  Int_t fMinNDF;
-  Int_t fGrowSeeds;
-
-  TObjArray *fInputArray;
-  TIterator *fItInputArray;
-
-  TObjArray *fOutputArray;
-  TObjArray *fVertexOutputArray;
-
-  std::map<UInt_t, std::map<std::string, Double_t> > trackIDToDouble;
-  std::map<UInt_t, std::map<std::string, Int_t> > trackIDToInt;
-  std::map<UInt_t, std::map<std::string, Bool_t> > trackIDToBool;
-
-  std::map<UInt_t, std::map<std::string, Double_t> > clusterIDToDouble;
-  std::map<UInt_t, std::map<std::string, Int_t> > clusterIDToInt;
-  std::map<UInt_t, std::map<std::string, Bool_t> > clusterIDToBool;
-  std::vector<std::pair<UInt_t, Double_t> > trackPT;
-  std::vector<std::pair<UInt_t, Double_t> > clusterSumPT2;
-
-  ClassDef(VertexFinder, 1)
-};
-
-#endif
Index: modules/VertexFinderDA4D.cc
===================================================================
--- modules/VertexFinderDA4D.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,1221 +1,0 @@
-/** \class VertexFinderDA4D
- *
- *  Cluster vertices from tracks using deterministic annealing and timing information
- *
- *  \authors M. Selvaggi, L. Gray
- *
- */
-
-#include "modules/VertexFinderDA4D.h"
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-#include "classes/DelphesPileUpReader.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TMatrixT.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-#include "TVector3.h"
-
-#include <algorithm>
-#include <iostream>
-#include <stdexcept>
-#include <utility>
-#include <vector>
-
-using namespace std;
-
-static const Double_t mm = 1.;
-static const Double_t m = 1000. * mm;
-static const Double_t ns = 1.;
-static const Double_t s = 1.e+9 * ns;
-static const Double_t c_light = 2.99792458e+8 * m / s;
-
-struct track_t
-{
-  double z; // z-coordinate at point of closest approach to the beamline
-  double t; // t-coordinate at point of closest approach to the beamline
-  double dz2; // square of the error of z(pca)
-  double dtz; // covariance of z-t
-  double dt2; // square of the error of t(pca)
-  Candidate *tt; // a pointer to the Candidate Track
-  double Z; // Z[i]   for DA clustering
-  double pi; // track weight
-  double pt;
-  double eta;
-  double phi;
-};
-
-struct vertex_t
-{
-  double z;
-  double t;
-  double pk; // vertex weight for "constrained" clustering
-  // --- temporary numbers, used during update
-  double ei;
-  double sw;
-  double swz;
-  double swt;
-  double se;
-  // ---for Tc
-  double swE;
-  double Tc;
-};
-
-static bool split(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y);
-static double update1(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y);
-static double update2(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y, double &rho0, const double dzCutOff);
-static void dump(const double beta, const std::vector<vertex_t> &y, const std::vector<track_t> &tks);
-static bool merge(std::vector<vertex_t> &);
-static bool merge(std::vector<vertex_t> &, double &);
-static bool purge(std::vector<vertex_t> &, std::vector<track_t> &, double &, const double, const double);
-static void splitAll(std::vector<vertex_t> &y);
-static double beta0(const double betamax, std::vector<track_t> &tks, std::vector<vertex_t> &y, const double coolingFactor);
-static double Eik(const track_t &t, const vertex_t &k);
-
-static bool recTrackLessZ1(const track_t &tk1, const track_t &tk2)
-{
-  return tk1.z < tk2.z;
-}
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-VertexFinderDA4D::VertexFinderDA4D() :
-  fVerbose(0), fMinPT(0), fVertexSpaceSize(0), fVertexTimeSize(0),
-  fUseTc(0), fBetaMax(0), fBetaStop(0), fCoolingFactor(0),
-  fMaxIterations(0), fDzCutOff(0), fD0CutOff(0), fDtCutOff(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-VertexFinderDA4D::~VertexFinderDA4D()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinderDA4D::Init()
-{
-
-  fVerbose = GetBool("Verbose", 1);
-  fMinPT = GetDouble("MinPT", 0.1);
-  fVertexSpaceSize = GetDouble("VertexSpaceSize", 0.5); //in mm
-  fVertexTimeSize = GetDouble("VertexTimeSize", 10E-12); //in s
-  fUseTc = GetBool("UseTc", 1);
-  fBetaMax = GetDouble("BetaMax ", 0.1);
-  fBetaStop = GetDouble("BetaStop", 1.0);
-  fCoolingFactor = GetDouble("CoolingFactor", 0.8);
-  fMaxIterations = GetInt("MaxIterations", 100);
-  fDzCutOff = GetDouble("DzCutOff", 40); // Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes
-  fD0CutOff = GetDouble("D0CutOff", 30);
-  fDtCutOff = GetDouble("DtCutOff", 100E-12); // dummy
-
-  // convert stuff in cm, ns
-  fVertexSpaceSize /= 10.0;
-  fVertexTimeSize *= 1E9;
-  fDzCutOff /= 10.0; // Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes
-  fD0CutOff /= 10.0;
-
-  fInputArray = ImportArray(GetString("InputArray", "TrackSmearing/tracks"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
-  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinderDA4D::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinderDA4D::Process()
-{
-  Candidate *candidate, *track;
-  TObjArray *ClusterArray;
-  ClusterArray = new TObjArray;
-  TIterator *ItClusterArray;
-  Int_t ivtx = 0;
-
-  fInputArray->Sort();
-
-  TLorentzVector pos, mom;
-  if(fVerbose)
-  {
-    cout << " start processing vertices ..." << endl;
-    cout << " Found " << fInputArray->GetEntriesFast() << " input tracks" << endl;
-    //loop over input tracks
-    fItInputArray->Reset();
-    while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-    {
-      pos = candidate->InitialPosition;
-      mom = candidate->Momentum;
-
-      cout << "pt: " << mom.Pt() << ", eta: " << mom.Eta() << ", phi: " << mom.Phi() << ", z: " << candidate->DZ / 10 << endl;
-    }
-  }
-
-  // clusterize tracks in Z
-  clusterize(*fInputArray, *ClusterArray);
-
-  if(fVerbose)
-  {
-    std::cout << " clustering returned  " << ClusterArray->GetEntriesFast() << " clusters  from " << fInputArray->GetEntriesFast() << " selected tracks" << std::endl;
-  }
-
-  //loop over vertex candidates
-  ItClusterArray = ClusterArray->MakeIterator();
-  ItClusterArray->Reset();
-  while((candidate = static_cast<Candidate *>(ItClusterArray->Next())))
-  {
-
-    double meantime = 0.;
-    double expv_x2 = 0.;
-    double normw = 0.;
-    double errtime = 0;
-
-    double meanpos = 0.;
-    double meanerr2 = 0.;
-    double normpos = 0.;
-    double errpos = 0.;
-
-    double sumpt2 = 0.;
-
-    int itr = 0;
-
-    if(fVerbose) cout << "this vertex has: " << candidate->GetCandidates()->GetEntriesFast() << " tracks" << endl;
-
-    // loop over tracks belonging to this vertex
-    TIter it1(candidate->GetCandidates());
-    it1.Reset();
-
-    while((track = static_cast<Candidate *>(it1.Next())))
-    {
-
-      itr++;
-      // TBC: the time is in ns for now TBC
-      double t = track->InitialPosition.T() / c_light;
-      double dt = track->ErrorT / c_light;
-      const double time = t;
-      const double inverr = 1.0 / dt;
-      meantime += time * inverr;
-      expv_x2 += time * time * inverr;
-      normw += inverr;
-
-      // compute error position TBC
-      const double pt = track->Momentum.Pt();
-      const double z = track->DZ / 10.0;
-      const double err_pt = track->ErrorPT;
-      const double err_z = track->ErrorDZ;
-
-      const double wi = (pt / (err_pt * err_z)) * (pt / (err_pt * err_z));
-      meanpos += z * wi;
-
-      meanerr2 += err_z * err_z * wi;
-      normpos += wi;
-      sumpt2 += pt * pt;
-
-      // while we are here store cluster index in tracks
-      track->ClusterIndex = ivtx;
-    }
-
-    meantime = meantime / normw;
-    expv_x2 = expv_x2 / normw;
-    errtime = TMath::Sqrt((expv_x2 - meantime * meantime) / itr);
-    meanpos = meanpos / normpos;
-    meanerr2 = meanerr2 / normpos;
-    errpos = TMath::Sqrt(meanerr2 / itr);
-
-    candidate->Position.SetXYZT(0.0, 0.0, meanpos * 10.0, meantime * c_light);
-    candidate->PositionError.SetXYZT(0.0, 0.0, errpos * 10.0, errtime * c_light);
-    candidate->SumPT2 = sumpt2;
-    candidate->ClusterNDF = itr;
-    candidate->ClusterIndex = ivtx;
-
-    fVertexOutputArray->Add(candidate);
-
-    ivtx++;
-
-    if(fVerbose)
-    {
-      std::cout << "x,y,z";
-      std::cout << ",t";
-      std::cout << "=" << candidate->Position.X() / 10.0 << " " << candidate->Position.Y() / 10.0 << " " << candidate->Position.Z() / 10.0;
-      std::cout << " " << candidate->Position.T() / c_light;
-
-      std::cout << std::endl;
-      std::cout << "sumpt2 " << candidate->SumPT2 << endl;
-
-      std::cout << "ex,ey,ez";
-      std::cout << ",et";
-      std::cout << "=" << candidate->PositionError.X() / 10.0 << " " << candidate->PositionError.Y() / 10.0 << " " << candidate->PositionError.Z() / 10.0;
-      std::cout << " " << candidate->PositionError.T() / c_light;
-      std::cout << std::endl;
-    }
-  } // end of cluster loop
-
-  if(fVerbose)
-  {
-    std::cout << "PrimaryVertexProducerAlgorithm::vertices candidates =" << ClusterArray->GetEntriesFast() << std::endl;
-  }
-
-  //TBC maybe this can be done later
-  // sort vertices by pt**2  vertex (aka signal vertex tagging)
-  /*if(pvs.size()>1){
-      sort(pvs.begin(), pvs.end(), VertexHigherPtSquared());
-    }
-     */
-
-  delete ClusterArray;
-}
-
-//------------------------------------------------------------------------------
-
-void VertexFinderDA4D::clusterize(const TObjArray &tracks, TObjArray &clusters)
-{
-  if(fVerbose)
-  {
-    cout << "###################################################" << endl;
-    cout << "# VertexFinderDA4D::clusterize   nt=" << tracks.GetEntriesFast() << endl;
-    cout << "###################################################" << endl;
-  }
-
-  vector<Candidate *> pv = vertices();
-
-  if(fVerbose)
-  {
-    cout << "# VertexFinderDA4D::clusterize   pv.size=" << pv.size() << endl;
-  }
-  if(pv.size() == 0)
-  {
-    return;
-  }
-
-  // convert into vector of candidates
-  //TObjArray *ClusterArray = pv.begin()->GetCandidates();
-  //Candidate *aCluster = static_cast<Candidate*>(&(pv.at(0)));
-  Candidate *aCluster = pv.at(0);
-
-  // fill into clusters and merge
-
-  if(fVerbose)
-  {
-    std::cout << '\t' << 0;
-    std::cout << ' ' << (*pv.begin())->Position.Z() / 10.0 << ' ' << (*pv.begin())->Position.T() / c_light << std::endl;
-  }
-
-  for(vector<Candidate *>::iterator k = pv.begin() + 1; k != pv.end(); k++)
-  {
-    if(fVerbose)
-    {
-      std::cout << '\t' << std::distance(pv.begin(), k);
-      std::cout << ' ' << (*k)->Position.Z() << ' ' << (*k)->Position.T() << std::endl;
-    }
-
-    // TBC - check units here
-    if(std::abs((*k)->Position.Z() - (*(k - 1))->Position.Z()) / 10.0 > (2 * fVertexSpaceSize) || std::abs((*k)->Position.T() - (*(k - 1))->Position.Z()) / c_light > 2 * 0.010)
-    {
-      // close a cluster
-      clusters.Add(aCluster);
-      //aCluster.clear();
-    }
-    //for(unsigned int i=0; i<k->GetCandidates().GetEntriesFast(); i++){
-    aCluster = *k;
-    //}
-  }
-  clusters.Add(aCluster);
-
-  if(fVerbose)
-  {
-    std::cout << "# VertexFinderDA4D::clusterize clusters.size=" << clusters.GetEntriesFast() << std::endl;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-vector<Candidate *> VertexFinderDA4D::vertices()
-{
-  Candidate *candidate;
-  UInt_t clusterIndex = 0;
-  vector<Candidate *> clusters;
-
-  vector<track_t> tks;
-  track_t tr;
-  Double_t z, dz, t, l, dt, d0, d0error;
-
-  // loop over input tracks
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    //TBC everything in cm
-    z = candidate->DZ / 10;
-    tr.z = z;
-    dz = candidate->ErrorDZ / 10;
-    tr.dz2 = dz * dz // track error
-      //TBC: beamspot size induced error, take 0 for now.
-      // + (std::pow(beamspot.BeamWidthX()*cos(phi),2.)+std::pow(beamspot.BeamWidthY()*sin(phi),2.))/std::pow(tantheta,2.) // beam-width induced
-      + fVertexSpaceSize * fVertexSpaceSize; // intrinsic vertex size, safer for outliers and short lived decays
-
-    // TBC: the time is in ns for now TBC
-    //t = candidate->Position.T()/c_light;
-    t = candidate->InitialPosition.T() / c_light;
-    l = candidate->L / c_light;
-    double pt = candidate->Momentum.Pt();
-    double eta = candidate->Momentum.Eta();
-    double phi = candidate->Momentum.Phi();
-
-    tr.pt = pt;
-    tr.eta = eta;
-    tr.phi = phi;
-    tr.t = t; //
-    tr.dtz = 0.;
-    dt = candidate->ErrorT / c_light;
-    tr.dt2 = dt * dt + fVertexTimeSize * fVertexTimeSize; // the ~injected~ timing error plus a small minimum vertex size in time
-    if(fD0CutOff > 0)
-    {
-
-      d0 = TMath::Abs(candidate->D0) / 10.0;
-      d0error = candidate->ErrorD0 / 10.0;
-
-      tr.pi = 1. / (1. + exp((d0 * d0) / (d0error * d0error) - fD0CutOff * fD0CutOff)); // reduce weight for high ip tracks
-    }
-    else
-    {
-      tr.pi = 1.;
-    }
-    tr.tt = &(*candidate);
-    tr.Z = 1.;
-
-    // TBC now putting track selection here (> fPTMin)
-    if(tr.pi > 1e-3 && tr.pt > fMinPT)
-    {
-      tks.push_back(tr);
-    }
-  }
-
-  //print out input tracks
-
-  if(fVerbose)
-  {
-    std::cout << " start processing vertices ..." << std::endl;
-    std::cout << " Found " << tks.size() << " input tracks" << std::endl;
-    //loop over input tracks
-
-    for(std::vector<track_t>::const_iterator it = tks.begin(); it != tks.end(); it++)
-    {
-      double z = it->z;
-      double pt = it->pt;
-      double eta = it->eta;
-      double phi = it->phi;
-      double t = it->t;
-
-      std::cout << "pt: " << pt << ", eta: " << eta << ", phi: " << phi << ", z: " << z << ", t: " << t << std::endl;
-    }
-  }
-
-  unsigned int nt = tks.size();
-  double rho0 = 0.0; // start with no outlier rejection
-
-  if(tks.empty()) return clusters;
-
-  vector<vertex_t> y; // the vertex prototypes
-
-  // initialize:single vertex at infinite temperature
-  vertex_t vstart;
-  vstart.z = 0.;
-  vstart.t = 0.;
-  vstart.pk = 1.;
-  y.push_back(vstart);
-  int niter = 0; // number of iterations
-
-  // estimate first critical temperature
-  double beta = beta0(fBetaMax, tks, y, fCoolingFactor);
-  niter = 0;
-  while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations))
-  {
-  }
-
-  // annealing loop, stop when T<Tmin  (i.e. beta>1/Tmin)
-  while(beta < fBetaMax)
-  {
-
-    if(fUseTc)
-    {
-      update1(beta, tks, y);
-      while(merge(y, beta))
-      {
-        update1(beta, tks, y);
-      }
-      split(beta, tks, y);
-      beta = beta / fCoolingFactor;
-    }
-    else
-    {
-      beta = beta / fCoolingFactor;
-      splitAll(y);
-    }
-
-    // make sure we are not too far from equilibrium before cooling further
-    niter = 0;
-    while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations))
-    {
-    }
-  }
-
-  if(fUseTc)
-  {
-    // last round of splitting, make sure no critical clusters are left
-    update1(beta, tks, y);
-    while(merge(y, beta))
-    {
-      update1(beta, tks, y);
-    }
-    unsigned int ntry = 0;
-    while(split(beta, tks, y) && (ntry++ < 10))
-    {
-      niter = 0;
-      while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations))
-      {
-      }
-      merge(y, beta);
-      update1(beta, tks, y);
-    }
-  }
-  else
-  {
-    // merge collapsed clusters
-    while(merge(y, beta))
-    {
-      update1(beta, tks, y);
-    }
-    if(fVerbose)
-    {
-      cout << "dump after 1st merging " << endl;
-      dump(beta, y, tks);
-    }
-  }
-
-  // switch on outlier rejection
-  rho0 = 1. / nt;
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    k->pk = 1.;
-  } // democratic
-  niter = 0;
-  while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-8) && (niter++ < fMaxIterations))
-  {
-  }
-  if(fVerbose)
-  {
-    cout << "rho0=" << rho0 << " niter=" << niter << endl;
-    dump(beta, y, tks);
-  }
-
-  // merge again  (some cluster split by outliers collapse here)
-  while(merge(y))
-  {
-  }
-  if(fVerbose)
-  {
-    cout << "dump after 2nd merging " << endl;
-    dump(beta, y, tks);
-  }
-
-  // continue from freeze-out to Tstop (=1) without splitting, eliminate insignificant vertices
-  while(beta <= fBetaStop)
-  {
-    while(purge(y, tks, rho0, beta, fDzCutOff))
-    {
-      niter = 0;
-      while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations))
-      {
-      }
-    }
-    beta /= fCoolingFactor;
-    niter = 0;
-    while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations))
-    {
-    }
-  }
-
-  //   // new, one last round of cleaning at T=Tstop
-  //   while(purge(y,tks,rho0, beta)){
-  //     niter=0; while((update2(beta, tks,y,rho0, fDzCutOff) > 1.e-6)  && (niter++ < fMaxIterations)){  }
-  //   }
-
-  if(fVerbose)
-  {
-    cout << "Final result, rho0=" << rho0 << endl;
-    dump(beta, y, tks);
-  }
-
-  // select significant tracks and use a TransientVertex as a container
-  //GlobalError dummyError;
-
-  // ensure correct normalization of probabilities, should make double assginment reasonably impossible
-  for(unsigned int i = 0; i < nt; i++)
-  {
-    tks[i].Z = rho0 * exp(-beta * (fDzCutOff * fDzCutOff));
-    for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-    {
-      tks[i].Z += k->pk * exp(-beta * Eik(tks[i], *k));
-    }
-  }
-
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-
-    DelphesFactory *factory = GetFactory();
-    candidate = factory->NewCandidate();
-
-    //cout<<"new vertex"<<endl;
-    //GlobalPoint pos(0, 0, k->z);
-    double time = k->t;
-    double z = k->z;
-    //vector< reco::TransientTrack > vertexTracks;
-    //double max_track_time_err2 = 0;
-    double mean = 0.;
-    double expv_x2 = 0.;
-    double normw = 0.;
-    for(unsigned int i = 0; i < nt; i++)
-    {
-      const double invdt = 1.0 / std::sqrt(tks[i].dt2);
-      if(tks[i].Z > 0)
-      {
-        double p = k->pk * exp(-beta * Eik(tks[i], *k)) / tks[i].Z;
-        if((tks[i].pi > 0) && (p > 0.5))
-        {
-          //std::cout << "pushing back " << i << ' ' << tks[i].tt << std::endl;
-          //vertexTracks.push_back(*(tks[i].tt)); tks[i].Z=0;
-
-          candidate->AddCandidate(tks[i].tt);
-          tks[i].Z = 0;
-
-          mean += tks[i].t * invdt * p;
-          expv_x2 += tks[i].t * tks[i].t * invdt * p;
-          normw += invdt * p;
-        } // setting Z=0 excludes double assignment
-      }
-    }
-
-    mean = mean / normw;
-    expv_x2 = expv_x2 / normw;
-    const double time_var = expv_x2 - mean * mean;
-    const double crappy_error_guess = std::sqrt(time_var);
-    /*GlobalError dummyErrorWithTime(0,
-                                   0,0,
-                                   0,0,0,
-                                   0,0,0,crappy_error_guess);*/
-    //TransientVertex v(pos, time, dummyErrorWithTime, vertexTracks, 5);
-
-    candidate->ClusterIndex = clusterIndex++;
-    ;
-    candidate->Position.SetXYZT(0.0, 0.0, z * 10.0, time * c_light);
-
-    // TBC - fill error later ...
-    candidate->PositionError.SetXYZT(0.0, 0.0, 0.0, crappy_error_guess * c_light);
-
-    clusterIndex++;
-    clusters.push_back(candidate);
-  }
-
-  return clusters;
-}
-
-//------------------------------------------------------------------------------
-
-static double Eik(const track_t &t, const vertex_t &k)
-{
-  return std::pow(t.z - k.z, 2.) / t.dz2 + std::pow(t.t - k.t, 2.) / t.dt2;
-}
-
-//------------------------------------------------------------------------------
-
-static void dump(const double beta, const vector<vertex_t> &y, const vector<track_t> &tks0)
-{
-  // copy and sort for nicer printout
-  vector<track_t> tks;
-  for(vector<track_t>::const_iterator t = tks0.begin(); t != tks0.end(); t++)
-  {
-    tks.push_back(*t);
-  }
-  std::stable_sort(tks.begin(), tks.end(), recTrackLessZ1);
-
-  cout << "-----DAClusterizerInZT::dump ----" << endl;
-  cout << " beta=" << beta << endl;
-  cout << "                                                               z= ";
-  cout.precision(4);
-  for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++)
-  {
-    //cout  <<  setw(8) << fixed << k->z;
-  }
-  cout << endl
-       << "                                                               t= ";
-  for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++)
-  {
-    //cout  <<  setw(8) << fixed << k->t;
-  }
-  //cout << endl << "T=" << setw(15) << 1./beta <<"                                             Tc= ";
-  for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++)
-  {
-    //cout  <<  setw(8) << fixed << k->Tc ;
-  }
-
-  cout << endl
-       << "                                                              pk=";
-  double sumpk = 0;
-  for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++)
-  {
-    //cout <<  setw(8) <<  setprecision(3) <<  fixed << k->pk;
-    sumpk += k->pk;
-  }
-  cout << endl;
-
-  double E = 0, F = 0;
-  cout << endl;
-  cout << "----       z +/- dz        t +/- dt        ip +/-dip       pt    phi  eta    weights  ----" << endl;
-  cout.precision(4);
-  for(unsigned int i = 0; i < tks.size(); i++)
-  {
-    if(tks[i].Z > 0)
-    {
-      F -= log(tks[i].Z) / beta;
-    }
-    double tz = tks[i].z;
-    double tt = tks[i].t;
-    //cout <<  setw (3)<< i << ")" <<  setw (8) << fixed << setprecision(4)<<  tz << " +/-" <<  setw (6)<< sqrt(tks[i].dz2)
-    //     << setw(8) << fixed << setprecision(4) << tt << " +/-" << setw(6) << std::sqrt(tks[i].dt2)  ;
-
-    double sump = 0.;
-    for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++)
-    {
-      if((tks[i].pi > 0) && (tks[i].Z > 0))
-      {
-        //double p=pik(beta,tks[i],*k);
-        double p = k->pk * std::exp(-beta * Eik(tks[i], *k)) / tks[i].Z;
-        if(p > 0.0001)
-        {
-          //cout <<  setw (8) <<  setprecision(3) << p;
-        }
-        else
-        {
-          cout << "    .   ";
-        }
-        E += p * Eik(tks[i], *k);
-        sump += p;
-      }
-      else
-      {
-        cout << "        ";
-      }
-    }
-    cout << endl;
-  }
-  cout << endl
-       << "T=" << 1 / beta << " E=" << E << " n=" << y.size() << "  F= " << F << endl
-       << "----------" << endl;
-}
-
-//------------------------------------------------------------------------------
-
-static double update1(double beta, vector<track_t> &tks, vector<vertex_t> &y)
-{
-  //update weights and vertex positions
-  // mass constrained annealing without noise
-  // returns the squared sum of changes of vertex positions
-
-  unsigned int nt = tks.size();
-
-  //initialize sums
-  double sumpi = 0;
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k)
-  {
-    k->sw = 0.;
-    k->swz = 0.;
-    k->swt = 0.;
-    k->se = 0.;
-    k->swE = 0.;
-    k->Tc = 0.;
-  }
-
-  // loop over tracks
-  for(unsigned int i = 0; i < nt; i++)
-  {
-
-    // update pik and Zi
-    double Zi = 0.;
-    for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k)
-    {
-      k->ei = std::exp(-beta * Eik(tks[i], *k)); // cache exponential for one track at a time
-      Zi += k->pk * k->ei;
-    }
-    tks[i].Z = Zi;
-
-    // normalization for pk
-    if(tks[i].Z > 0)
-    {
-      sumpi += tks[i].pi;
-      // accumulate weighted z and weights for vertex update
-      for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k)
-      {
-        k->se += tks[i].pi * k->ei / Zi;
-        const double w = k->pk * tks[i].pi * k->ei / (Zi * (tks[i].dz2 * tks[i].dt2));
-        k->sw += w;
-        k->swz += w * tks[i].z;
-        k->swt += w * tks[i].t;
-        k->swE += w * Eik(tks[i], *k);
-      }
-    }
-    else
-    {
-      sumpi += tks[i].pi;
-    }
-
-  } // end of track loop
-
-  // now update z and pk
-  double delta = 0;
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    if(k->sw > 0)
-    {
-      const double znew = k->swz / k->sw;
-      const double tnew = k->swt / k->sw;
-      delta += std::pow(k->z - znew, 2.) + std::pow(k->t - tnew, 2.);
-      k->z = znew;
-      k->t = tnew;
-      k->Tc = 2. * k->swE / k->sw;
-    }
-    else
-    {
-      // cout << " a cluster melted away ?  pk=" << k->pk <<  " sumw=" << k->sw <<  endl
-      k->Tc = -1;
-    }
-
-    k->pk = k->pk * k->se / sumpi;
-  }
-
-  // return how much the prototypes moved
-  return delta;
-}
-
-//------------------------------------------------------------------------------
-
-static double update2(double beta, vector<track_t> &tks, vector<vertex_t> &y, double &rho0, double dzCutOff)
-{
-  // MVF style, no more vertex weights, update tracks weights and vertex positions, with noise
-  // returns the squared sum of changes of vertex positions
-
-  unsigned int nt = tks.size();
-
-  //initialize sums
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    k->sw = 0.;
-    k->swz = 0.;
-    k->swt = 0.;
-    k->se = 0.;
-    k->swE = 0.;
-    k->Tc = 0.;
-  }
-
-  // loop over tracks
-  for(unsigned int i = 0; i < nt; i++)
-  {
-
-    // update pik and Zi and Ti
-    double Zi = rho0 * std::exp(-beta * (dzCutOff * dzCutOff)); // cut-off (eventually add finite size in time)
-    //double Ti = 0.; // dt0*std::exp(-beta*fDtCutOff);
-    for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-    {
-      k->ei = std::exp(-beta * Eik(tks[i], *k)); // cache exponential for one track at a time
-      Zi += k->pk * k->ei;
-    }
-    tks[i].Z = Zi;
-
-    // normalization
-    if(tks[i].Z > 0)
-    {
-      // accumulate weighted z and weights for vertex update
-      for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-      {
-        k->se += tks[i].pi * k->ei / Zi;
-        double w = k->pk * tks[i].pi * k->ei / (Zi * (tks[i].dz2 * tks[i].dt2));
-        k->sw += w;
-        k->swz += w * tks[i].z;
-        k->swt += w * tks[i].t;
-        k->swE += w * Eik(tks[i], *k);
-      }
-    }
-
-  } // end of track loop
-
-  // now update z
-  double delta = 0;
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    if(k->sw > 0)
-    {
-      const double znew = k->swz / k->sw;
-      const double tnew = k->swt / k->sw;
-      delta += std::pow(k->z - znew, 2.) + std::pow(k->t - tnew, 2.);
-      k->z = znew;
-      k->t = tnew;
-      k->Tc = 2 * k->swE / k->sw;
-    }
-    else
-    {
-      // cout << " a cluster melted away ?  pk=" << k->pk <<  " sumw=" << k->sw <<  endl;
-      k->Tc = 0;
-    }
-  }
-
-  // return how much the prototypes moved
-  return delta;
-}
-
-//------------------------------------------------------------------------------
-
-static bool merge(vector<vertex_t> &y)
-{
-  // merge clusters that collapsed or never separated, return true if vertices were merged, false otherwise
-
-  if(y.size() < 2) return false;
-
-  for(vector<vertex_t>::iterator k = y.begin(); (k + 1) != y.end(); k++)
-  {
-    if(std::abs((k + 1)->z - k->z) < 1.e-3 && std::abs((k + 1)->t - k->t) < 1.e-3)
-    { // with fabs if only called after freeze-out (splitAll() at highter T)
-      double rho = k->pk + (k + 1)->pk;
-      if(rho > 0)
-      {
-        k->z = (k->pk * k->z + (k + 1)->z * (k + 1)->pk) / rho;
-        k->t = (k->pk * k->t + (k + 1)->t * (k + 1)->pk) / rho;
-      }
-      else
-      {
-        k->z = 0.5 * (k->z + (k + 1)->z);
-        k->t = 0.5 * (k->t + (k + 1)->t);
-      }
-      k->pk = rho;
-
-      y.erase(k + 1);
-      return true;
-    }
-  }
-
-  return false;
-}
-
-//------------------------------------------------------------------------------
-
-static bool merge(vector<vertex_t> &y, double &beta)
-{
-  // merge clusters that collapsed or never separated,
-  // only merge if the estimated critical temperature of the merged vertex is below the current temperature
-  // return true if vertices were merged, false otherwise
-  if(y.size() < 2) return false;
-
-  for(vector<vertex_t>::iterator k = y.begin(); (k + 1) != y.end(); k++)
-  {
-    if(std::abs((k + 1)->z - k->z) < 2.e-3 && std::abs((k + 1)->t - k->t) < 2.e-3)
-    {
-      double rho = k->pk + (k + 1)->pk;
-      double swE = k->swE + (k + 1)->swE - k->pk * (k + 1)->pk / rho * (std::pow((k + 1)->z - k->z, 2.) + std::pow((k + 1)->t - k->t, 2.));
-      double Tc = 2 * swE / (k->sw + (k + 1)->sw);
-
-      if(Tc * beta < 1)
-      {
-        if(rho > 0)
-        {
-          k->z = (k->pk * k->z + (k + 1)->z * (k + 1)->pk) / rho;
-          k->t = (k->pk * k->t + (k + 1)->t * (k + 1)->pk) / rho;
-        }
-        else
-        {
-          k->z = 0.5 * (k->z + (k + 1)->z);
-          k->t = 0.5 * (k->t + (k + 1)->t);
-        }
-        k->pk = rho;
-        k->sw += (k + 1)->sw;
-        k->swE = swE;
-        k->Tc = Tc;
-        y.erase(k + 1);
-        return true;
-      }
-    }
-  }
-
-  return false;
-}
-
-//------------------------------------------------------------------------------
-
-static bool purge(vector<vertex_t> &y, vector<track_t> &tks, double &rho0, const double beta, const double dzCutOff)
-{
-  // eliminate clusters with only one significant/unique track
-  if(y.size() < 2) return false;
-
-  unsigned int nt = tks.size();
-  double sumpmin = nt;
-  vector<vertex_t>::iterator k0 = y.end();
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    int nUnique = 0;
-    double sump = 0;
-    double pmax = k->pk / (k->pk + rho0 * exp(-beta * dzCutOff * dzCutOff));
-    for(unsigned int i = 0; i < nt; i++)
-    {
-      if(tks[i].Z > 0)
-      {
-        double p = k->pk * std::exp(-beta * Eik(tks[i], *k)) / tks[i].Z;
-        sump += p;
-        if((p > 0.9 * pmax) && (tks[i].pi > 0))
-        {
-          nUnique++;
-        }
-      }
-    }
-
-    if((nUnique < 2) && (sump < sumpmin))
-    {
-      sumpmin = sump;
-      k0 = k;
-    }
-  }
-
-  if(k0 != y.end())
-  {
-    //cout << "eliminating prototype at " << k0->z << "," << k0->t << " with sump=" << sumpmin << endl;
-    //rho0+=k0->pk;
-    y.erase(k0);
-    return true;
-  }
-  else
-  {
-    return false;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-static double beta0(double betamax, vector<track_t> &tks, vector<vertex_t> &y, const double coolingFactor)
-{
-
-  double T0 = 0; // max Tc for beta=0
-  // estimate critical temperature from beta=0 (T=inf)
-  unsigned int nt = tks.size();
-
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-
-    // vertex fit at T=inf
-    double sumwz = 0.;
-    double sumwt = 0.;
-    double sumw = 0.;
-    for(unsigned int i = 0; i < nt; i++)
-    {
-      double w = tks[i].pi / (tks[i].dz2 * tks[i].dt2);
-      sumwz += w * tks[i].z;
-      sumwt += w * tks[i].t;
-      sumw += w;
-    }
-    k->z = sumwz / sumw;
-    k->t = sumwt / sumw;
-
-    // estimate Tcrit, eventually do this in the same loop
-    double a = 0, b = 0;
-    for(unsigned int i = 0; i < nt; i++)
-    {
-      double dx = tks[i].z - (k->z);
-      double dt = tks[i].t - (k->t);
-      double w = tks[i].pi / (tks[i].dz2 * tks[i].dt2);
-      a += w * (std::pow(dx, 2.) / tks[i].dz2 + std::pow(dt, 2.) / tks[i].dt2);
-      b += w;
-    }
-    double Tc = 2. * a / b; // the critical temperature of this vertex
-    if(Tc > T0) T0 = Tc;
-  } // vertex loop (normally there should be only one vertex at beta=0)
-
-  if(T0 > 1. / betamax)
-  {
-    return betamax / pow(coolingFactor, int(std::log(T0 * betamax) / std::log(coolingFactor)) - 1);
-  }
-  else
-  {
-    // ensure at least one annealing step
-    return betamax / coolingFactor;
-  }
-}
-
-//------------------------------------------------------------------------------
-
-static bool split(double beta, vector<track_t> &tks, vector<vertex_t> &y)
-{
-  // split only critical vertices (Tc >~ T=1/beta   <==>   beta*Tc>~1)
-  // an update must have been made just before doing this (same beta, no merging)
-  // returns true if at least one cluster was split
-
-  const double epsilon = 1e-3; // split all single vertices by 10 um
-  bool split = false;
-
-  // avoid left-right biases by splitting highest Tc first
-
-  std::vector<std::pair<double, unsigned int> > critical;
-  for(unsigned int ik = 0; ik < y.size(); ik++)
-  {
-    if(beta * y[ik].Tc > 1.)
-    {
-      critical.push_back(make_pair(y[ik].Tc, ik));
-    }
-  }
-  std::stable_sort(critical.begin(), critical.end(), std::greater<std::pair<double, unsigned int> >());
-
-  for(unsigned int ic = 0; ic < critical.size(); ic++)
-  {
-    unsigned int ik = critical[ic].second;
-    // estimate subcluster positions and weight
-    double p1 = 0, z1 = 0, t1 = 0, w1 = 0;
-    double p2 = 0, z2 = 0, t2 = 0, w2 = 0;
-    //double sumpi=0;
-    for(unsigned int i = 0; i < tks.size(); i++)
-    {
-      if(tks[i].Z > 0)
-      {
-        //sumpi+=tks[i].pi;
-        double p = y[ik].pk * exp(-beta * Eik(tks[i], y[ik])) / tks[i].Z * tks[i].pi;
-        double w = p / (tks[i].dz2 * tks[i].dt2);
-        if(tks[i].z < y[ik].z)
-        {
-          p1 += p;
-          z1 += w * tks[i].z;
-          t1 += w * tks[i].t;
-          w1 += w;
-        }
-        else
-        {
-          p2 += p;
-          z2 += w * tks[i].z;
-          t2 += w * tks[i].t;
-          w2 += w;
-        }
-      }
-    }
-    if(w1 > 0)
-    {
-      z1 = z1 / w1;
-      t1 = t1 / w1;
-    }
-    else
-    {
-      z1 = y[ik].z - epsilon;
-      t1 = y[ik].t - epsilon;
-    }
-    if(w2 > 0)
-    {
-      z2 = z2 / w2;
-      t2 = t2 / w2;
-    }
-    else
-    {
-      z2 = y[ik].z + epsilon;
-      t2 = y[ik].t + epsilon;
-    }
-
-    // reduce split size if there is not enough room
-    if((ik > 0) && (y[ik - 1].z >= z1))
-    {
-      z1 = 0.5 * (y[ik].z + y[ik - 1].z);
-      t1 = 0.5 * (y[ik].t + y[ik - 1].t);
-    }
-    if((ik + 1 < y.size()) && (y[ik + 1].z <= z2))
-    {
-      z2 = 0.5 * (y[ik].z + y[ik + 1].z);
-      t2 = 0.5 * (y[ik].t + y[ik + 1].t);
-    }
-
-    // split if the new subclusters are significantly separated
-    if((z2 - z1) > epsilon || std::abs(t2 - t1) > epsilon)
-    {
-      split = true;
-      vertex_t vnew;
-      vnew.pk = p1 * y[ik].pk / (p1 + p2);
-      y[ik].pk = p2 * y[ik].pk / (p1 + p2);
-      vnew.z = z1;
-      vnew.t = t1;
-      y[ik].z = z2;
-      y[ik].t = t2;
-      y.insert(y.begin() + ik, vnew);
-
-      // adjust remaining pointers
-      for(unsigned int jc = ic; jc < critical.size(); jc++)
-      {
-        if(critical[jc].second > ik)
-        {
-          critical[jc].second++;
-        }
-      }
-    }
-  }
-
-  //  stable_sort(y.begin(), y.end(), clusterLessZ);
-  return split;
-}
-
-//------------------------------------------------------------------------------
-
-void splitAll(vector<vertex_t> &y)
-{
-
-  const double epsilon = 1e-3; // split all single vertices by 10 um
-  const double zsep = 2 * epsilon; // split vertices that are isolated by at least zsep (vertices that haven't collapsed)
-  const double tsep = 2 * epsilon; // check t as well
-
-  vector<vertex_t> y1;
-
-  for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++)
-  {
-    if(((k == y.begin()) || (k - 1)->z < k->z - zsep) && (((k + 1) == y.end()) || (k + 1)->z > k->z + zsep))
-    {
-      // isolated prototype, split
-      vertex_t vnew;
-      vnew.z = k->z - epsilon;
-      vnew.t = k->t - epsilon;
-      (*k).z = k->z + epsilon;
-      (*k).t = k->t + epsilon;
-      vnew.pk = 0.5 * (*k).pk;
-      (*k).pk = 0.5 * (*k).pk;
-      y1.push_back(vnew);
-      y1.push_back(*k);
-    }
-    else if(y1.empty() || (y1.back().z < k->z - zsep) || (y1.back().t < k->t - tsep))
-    {
-      y1.push_back(*k);
-    }
-    else
-    {
-      y1.back().z -= epsilon;
-      y1.back().t -= epsilon;
-      k->z += epsilon;
-      k->t += epsilon;
-      y1.push_back(*k);
-    }
-  } // vertex loop
-
-  y = y1;
-}
Index: modules/VertexFinderDA4D.h
===================================================================
--- modules/VertexFinderDA4D.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#ifndef VertexFinderDA4D_h
-#define VertexFinderDA4D_h
-
-/** \class VertexFinderDA4D
- *
- *  Cluster vertices from tracks using deterministic annealing and timing information
- *
- *  \authors M. Selvaggi, L. Gray
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <vector>
-
-class TObjArray;
-class TIterator;
-class Candidate;
-
-class VertexFinderDA4D: public DelphesModule
-{
-public:
-  VertexFinderDA4D();
-  ~VertexFinderDA4D();
-
-  void Init();
-  void Process();
-  void Finish();
-
-  void clusterize(const TObjArray &tracks, TObjArray &clusters);
-  std::vector<Candidate *> vertices();
-
-private:
-  Bool_t fVerbose;
-  Double_t fMinPT;
-
-  Float_t fVertexSpaceSize;
-  Float_t fVertexTimeSize;
-  Bool_t fUseTc;
-  Float_t fBetaMax;
-  Float_t fBetaStop;
-  Double_t fCoolingFactor;
-  Int_t fMaxIterations;
-  Double_t fDzCutOff;
-  Double_t fD0CutOff;
-  Double_t fDtCutOff; // for when the beamspot has time
-
-  TObjArray *fInputArray;
-  TIterator *fItInputArray;
-
-  TObjArray *fOutputArray;
-  TObjArray *fVertexOutputArray;
-
-  ClassDef(VertexFinderDA4D, 1)
-};
-
-#endif
Index: modules/VertexSorter.cc
===================================================================
--- modules/VertexSorter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/** \class VertexSorter
- *
- *
- *  Sorts vertices according to different criteria
- *
- *  \authors A. Hart, M. Selvaggi
- *
- *
-*/
-
-#include "modules/VertexSorter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-#include "classes/DelphesPileUpReader.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TMatrixT.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-#include "TVector3.h"
-
-#include <algorithm>
-#include <iostream>
-#include <map>
-#include <stdexcept>
-#include <string>
-#include <utility>
-#include <vector>
-
-using namespace std;
-
-static const Double_t mm = 1.;
-static const Double_t m = 1000. * mm;
-static const Double_t ns = 1.;
-static const Double_t s = 1.e+9 * ns;
-static const Double_t c_light = 2.99792458e+8 * m / s;
-
-//------------------------------------------------------------------------------
-
-VertexSorter::VertexSorter() :
-  fInputArray(NULL), fTrackInputArray(NULL), fItTrackInputArray(NULL), fJetInputArray(NULL), fItJetInputArray(NULL), fOutputArray(NULL)
-{
-}
-
-//------------------------------------------------------------------------------
-
-VertexSorter::~VertexSorter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void VertexSorter::Init()
-{
-  fInputArray = ImportArray(GetString("InputArray", "VertexFinder/vertices"));
-
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "VertexFinder/tracks"));
-  fItTrackInputArray = fTrackInputArray->MakeIterator();
-
-  if(string(GetString("JetInputArray", "")) != "")
-  {
-    fJetInputArray = ImportArray(GetString("JetInputArray", ""));
-    fItJetInputArray = fJetInputArray->MakeIterator();
-  }
-
-  // import beamspot
-  try
-  {
-    fBeamSpotInputArray = ImportArray(GetString("BeamSpotInputArray", "BeamSpotFilter/beamSpotParticle"));
-  }
-  catch(runtime_error &e)
-  {
-    fBeamSpotInputArray = 0;
-  }
-
-  fOutputArray = ExportArray(GetString("OutputArray", "clusters"));
-
-  fMethod = GetString("Method", "BTV");
-}
-
-//------------------------------------------------------------------------------
-
-void VertexSorter::Finish()
-{
-  if(fItTrackInputArray) delete fItTrackInputArray;
-  if(fItJetInputArray) delete fItJetInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-static Bool_t secondDescending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
-{
-  return (pair0.second > pair1.second);
-}
-
-static Bool_t secondAscending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)
-{
-  return (pair0.second < pair1.second);
-}
-
-//------------------------------------------------------------------------------
-
-void VertexSorter::Process()
-{
-  Candidate *candidate, *jetCandidate, *beamSpotCandidate;
-  map<Int_t, UInt_t> clusterIDToIndex;
-  map<Int_t, UInt_t>::const_iterator itClusterIDToIndex;
-  map<Int_t, Double_t> clusterIDToSumPT2;
-  map<Int_t, Double_t>::const_iterator itClusterIDToSumPT2;
-  vector<pair<Int_t, Double_t> > sortedClusterIDs;
-  vector<pair<Int_t, Double_t> >::const_iterator itSortedClusterIDs;
-
-  for(Int_t iCluster = 0; iCluster < fInputArray->GetEntries(); iCluster++)
-  {
-    const Candidate &cluster = *((Candidate *)fInputArray->At(iCluster));
-    clusterIDToIndex[cluster.ClusterIndex] = iCluster;
-    clusterIDToSumPT2[cluster.ClusterIndex] = 0.0;
-  }
-
-  if(fMethod == "BTV")
-  {
-    if(!fJetInputArray)
-    {
-      cout << "BTV PV sorting selected, but no jet collection given!" << endl;
-      throw 0;
-    }
-
-    fItTrackInputArray->Reset();
-    while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next())))
-    {
-      if(candidate->Momentum.Pt() < 1.0)
-        continue;
-      if(candidate->ClusterIndex < 0)
-        continue;
-      TLorentzVector p(candidate->Momentum.Px(), candidate->Momentum.Py(), candidate->Momentum.Pz(), candidate->Momentum.E());
-      Bool_t isInJet = false;
-
-      fItJetInputArray->Reset();
-      while((jetCandidate = static_cast<Candidate *>(fItJetInputArray->Next())))
-      {
-        if(jetCandidate->Momentum.Pt() < 30.0)
-          continue;
-        TLorentzVector q(jetCandidate->Momentum.Px(), jetCandidate->Momentum.Py(), jetCandidate->Momentum.Pz(), jetCandidate->Momentum.E());
-
-        if(p.DeltaR(q) > 0.4)
-          continue;
-        isInJet = true;
-        break;
-      }
-      if(!isInJet)
-        continue;
-
-      clusterIDToSumPT2.at(candidate->ClusterIndex) += candidate->Momentum.Pt() * candidate->Momentum.Pt();
-    }
-
-    for(itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2)
-      sortedClusterIDs.push_back(make_pair(itClusterIDToSumPT2->first, itClusterIDToSumPT2->second));
-    sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondDescending);
-  }
-  else if(fMethod == "GenClosest")
-  {
-    if(!fBeamSpotInputArray)
-    {
-      cout << "GenClosest PV sorting selected, but no beamspot collection given!" << endl;
-      throw 0;
-    }
-    if(!fBeamSpotInputArray->GetSize())
-    {
-      cout << "Beamspot collection is empty!" << endl;
-      throw 0;
-    }
-
-    beamSpotCandidate = (Candidate *)fBeamSpotInputArray->At(0);
-    for(Int_t iCluster = 0; iCluster < fInputArray->GetEntries(); iCluster++)
-    {
-      const Candidate &cluster = *((Candidate *)fInputArray->At(iCluster));
-      sortedClusterIDs.push_back(make_pair(cluster.ClusterIndex, fabs(cluster.Position.Z() - beamSpotCandidate->Position.Z())));
-    }
-    sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondAscending);
-  }
-  else if(fMethod == "GenBest")
-  {
-    fItTrackInputArray->Reset();
-    while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next())))
-    {
-      if(candidate->IsPU)
-        continue;
-      for(itClusterIDToIndex = clusterIDToIndex.begin(); itClusterIDToIndex != clusterIDToIndex.end(); ++itClusterIDToIndex)
-      {
-        if(candidate->ClusterIndex != itClusterIDToIndex->first)
-          continue;
-        clusterIDToSumPT2.at(itClusterIDToIndex->first) += candidate->Momentum.Pt() * candidate->Momentum.Pt();
-      }
-    }
-
-    for(itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2)
-      sortedClusterIDs.push_back(make_pair(itClusterIDToSumPT2->first, itClusterIDToSumPT2->second));
-    sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondDescending);
-  }
-  else
-  {
-    cout << "\"" << fMethod << "\" is not a valid sorting method!" << endl;
-    cout << "Valid methods are:" << endl;
-    cout << "  BTV" << endl;
-    cout << "  GenClosest" << endl;
-    cout << "  GenBest" << endl;
-    throw 0;
-  }
-  for(itSortedClusterIDs = sortedClusterIDs.begin(); itSortedClusterIDs != sortedClusterIDs.end(); ++itSortedClusterIDs)
-  {
-    Candidate *cluster = (Candidate *)fInputArray->At(clusterIDToIndex.at(itSortedClusterIDs->first));
-    if(fMethod == "BTV")
-      cluster->BTVSumPT2 = itSortedClusterIDs->second;
-    else if(fMethod == "GenClosest")
-      cluster->GenDeltaZ = itSortedClusterIDs->second;
-    else if(fMethod == "GenBest")
-      cluster->GenSumPT2 = itSortedClusterIDs->second;
-    fOutputArray->Add(cluster);
-  }
-}
-
-//------------------------------------------------------------------------------
Index: modules/VertexSorter.h
===================================================================
--- modules/VertexSorter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#ifndef VertexSorter_h
-#define VertexSorter_h
-
-/** \class VertexSorter
- *
- *
- *  Sorts vertices according to different criteria
- *
- *  \authors A. Hart, M. Selvaggi
- *
- *
-*/
-
-#include "classes/DelphesModule.h"
-
-#include <string>
-
-class TObjArray;
-class TIterator;
-class Candidate;
-
-class VertexSorter: public DelphesModule
-{
-public:
-  VertexSorter();
-  ~VertexSorter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-  TObjArray *fInputArray;
-
-  TObjArray *fTrackInputArray;
-  TIterator *fItTrackInputArray;
-
-  TObjArray *fJetInputArray;
-  TIterator *fItJetInputArray;
-
-  TObjArray *fBeamSpotInputArray;
-  TIterator *fItBeamSpotInputArray;
-
-  TObjArray *fOutputArray;
-
-  std::string fMethod;
-
-  ClassDef(VertexSorter, 1)
-};
-
-#endif
Index: modules/Weighter.cc
===================================================================
--- modules/Weighter.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \class Weighter
- *
- *  Apply a weight depending on PDG code.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "modules/Weighter.h"
-
-#include "classes/DelphesClasses.h"
-#include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
-
-#include "ExRootAnalysis/ExRootClassifier.h"
-#include "ExRootAnalysis/ExRootFilter.h"
-#include "ExRootAnalysis/ExRootResult.h"
-
-#include "TDatabasePDG.h"
-#include "TFormula.h"
-#include "TLorentzVector.h"
-#include "TMath.h"
-#include "TObjArray.h"
-#include "TRandom3.h"
-#include "TString.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-
-using namespace std;
-
-//------------------------------------------------------------------------------
-
-bool Weighter::TIndexStruct::operator<(const Weighter::TIndexStruct &value) const
-{
-  Int_t i;
-
-  for(i = 0; i < 4; ++i)
-  {
-    if(codes[i] != value.codes[i]) return codes[i] < value.codes[i];
-  }
-
-  return false;
-}
-
-//------------------------------------------------------------------------------
-
-Weighter::Weighter() :
-  fItInputArray(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-Weighter::~Weighter()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Weighter::Init()
-{
-  ExRootConfParam param, paramCodes;
-  Int_t i, j, size, sizeCodes;
-  Int_t code;
-  TIndexStruct index;
-  Double_t weight;
-
-  fWeightSet.clear();
-
-  // set default weight value
-  fWeightMap.clear();
-  memset(index.codes, 0, 4 * sizeof(Int_t));
-  fWeightMap[index] = 1.0;
-
-  // read weights
-  param = GetParam("Weight");
-  size = param.GetSize();
-  for(i = 0; i < size / 2; ++i)
-  {
-    paramCodes = param[i * 2];
-    sizeCodes = paramCodes.GetSize();
-    weight = param[i * 2 + 1].GetDouble();
-
-    if(sizeCodes < 1 || sizeCodes > 4)
-    {
-      throw runtime_error("only 1, 2, 3 or 4 PDG codes can be specified per weight");
-    }
-
-    memset(index.codes, 0, 4 * sizeof(Int_t));
-
-    for(j = 0; j < sizeCodes; ++j)
-    {
-      code = paramCodes[j].GetInt();
-      index.codes[j] = code;
-      fWeightSet.insert(code);
-    }
-
-    sort(index.codes, index.codes + 4);
-
-    fWeightMap[index] = weight;
-  }
-
-  // import input array(s)
-
-  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
-  fItInputArray = fInputArray->MakeIterator();
-
-  // create output array(s)
-
-  fOutputArray = ExportArray(GetString("OutputArray", "weight"));
-}
-
-//------------------------------------------------------------------------------
-
-void Weighter::Finish()
-{
-  if(fItInputArray) delete fItInputArray;
-}
-
-//------------------------------------------------------------------------------
-
-void Weighter::Process()
-{
-  Candidate *candidate;
-  Int_t i;
-  TIndexStruct index;
-  Double_t weight;
-  set<Int_t>::iterator itCodeSet;
-  map<TIndexStruct, Double_t>::iterator itWeightMap;
-
-  DelphesFactory *factory = GetFactory();
-
-  // loop over all particles
-  fCodeSet.clear();
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    if(candidate->Status != 3) continue;
-
-    if(fWeightSet.find(candidate->PID) == fWeightSet.end()) continue;
-
-    fCodeSet.insert(candidate->PID);
-  }
-
-  // find default weight value
-  memset(index.codes, 0, 4 * sizeof(Int_t));
-  itWeightMap = fWeightMap.find(index);
-  weight = itWeightMap->second;
-
-  if(fCodeSet.size() <= 4)
-  {
-    i = 0;
-    for(itCodeSet = fCodeSet.begin(); itCodeSet != fCodeSet.end(); ++itCodeSet)
-    {
-      index.codes[i] = *itCodeSet;
-      ++i;
-    }
-
-    sort(index.codes, index.codes + 4);
-
-    itWeightMap = fWeightMap.find(index);
-    if(itWeightMap != fWeightMap.end())
-    {
-      weight = itWeightMap->second;
-    }
-  }
-
-  candidate = factory->NewCandidate();
-  candidate->Momentum.SetPtEtaPhiE(weight, 0.0, 0.0, weight);
-  fOutputArray->Add(candidate);
-}
-
-//------------------------------------------------------------------------------
Index: modules/Weighter.h
===================================================================
--- modules/Weighter.h	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef Weighter_h
-#define Weighter_h
-
-/** \class Weighter
- *
- *  Apply a weight depending on PDG code.
- *
- *  \author P. Demin - UCL, Louvain-la-Neuve
- *
- */
-
-#include "classes/DelphesModule.h"
-
-#include <map>
-#include <set>
-
-class TObjArray;
-
-class Weighter: public DelphesModule
-{
-public:
-  Weighter();
-  ~Weighter();
-
-  void Init();
-  void Process();
-  void Finish();
-
-private:
-#if !defined(__CINT__) && !defined(__CLING__)
-  struct TIndexStruct
-  {
-    Int_t codes[4];
-    bool operator<(const TIndexStruct &value) const;
-  };
-
-  std::set<Int_t> fWeightSet, fCodeSet;
-  std::map<TIndexStruct, Double_t> fWeightMap;
-#endif
-
-  TIterator *fItInputArray; //!
-
-  const TObjArray *fInputArray; //!
-
-  TObjArray *fOutputArray; //!
-
-  ClassDef(Weighter, 1)
-};
-
-#endif
