Index: cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl
===================================================================
--- cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl	(revision 20ca0cd9f4c77e04149db66434b1a6f0bb59334c)
+++ cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -33,10 +33,14 @@
   PhotonEnergySmearing
   ElectronFilter
+
   TrackPileUpSubtractor
+  RecoPuFilter
 
   TowerMerger
   NeutralEFlowMerger
-  EFlowMergerAllTracks
+
   EFlowMerger
+  EFlowMergerCHS
+  Rho
 
   LeptonFilterNoLep
@@ -48,12 +52,22 @@
 
   PhotonIsolation
+  PhotonIsolationCHS
   PhotonEfficiency
+  PhotonEfficiencyCHS
 
   ElectronIsolation
+  ElectronIsolationCHS
+
   ElectronEfficiency
+  ElectronEfficiencyCHS
 
   MuonIsolation
+  MuonIsolationCHS
+
   MuonLooseIdEfficiency
   MuonTightIdEfficiency
+
+  MuonLooseIdEfficiencyCHS
+  MuonTightIdEfficiencyCHS
 
   NeutrinoFilter
@@ -68,4 +82,6 @@
   FastJetFinder
   FastJetFinderAK8
+  JetPileUpSubtractor
+  JetPileUpSubtractorAK8
   FastJetFinderPUPPI
   FastJetFinderPUPPIAK8
@@ -121,11 +137,11 @@
 
   # maximum spread in the beam direction in m
-  set ZVertexSpread 0
+  set ZVertexSpread 0.25
 
   # maximum spread in time in s
-  set TVertexSpread 0
+  set TVertexSpread 800E-12
 
   # vertex smearing formula f(z,t) (z,t need to be respectively given in m,s) - {exp(-(t^2/160e-12^2/2))*exp(-(z^2/0.053^2/2))}
-  set VertexDistributionFormula 1
+  set VertexDistributionFormula {exp(-(t^2/160e-12^2/2))*exp(-(z^2/0.053^2/2))}
 
 }
@@ -273,7 +289,4 @@
   source muonMomentumResolution.tcl
 }
-
-
-
 
 ##############
@@ -527,4 +540,12 @@
 }
 
+########################
+# Reco PU filter
+########################
+
+module RecoPuFilter RecoPuFilter {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracks
+}
 
 ###################################################
@@ -539,5 +560,4 @@
 }
 
-
 ####################
 # Neutral eflow erger
@@ -551,8 +571,7 @@
 }
 
-
-####################
+#####################
 # Energy flow merger
-####################
+#####################
 
 module Merger EFlowMerger {
@@ -564,11 +583,11 @@
 }
 
-##################################
-# Energy flow merger (all tracks)
-##################################
-
-module Merger EFlowMergerAllTracks {
+############################
+# Energy flow merger no PU
+############################
+
+module Merger EFlowMergerCHS {
 # add InputArray InputArray
-  add InputArray TrackMerger/tracks
+  add InputArray RecoPuFilter/eflowTracks
   add InputArray PhotonEnergySmearing/eflowPhotons
   add InputArray HCal/eflowNeutralHadrons
@@ -695,5 +714,4 @@
 }
 
-
 #####################
 # MC truth jet finder
@@ -735,13 +753,45 @@
 }
 
-############
+
+#############
+# Rho pile-up
+#############
+
+module FastJetFinder Rho {
+#  set InputArray Calorimeter/towers
+  set InputArray EFlowMergerCHS/eflow
+
+  set ComputeRho true
+  set RhoOutputArray rho
+
+  # area algorithm: 0 Do not compute area, 1 Active area explicit ghosts, 2 One ghost passive area, 3 Passive area, 4 Voronoi, 5 Active area
+  set AreaAlgorithm 5
+
+  # jet algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 4
+  set ParameterR 0.4
+  set GhostEtaMax 5.0
+
+  add RhoEtaRange -5.0 -4.0
+  add RhoEtaRange -4.0 -1.5
+  add RhoEtaRange -1.5 1.5
+  add RhoEtaRange 1.5 4.0
+  add RhoEtaRange 4.0 5.0
+
+  set JetPTMin 0.0
+}
+
+
+##############
 # Jet finder
-############
+##############
 
 module FastJetFinder FastJetFinder {
 #  set InputArray TowerMerger/towers
-  set InputArray EFlowMerger/eflow
+  set InputArray EFlowMergerCHS/eflow
 
   set OutputArray jets
+
+  set AreaAlgorithm 5
 
   # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
@@ -755,7 +805,9 @@
 module FastJetFinder FastJetFinderAK8 {
 #  set InputArray TowerMerger/towers
-  set InputArray EFlowMerger/eflow
+  set InputArray EFlowMergerCHS/eflow
 
   set OutputArray jets
+
+  set AreaAlgorithm 5
 
   # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
@@ -784,4 +836,30 @@
 }
 
+###########################
+# Jet Pile-Up Subtraction
+###########################
+
+module JetPileUpSubtractor JetPileUpSubtractor {
+  set JetInputArray FastJetFinder/jets
+  set RhoInputArray Rho/rho
+
+  set OutputArray jets
+
+  set JetPTMin 15.0
+}
+
+##############################
+# Jet Pile-Up Subtraction AK8
+##############################
+
+module JetPileUpSubtractor JetPileUpSubtractorAK8 {
+  set JetInputArray FastJetFinderAK8/jets
+  set RhoInputArray Rho/rho
+
+  set OutputArray jets
+
+  set JetPTMin 15.0
+}
+
 module FastJetFinder FastJetFinderPUPPI {
 #  set InputArray TowerMerger/towers
@@ -833,5 +911,5 @@
 
 module EnergyScale JetEnergyScale {
-  set InputArray FastJetFinder/jets
+  set InputArray JetPileUpSubtractor/jets
   set OutputArray jets
 
@@ -841,5 +919,5 @@
 
 module EnergyScale JetEnergyScaleAK8 {
-  set InputArray FastJetFinderAK8/jets
+  set InputArray JetPileUpSubtractorAK8/jets
   set OutputArray jets
 
@@ -907,4 +985,30 @@
 }
 
+
+########################
+# Photon isolation CHS #
+########################
+
+module Isolation PhotonIsolationCHS {
+
+  # particle for which calculate the isolation
+  set CandidateInputArray PhotonFilter/photons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  # output array
+  set OutputArray photons
+
+  # isolation cone
+  set DeltaRMax 0.3
+
+  # minimum pT
+  set PTMin     1.0
+
+  # iso ratio to cut
+  set PTRatioMax 9999.
+
+}
 
 
@@ -929,4 +1033,23 @@
 
 
+#####################
+# Photon efficiency #
+#####################
+
+module Efficiency PhotonEfficiencyCHS {
+
+  ## input particles
+  set InputArray PhotonIsolationCHS/photons
+  ## output particles
+  set OutputArray photons
+  # set EfficiencyFormula {efficiency formula as a function of eta and pt}
+  # efficiency formula for photons
+  set EfficiencyFormula {                      (pt <= 10.0) * (0.00) + \
+	                   (abs(eta) <= 1.5) * (pt > 10.0)  * (0.9635) + \
+	 (abs(eta) > 1.5 && abs(eta) <= 4.0) * (pt > 10.0)  * (0.9624) + \
+	 (abs(eta) > 4.0)                                   * (0.00)}
+
+}
+
 ######################
 # Electron isolation #
@@ -949,4 +1072,23 @@
 }
 
+
+##########################
+# Electron isolation CHS #
+##########################
+
+module Isolation ElectronIsolationCHS {
+
+  set CandidateInputArray ElectronFilter/electrons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray electrons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
 
 
@@ -995,4 +1137,49 @@
 }
 
+###########################
+# Electron efficiency CHS #
+###########################
+
+module Efficiency ElectronEfficiencyCHS {
+
+  set InputArray ElectronIsolationCHS/electrons
+  set OutputArray electrons
+
+  # set EfficiencyFormula {efficiency formula as a function of eta and pt}
+  # efficiency formula for electrons
+  set EfficiencyFormula {
+                                      (pt <= 4.0)  * (0.00) + \
+                         (abs(eta) <= 1.45 ) * (pt >  4.0 && pt <= 6.0)   * (0.50) + \
+                         (abs(eta) <= 1.45 ) * (pt >  6.0 && pt <= 8.0)   * (0.70) + \
+                         (abs(eta) <= 1.45 ) * (pt >  8.0 && pt <= 10.0)  * (0.85) + \
+                         (abs(eta) <= 1.45 ) * (pt > 10.0 && pt <= 30.0)  * (0.94) + \
+                         (abs(eta) <= 1.45 ) * (pt > 30.0 && pt <= 50.0)  * (0.97) + \
+                         (abs(eta) <= 1.45 ) * (pt > 50.0 && pt <= 70.0)  * (0.98) + \
+                         (abs(eta) <= 1.45 ) * (pt > 70.0 )  * (1.0) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt >  4.0 && pt <= 10.0)   * (0.35) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 10.0 && pt <= 30.0)   * (0.40) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 30.0 && pt <= 70.0)   * (0.45) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 70.0 )  * (0.55) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt >  4.0 && pt <= 10.0)  * (0.75) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 10.0 && pt <= 30.0)  * (0.85) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 30.0 && pt <= 50.0)  * (0.95) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 50.0 && pt <= 70.0)  * (0.95) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 70.0 )  * (1.0) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt >  4.0 && pt <= 10.0)  * (0.65) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 10.0 && pt <= 30.0)  * (0.75) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 30.0 && pt <= 50.0)  * (0.90) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 50.0 && pt <= 70.0)  * (0.90) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 70.0 )  * (0.90) + \
+                         (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 4.0 && pt <= 10.0) * (0.65) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 10.0 && pt <= 30.0) * (0.75) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 30.0 && pt <= 50.0) * (0.90) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 50.0 && pt <= 70.0) * (0.90) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 70.0 ) * (0.90) + \
+					  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+
 ##################
 # Muon isolation #
@@ -1013,8 +1200,26 @@
 }
 
-
-##################
-# Muon Loose Id  #
-##################
+######################
+# Muon isolation CHS #
+######################
+
+module Isolation MuonIsolationCHS {
+  set CandidateInputArray MuonMomentumSmearing/muons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray muons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+#####################
+# Muon Loose Id     #
+#####################
 
 module Efficiency MuonLooseIdEfficiency {
@@ -1038,4 +1243,28 @@
 }
 
+
+#####################
+# Muon Loose Id CHS #
+#####################
+
+module Efficiency MuonLooseIdEfficiencyCHS {
+    set InputArray MuonIsolationCHS/muons
+    set OutputArray muons
+    # tracking + LooseID efficiency formula for muons
+    source muonLooseId.tcl
+
+}
+
+
+######################
+# Muon Tight Id  CHS #
+######################
+
+module Efficiency MuonTightIdEfficiencyCHS {
+    set InputArray MuonIsolationCHS/muons
+    set OutputArray muons
+    # tracking + TightID efficiency formula for muons
+    source muonTightId.tcl
+}
 
 
@@ -1250,5 +1479,5 @@
 module StatusPidFilter GenParticleFilter {
 
-    set InputArray  Delphes/allParticles
+    set InputArray Delphes/allParticles
     set OutputArray filteredParticles
     set PTMin 5.0
@@ -1278,4 +1507,9 @@
   add Branch MuonLooseIdEfficiency/muons MuonLoose Muon
   add Branch MuonTightIdEfficiency/muons MuonTight Muon
+
+  add Branch PhotonEfficiencyCHS/photons PhotonCHS Photon
+  add Branch ElectronEfficiencyCHS/electrons ElectronCHS Electron
+  add Branch MuonLooseIdEfficiencyCHS/muons MuonLooseCHS Muon
+  add Branch MuonTightIdEfficiencyCHS/muons MuonTightCHS Muon
 
   add Branch JetEnergyScale/jets Jet Jet
@@ -1289,3 +1523,4 @@
   add Branch GenPileUpMissingET/momentum GenPileUpMissingET MissingET
   add Branch ScalarHT/energy ScalarHT ScalarHT
-}
+
+}
Index: cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_200PU.tcl
===================================================================
--- cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_200PU.tcl	(revision 20ca0cd9f4c77e04149db66434b1a6f0bb59334c)
+++ cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_200PU.tcl	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -33,10 +33,14 @@
   PhotonEnergySmearing
   ElectronFilter
+
   TrackPileUpSubtractor
+  RecoPuFilter
 
   TowerMerger
   NeutralEFlowMerger
-  EFlowMergerAllTracks
+
   EFlowMerger
+  EFlowMergerCHS
+  Rho
 
   LeptonFilterNoLep
@@ -48,12 +52,22 @@
 
   PhotonIsolation
+  PhotonIsolationCHS
   PhotonEfficiency
+  PhotonEfficiencyCHS
 
   ElectronIsolation
+  ElectronIsolationCHS
+
   ElectronEfficiency
+  ElectronEfficiencyCHS
 
   MuonIsolation
+  MuonIsolationCHS
+
   MuonLooseIdEfficiency
   MuonTightIdEfficiency
+
+  MuonLooseIdEfficiencyCHS
+  MuonTightIdEfficiencyCHS
 
   NeutrinoFilter
@@ -68,4 +82,6 @@
   FastJetFinder
   FastJetFinderAK8
+  JetPileUpSubtractor
+  JetPileUpSubtractorAK8
   FastJetFinderPUPPI
   FastJetFinderPUPPIAK8
@@ -126,5 +142,5 @@
   set TVertexSpread 800E-12
 
-  # vertex smearing formula f(z,t) (z,t need to be respectively given in m,s)
+  # vertex smearing formula f(z,t) (z,t need to be respectively given in m,s) - {exp(-(t^2/160e-12^2/2))*exp(-(z^2/0.053^2/2))}
   set VertexDistributionFormula {exp(-(t^2/160e-12^2/2))*exp(-(z^2/0.053^2/2))}
 
@@ -138,4 +154,5 @@
 module ParticlePropagator ParticlePropagator {
   set InputArray PileUpMerger/stableParticles
+  #set InputArray Delphes/stableParticles
 
   set OutputArray stableParticles
@@ -272,7 +289,4 @@
   source muonMomentumResolution.tcl
 }
-
-
-
 
 ##############
@@ -526,4 +540,12 @@
 }
 
+########################
+# Reco PU filter
+########################
+
+module RecoPuFilter RecoPuFilter {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracks
+}
 
 ###################################################
@@ -538,5 +560,4 @@
 }
 
-
 ####################
 # Neutral eflow erger
@@ -550,8 +571,7 @@
 }
 
-
-####################
+#####################
 # Energy flow merger
-####################
+#####################
 
 module Merger EFlowMerger {
@@ -563,11 +583,11 @@
 }
 
-##################################
-# Energy flow merger (all tracks)
-##################################
-
-module Merger EFlowMergerAllTracks {
+############################
+# Energy flow merger no PU
+############################
+
+module Merger EFlowMergerCHS {
 # add InputArray InputArray
-  add InputArray TrackMerger/tracks
+  add InputArray RecoPuFilter/eflowTracks
   add InputArray PhotonEnergySmearing/eflowPhotons
   add InputArray HCal/eflowNeutralHadrons
@@ -694,5 +714,4 @@
 }
 
-
 #####################
 # MC truth jet finder
@@ -735,14 +754,44 @@
 
 
-
-############
+#############
+# Rho pile-up
+#############
+
+module FastJetFinder Rho {
+#  set InputArray Calorimeter/towers
+  set InputArray EFlowMergerCHS/eflow
+
+  set ComputeRho true
+  set RhoOutputArray rho
+
+  # area algorithm: 0 Do not compute area, 1 Active area explicit ghosts, 2 One ghost passive area, 3 Passive area, 4 Voronoi, 5 Active area
+  set AreaAlgorithm 5
+
+  # jet algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 4
+  set ParameterR 0.4
+  set GhostEtaMax 5.0
+
+  add RhoEtaRange -5.0 -4.0
+  add RhoEtaRange -4.0 -1.5
+  add RhoEtaRange -1.5 1.5
+  add RhoEtaRange 1.5 4.0
+  add RhoEtaRange 4.0 5.0
+
+  set JetPTMin 0.0
+}
+
+
+##############
 # Jet finder
-############
+##############
 
 module FastJetFinder FastJetFinder {
 #  set InputArray TowerMerger/towers
-  set InputArray EFlowMerger/eflow
+  set InputArray EFlowMergerCHS/eflow
 
   set OutputArray jets
+
+  set AreaAlgorithm 5
 
   # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
@@ -756,7 +805,9 @@
 module FastJetFinder FastJetFinderAK8 {
 #  set InputArray TowerMerger/towers
-  set InputArray EFlowMerger/eflow
+  set InputArray EFlowMergerCHS/eflow
 
   set OutputArray jets
+
+  set AreaAlgorithm 5
 
   # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
@@ -785,4 +836,30 @@
 }
 
+###########################
+# Jet Pile-Up Subtraction
+###########################
+
+module JetPileUpSubtractor JetPileUpSubtractor {
+  set JetInputArray FastJetFinder/jets
+  set RhoInputArray Rho/rho
+
+  set OutputArray jets
+
+  set JetPTMin 15.0
+}
+
+##############################
+# Jet Pile-Up Subtraction AK8
+##############################
+
+module JetPileUpSubtractor JetPileUpSubtractorAK8 {
+  set JetInputArray FastJetFinderAK8/jets
+  set RhoInputArray Rho/rho
+
+  set OutputArray jets
+
+  set JetPTMin 15.0
+}
+
 module FastJetFinder FastJetFinderPUPPI {
 #  set InputArray TowerMerger/towers
@@ -834,5 +911,5 @@
 
 module EnergyScale JetEnergyScale {
-  set InputArray FastJetFinder/jets
+  set InputArray JetPileUpSubtractor/jets
   set OutputArray jets
 
@@ -842,5 +919,5 @@
 
 module EnergyScale JetEnergyScaleAK8 {
-  set InputArray FastJetFinderAK8/jets
+  set InputArray JetPileUpSubtractorAK8/jets
   set OutputArray jets
 
@@ -908,4 +985,30 @@
 }
 
+
+########################
+# Photon isolation CHS #
+########################
+
+module Isolation PhotonIsolationCHS {
+
+  # particle for which calculate the isolation
+  set CandidateInputArray PhotonFilter/photons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  # output array
+  set OutputArray photons
+
+  # isolation cone
+  set DeltaRMax 0.3
+
+  # minimum pT
+  set PTMin     1.0
+
+  # iso ratio to cut
+  set PTRatioMax 9999.
+
+}
 
 
@@ -930,4 +1033,23 @@
 
 
+#####################
+# Photon efficiency #
+#####################
+
+module Efficiency PhotonEfficiencyCHS {
+
+  ## input particles
+  set InputArray PhotonIsolationCHS/photons
+  ## output particles
+  set OutputArray photons
+  # set EfficiencyFormula {efficiency formula as a function of eta and pt}
+  # efficiency formula for photons
+  set EfficiencyFormula {                      (pt <= 10.0) * (0.00) + \
+	                   (abs(eta) <= 1.5) * (pt > 10.0)  * (0.9635) + \
+	 (abs(eta) > 1.5 && abs(eta) <= 4.0) * (pt > 10.0)  * (0.9624) + \
+	 (abs(eta) > 4.0)                                   * (0.00)}
+
+}
+
 ######################
 # Electron isolation #
@@ -950,4 +1072,23 @@
 }
 
+
+##########################
+# Electron isolation CHS #
+##########################
+
+module Isolation ElectronIsolationCHS {
+
+  set CandidateInputArray ElectronFilter/electrons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray electrons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
 
 
@@ -996,4 +1137,49 @@
 }
 
+###########################
+# Electron efficiency CHS #
+###########################
+
+module Efficiency ElectronEfficiencyCHS {
+
+  set InputArray ElectronIsolationCHS/electrons
+  set OutputArray electrons
+
+  # set EfficiencyFormula {efficiency formula as a function of eta and pt}
+  # efficiency formula for electrons
+  set EfficiencyFormula {
+                                      (pt <= 4.0)  * (0.00) + \
+                         (abs(eta) <= 1.45 ) * (pt >  4.0 && pt <= 6.0)   * (0.50) + \
+                         (abs(eta) <= 1.45 ) * (pt >  6.0 && pt <= 8.0)   * (0.70) + \
+                         (abs(eta) <= 1.45 ) * (pt >  8.0 && pt <= 10.0)  * (0.85) + \
+                         (abs(eta) <= 1.45 ) * (pt > 10.0 && pt <= 30.0)  * (0.94) + \
+                         (abs(eta) <= 1.45 ) * (pt > 30.0 && pt <= 50.0)  * (0.97) + \
+                         (abs(eta) <= 1.45 ) * (pt > 50.0 && pt <= 70.0)  * (0.98) + \
+                         (abs(eta) <= 1.45 ) * (pt > 70.0 )  * (1.0) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt >  4.0 && pt <= 10.0)   * (0.35) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 10.0 && pt <= 30.0)   * (0.40) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 30.0 && pt <= 70.0)   * (0.45) + \
+                         (abs(eta) > 1.45  && abs(eta) <= 1.55) * (pt > 70.0 )  * (0.55) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt >  4.0 && pt <= 10.0)  * (0.75) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 10.0 && pt <= 30.0)  * (0.85) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 30.0 && pt <= 50.0)  * (0.95) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 50.0 && pt <= 70.0)  * (0.95) + \
+                         (abs(eta) >= 1.55 && abs(eta) <= 2.0 ) * (pt > 70.0 )  * (1.0) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt >  4.0 && pt <= 10.0)  * (0.65) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 10.0 && pt <= 30.0)  * (0.75) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 30.0 && pt <= 50.0)  * (0.90) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 50.0 && pt <= 70.0)  * (0.90) + \
+                         (abs(eta) >= 2.0 && abs(eta) <= 2.5 ) * (pt > 70.0 )  * (0.90) + \
+                         (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 4.0 && pt <= 10.0) * (0.65) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 10.0 && pt <= 30.0) * (0.75) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 30.0 && pt <= 50.0) * (0.90) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 50.0 && pt <= 70.0) * (0.90) + \
+					  (abs(eta) > 2.5 && abs(eta) <= 4.0 ) * (pt > 70.0 ) * (0.90) + \
+					  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+
 ##################
 # Muon isolation #
@@ -1014,8 +1200,26 @@
 }
 
-
-##################
-# Muon Loose Id  #
-##################
+######################
+# Muon isolation CHS #
+######################
+
+module Isolation MuonIsolationCHS {
+  set CandidateInputArray MuonMomentumSmearing/muons
+
+  # isolation collection
+  set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray muons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+#####################
+# Muon Loose Id     #
+#####################
 
 module Efficiency MuonLooseIdEfficiency {
@@ -1039,4 +1243,28 @@
 }
 
+
+#####################
+# Muon Loose Id CHS #
+#####################
+
+module Efficiency MuonLooseIdEfficiencyCHS {
+    set InputArray MuonIsolationCHS/muons
+    set OutputArray muons
+    # tracking + LooseID efficiency formula for muons
+    source muonLooseId.tcl
+
+}
+
+
+######################
+# Muon Tight Id  CHS #
+######################
+
+module Efficiency MuonTightIdEfficiencyCHS {
+    set InputArray MuonIsolationCHS/muons
+    set OutputArray muons
+    # tracking + TightID efficiency formula for muons
+    source muonTightId.tcl
+}
 
 
@@ -1251,5 +1479,5 @@
 module StatusPidFilter GenParticleFilter {
 
-    set InputArray  Delphes/allParticles
+    set InputArray Delphes/allParticles
     set OutputArray filteredParticles
     set PTMin 5.0
@@ -1279,4 +1507,9 @@
   add Branch MuonLooseIdEfficiency/muons MuonLoose Muon
   add Branch MuonTightIdEfficiency/muons MuonTight Muon
+
+  add Branch PhotonEfficiencyCHS/photons PhotonCHS Photon
+  add Branch ElectronEfficiencyCHS/electrons ElectronCHS Electron
+  add Branch MuonLooseIdEfficiencyCHS/muons MuonLooseCHS Muon
+  add Branch MuonTightIdEfficiencyCHS/muons MuonTightCHS Muon
 
   add Branch JetEnergyScale/jets Jet Jet
@@ -1290,3 +1523,4 @@
   add Branch GenPileUpMissingET/momentum GenPileUpMissingET MissingET
   add Branch ScalarHT/energy ScalarHT ScalarHT
-}
+
+}
Index: modules/ModulesLinkDef.h
===================================================================
--- modules/ModulesLinkDef.h	(revision 20ca0cd9f4c77e04149db66434b1a6f0bb59334c)
+++ modules/ModulesLinkDef.h	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -58,4 +58,5 @@
 #include "modules/StatusPidFilter.h"
 #include "modules/PdgCodeFilter.h"
+#include "modules/RecoPuFilter.h"
 #include "modules/Cloner.h"
 #include "modules/Weighter.h"
@@ -103,4 +104,5 @@
 #pragma link C++ class StatusPidFilter+;
 #pragma link C++ class PdgCodeFilter+;
+#pragma link C++ class RecoPuFilter+;
 #pragma link C++ class Cloner+;
 #pragma link C++ class Weighter+;
Index: modules/PhotonConversions.cc
===================================================================
--- modules/PhotonConversions.cc	(revision 20ca0cd9f4c77e04149db66434b1a6f0bb59334c)
+++ modules/PhotonConversions.cc	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -59,5 +59,5 @@
   fItInputArray(0), fConversionMap(0), fDecayXsec(0)
 {
-  fDecayXsec = new TF1;
+  fDecayXsec = new TF1("decayXsec","1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0);
   fConversionMap = new DelphesCylindricalFormula;
 }
@@ -84,11 +84,4 @@
 
   fConversionMap->Compile(GetString("ConversionMap", "0.0"));
-
-#if  ROOT_VERSION_CODE < ROOT_VERSION(6,04,00)
-  fDecayXsec->Compile("1.0 - 4.0/3.0 * x * (1.0 - x)");
-#else
-  fDecayXsec->GetFormula()->Compile("1.0 - 4.0/3.0 * x * (1.0 - x)");
-#endif
-  fDecayXsec->SetRange(0.0, 1.0);
 
   // import array with output from filter/classifier module
Index: modules/RecoPuFilter.cc
===================================================================
--- modules/RecoPuFilter.cc	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
+++ modules/RecoPuFilter.cc	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -0,0 +1,105 @@
+/*
+ *  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/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;
+
+//------------------------------------------------------------------------------
+
+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 9327245d785a4ef91b765fc95fbe4db77a55505d)
+++ modules/RecoPuFilter.h	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -0,0 +1,61 @@
+/*
+ *  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: readers/DelphesCMSFWLite.cpp
===================================================================
--- readers/DelphesCMSFWLite.cpp	(revision 20ca0cd9f4c77e04149db66434b1a6f0bb59334c)
+++ readers/DelphesCMSFWLite.cpp	(revision 9327245d785a4ef91b765fc95fbe4db77a55505d)
@@ -65,11 +65,11 @@
   ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt,
   DelphesFactory *factory, TObjArray *allParticleOutputArray,
-  TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
+  TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent)
 {
+
   fwlite::Handle< GenEventInfoProduct > handleGenEventInfo;
-
   fwlite::Handle< LHEEventProduct > handleLHEEvent;
-
   fwlite::Handle< vector< reco::GenParticle > > handleParticle;
+
   vector< reco::GenParticle >::const_iterator itParticle;
 
@@ -78,6 +78,33 @@
 
   handleGenEventInfo.getByLabel(event, "generator");
-  handleLHEEvent.getByLabel(event, "externalLHEProducer");
-  handleParticle.getByLabel(event, "genParticles");
+
+  if (!((handleLHEEvent.getBranchNameFor(event, "source")).empty()))
+  { 
+    handleLHEEvent.getByLabel(event, "source");
+  }
+  else if (!((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty()))
+  {
+    handleLHEEvent.getByLabel(event, "externalLHEProducer");
+  }
+  else if (firstEvent)
+  {
+    std::cout<<"Wrong LHEEvent Label! Please, check the input file."<<std::endl;
+  }
+
+  if (!((handleParticle.getBranchNameFor(event, "genParticles")).empty()))
+  {
+    handleParticle.getByLabel(event, "genParticles");
+  }
+  else if (!((handleParticle.getBranchNameFor(event, "prunedGenParticles")).empty()))
+  {
+    handleParticle.getByLabel(event, "prunedGenParticles");
+  }
+  else
+  {
+    std::cout<<"Wrong GenParticle Label! Please, check the input file."<<std::endl;
+    exit(-1);
+  }
+
+  Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty());
 
   HepMCEvent *element;
@@ -91,7 +118,4 @@
   Double_t px, py, pz, e, mass;
   Double_t x, y, z;
-
-  const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
-  vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
 
   element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
@@ -117,8 +141,15 @@
   element->ProcTime = 0.0;
 
-  for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo)
-  {
-    weight = static_cast<Weight *>(branchRwgt->NewEntry());
-    weight->Weight = itWeightsInfo->wgt;
+
+  if(foundLHE)
+  {
+    const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
+    vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
+    
+    for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo)
+    {
+      weight = static_cast<Weight *>(branchRwgt->NewEntry());
+      weight->Weight = itWeightsInfo->wgt;
+    }  
   }
 
@@ -207,4 +238,5 @@
   Int_t i;
   Long64_t eventCounter, numberOfEvents;
+  Bool_t firstEvent = kTRUE;
 
   if(argc < 4)
@@ -281,9 +313,12 @@
       modularDelphes->Clear();
       treeWriter->Clear();
+
       for(event.toBegin(); !event.atEnd() && !interrupted; ++event)
       {
         ConvertInput(event, eventCounter, branchEvent, branchRwgt, factory,
-          allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
+          allParticleOutputArray, stableParticleOutputArray, partonOutputArray, firstEvent);
         modularDelphes->ProcessTask();
+          
+        firstEvent = kFALSE;
 
         treeWriter->Fill();
