Index: cards/delphes_card_IDEA.tcl
===================================================================
--- cards/delphes_card_IDEA.tcl	(revision eee976c2c300b87d9689631955181f583f197f05)
+++ cards/delphes_card_IDEA.tcl	(revision f17e10d243be74f5cde1ffb12456e8afc7a02224)
@@ -1,11 +1,11 @@
 ####################################################################                                l
-# FCC-ee IDEA detector model                                                                                      
-#                                                                                                    
-# Authors: Elisa Fontanesi, Lorenzo Pezzotti, Massimiliano Antonello                                 
+# FCC-ee IDEA detector model
+#
+# Authors: Elisa Fontanesi, Lorenzo Pezzotti, Massimiliano Antonello
 # email: efontane@bo.infn.it,
-#        lorenzo.pezzotti01@universitadipavia.it,                                                    
-#        m.antonello@uninsubria.it,                                                                  
-#####################################################################                                
-#       
+#        lorenzo.pezzotti01@universitadipavia.it,
+#        m.antonello@uninsubria.it,
+#####################################################################
+#
 #######################################
 # Order of execution of various modules
@@ -19,9 +19,8 @@
   MuonTrackingEfficiency
 
-  ChargedHadronMomentumSmearing
-  ElectronMomentumSmearing
-  MuonMomentumSmearing
-
-  TrackMerger 
+  TrackMergerPre
+  TrackSmearing
+
+  TrackMerger
   Calorimeter
   EFlowMerger
@@ -34,4 +33,5 @@
   ElectronIsolation
 
+  MuonFilter
   MuonEfficiency
   MuonIsolation
@@ -42,5 +42,5 @@
   GenJetFinder
   GenMissingET
-  
+
   FastJetFinder
 
@@ -98,5 +98,5 @@
 }
 
-#	(pt <= 0.1)                                     * (0.00) + 
+#	(pt <= 0.1)                                     * (0.00) +
 #	(abs(eta) <= 3.0)               * (pt > 0.1)    * (1.00) +
 #	(abs(eta) > 3)                                  * (0.00)
@@ -119,5 +119,5 @@
         (energy < 0.5 && energy >= 0.3) * (abs(eta) <= 3.0)    * (0.65) +
         (energy < 0.3) * (abs(eta) <= 3.0)                     * (0.06)
-    } 
+    }
 }
 
@@ -140,67 +140,218 @@
 }
 
-
-########################################
-# Momentum resolution for charged tracks
-########################################
-
-module MomentumSmearing ChargedHadronMomentumSmearing {
-    set InputArray ChargedHadronTrackingEfficiency/chargedHadrons
-    set OutputArray chargedHadrons
-
-
-    # Resolution given in dpT/pT.
-    # IDEAdet
-    set ResolutionFormula {
-	(abs(eta) <= 3.0)                   * sqrt(0.0001145^2 + 0.0002024^2*pt + (pt*2.093e-005)^2)
-    }
-}
-
-###################################
-# Momentum resolution for electrons
-###################################
-
-module MomentumSmearing ElectronMomentumSmearing {
-    set InputArray ElectronTrackingEfficiency/electrons
-    set OutputArray electrons
-
-    # Resolution given in dpT/pT.
-    # IDEAdet
-    set ResolutionFormula {
-        (abs(eta) <= 3.0)                   * sqrt(0.0001145^2 + 0.0002024^2*pt + (pt*2.093e-005)^2) 
-   }  
-}
-
-###############################
-# Momentum resolution for muons
-###############################
-
-module MomentumSmearing MuonMomentumSmearing {
-    set InputArray MuonTrackingEfficiency/muons
-    set OutputArray muons
-
-    # Resolution given in dpT/pT.
-    # IDEAdet
-    set ResolutionFormula {
-        (abs(eta) <= 3.0)                   * sqrt(0.0001145^2 + 0.0002024^2*pt + (pt*2.093e-005)^2) 
-    }
-}
-
 ##############
 # Track merger
 ##############
 
+module Merger TrackMergerPre {
+# add InputArray InputArray
+  add InputArray ChargedHadronTrackingEfficiency/chargedHadrons
+  add InputArray ElectronTrackingEfficiency/electrons
+  add InputArray MuonTrackingEfficiency/muons
+  set OutputArray tracks
+}
+
+
+########################################
+# Smearing for charged tracks
+########################################
+
+module TrackCovariance TrackSmearing {
+    set InputArray TrackMergerPre/tracks
+    set OutputArray tracks
+
+    set Bz 2.0
+
+    ## minimum number of hits to accept a track
+    set NMinHits 6
+
+    ## uses https://raw.githubusercontent.com/selvaggi/FastTrackCovariance/master/GeoIDEA_BASE.txt
+    set DetectorGeometry {
+
+
+      # Layer type 1 = R (barrel) or 2 = z (forward/backward)
+      # Layer label
+      # Minimum dimension z for barrel or R for forward
+      # Maximum dimension z for barrel or R for forward
+      # R/z location of layer
+      # Thickness (meters)
+      # Radiation length (meters)
+      # Number of measurements in layers (1D or 2D)
+      # Stereo angle (rad) - 0(pi/2) = axial(z) layer - Upper side
+      # Stereo angle (rad) - 0(pi/2) = axial(z) layer - Lower side
+      # Resolution Upper side (meters) - 0 = no measurement
+      # Resolution Lower side (meters) - 0 = no measurement
+      # measurement flag = T, scattering only = F
+
+
+      # barrel  name       zmin   zmax   r        w (m)      X0        n_meas  th_up (rad) th_down (rad)    reso_up (m)   reso_down (m)  flag
+
+      1        PIPE       -100    100    0.015    0.0012    0.35276    0        0          0                0             0              0
+      1        VTXLOW     -0.12   0.12   0.017    0.00028   0.0937     2        0          1.5708           3e-006        3e-006         1
+      1        VTXLOW     -0.16   0.16   0.023    0.00028   0.0937     2        0          1.5708           3e-006        3e-006         1
+      1        VTXLOW     -0.16   0.16   0.031    0.00028   0.0937     2        0          1.5708           3e-006        3e-006         1
+      1        VTXHIGH    -1      1      0.32     0.00047   0.0937     2        0          1.5708           7e-006        7e-006         1
+      1        VTXHIGH    -1.05   1.05   0.34     0.00047   0.0937     2        0          1.5708           7e-006        7e-006         1
+
+      # endcap  name       rmin   rmax   z        w (m)      X0        n_meas   th_up (rad)  th_down (rad)   reso_up (m)   reso_down (m) flag
+
+      2        VTXDSK      0.141  0.3   -0.92     0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.138  0.3   -0.9      0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.065  0.3   -0.42     0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.062  0.3   -0.4      0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.062  0.3    0.4      0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.065  0.3    0.42     0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.138  0.3    0.9      0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+      2        VTXDSK      0.141  0.3    0.92     0.00028   0.0937     2        0          1.5708           7e-006        7e-006         1
+
+      1 DCHCANI -2.125 2.125 0.345 0.0002 0.237223 0 0 0 0 0 0
+      1 DCH -2 2 0.36 0.0147748 1400 1 0.0203738 0 0.0001 0 1
+      1 DCH -2 2 0.374775 0.0147748 1400 1 -0.0212097 0 0.0001 0 1
+      1 DCH -2 2 0.38955 0.0147748 1400 1 0.0220456 0 0.0001 0 1
+      1 DCH -2 2 0.404324 0.0147748 1400 1 -0.0228814 0 0.0001 0 1
+      1 DCH -2 2 0.419099 0.0147748 1400 1 0.0237172 0 0.0001 0 1
+      1 DCH -2 2 0.433874 0.0147748 1400 1 -0.024553 0 0.0001 0 1
+      1 DCH -2 2 0.448649 0.0147748 1400 1 0.0253888 0 0.0001 0 1
+      1 DCH -2 2 0.463423 0.0147748 1400 1 -0.0262245 0 0.0001 0 1
+      1 DCH -2 2 0.478198 0.0147748 1400 1 0.0270602 0 0.0001 0 1
+      1 DCH -2 2 0.492973 0.0147748 1400 1 -0.0278958 0 0.0001 0 1
+      1 DCH -2 2 0.507748 0.0147748 1400 1 0.0287314 0 0.0001 0 1
+      1 DCH -2 2 0.522523 0.0147748 1400 1 -0.029567 0 0.0001 0 1
+      1 DCH -2 2 0.537297 0.0147748 1400 1 0.0304025 0 0.0001 0 1
+      1 DCH -2 2 0.552072 0.0147748 1400 1 -0.031238 0 0.0001 0 1
+      1 DCH -2 2 0.566847 0.0147748 1400 1 0.0320734 0 0.0001 0 1
+      1 DCH -2 2 0.581622 0.0147748 1400 1 -0.0329088 0 0.0001 0 1
+      1 DCH -2 2 0.596396 0.0147748 1400 1 0.0337442 0 0.0001 0 1
+      1 DCH -2 2 0.611171 0.0147748 1400 1 -0.0345795 0 0.0001 0 1
+      1 DCH -2 2 0.625946 0.0147748 1400 1 0.0354147 0 0.0001 0 1
+      1 DCH -2 2 0.640721 0.0147748 1400 1 -0.0362499 0 0.0001 0 1
+      1 DCH -2 2 0.655495 0.0147748 1400 1 0.0370851 0 0.0001 0 1
+      1 DCH -2 2 0.67027 0.0147748 1400 1 -0.0379202 0 0.0001 0 1
+      1 DCH -2 2 0.685045 0.0147748 1400 1 0.0387552 0 0.0001 0 1
+      1 DCH -2 2 0.69982 0.0147748 1400 1 -0.0395902 0 0.0001 0 1
+      1 DCH -2 2 0.714595 0.0147748 1400 1 0.0404252 0 0.0001 0 1
+      1 DCH -2 2 0.729369 0.0147748 1400 1 -0.04126 0 0.0001 0 1
+      1 DCH -2 2 0.744144 0.0147748 1400 1 0.0420949 0 0.0001 0 1
+      1 DCH -2 2 0.758919 0.0147748 1400 1 -0.0429296 0 0.0001 0 1
+      1 DCH -2 2 0.773694 0.0147748 1400 1 0.0437643 0 0.0001 0 1
+      1 DCH -2 2 0.788468 0.0147748 1400 1 -0.044599 0 0.0001 0 1
+      1 DCH -2 2 0.803243 0.0147748 1400 1 0.0454336 0 0.0001 0 1
+      1 DCH -2 2 0.818018 0.0147748 1400 1 -0.0462681 0 0.0001 0 1
+      1 DCH -2 2 0.832793 0.0147748 1400 1 0.0471025 0 0.0001 0 1
+      1 DCH -2 2 0.847568 0.0147748 1400 1 -0.0479369 0 0.0001 0 1
+      1 DCH -2 2 0.862342 0.0147748 1400 1 0.0487713 0 0.0001 0 1
+      1 DCH -2 2 0.877117 0.0147748 1400 1 -0.0496055 0 0.0001 0 1
+      1 DCH -2 2 0.891892 0.0147748 1400 1 0.0504397 0 0.0001 0 1
+      1 DCH -2 2 0.906667 0.0147748 1400 1 -0.0512738 0 0.0001 0 1
+      1 DCH -2 2 0.921441 0.0147748 1400 1 0.0521079 0 0.0001 0 1
+      1 DCH -2 2 0.936216 0.0147748 1400 1 -0.0529418 0 0.0001 0 1
+      1 DCH -2 2 0.950991 0.0147748 1400 1 0.0537757 0 0.0001 0 1
+      1 DCH -2 2 0.965766 0.0147748 1400 1 -0.0546095 0 0.0001 0 1
+      1 DCH -2 2 0.980541 0.0147748 1400 1 0.0554433 0 0.0001 0 1
+      1 DCH -2 2 0.995315 0.0147748 1400 1 -0.056277 0 0.0001 0 1
+      1 DCH -2 2 1.01009 0.0147748 1400 1 0.0571106 0 0.0001 0 1
+      1 DCH -2 2 1.02486 0.0147748 1400 1 -0.0579441 0 0.0001 0 1
+      1 DCH -2 2 1.03964 0.0147748 1400 1 0.0587775 0 0.0001 0 1
+      1 DCH -2 2 1.05441 0.0147748 1400 1 -0.0596108 0 0.0001 0 1
+      1 DCH -2 2 1.06919 0.0147748 1400 1 0.0604441 0 0.0001 0 1
+      1 DCH -2 2 1.08396 0.0147748 1400 1 -0.0612773 0 0.0001 0 1
+      1 DCH -2 2 1.09874 0.0147748 1400 1 0.0621104 0 0.0001 0 1
+      1 DCH -2 2 1.11351 0.0147748 1400 1 -0.0629434 0 0.0001 0 1
+      1 DCH -2 2 1.12829 0.0147748 1400 1 0.0637763 0 0.0001 0 1
+      1 DCH -2 2 1.14306 0.0147748 1400 1 -0.0646092 0 0.0001 0 1
+      1 DCH -2 2 1.15784 0.0147748 1400 1 0.0654419 0 0.0001 0 1
+      1 DCH -2 2 1.17261 0.0147748 1400 1 -0.0662746 0 0.0001 0 1
+      1 DCH -2 2 1.18739 0.0147748 1400 1 0.0671071 0 0.0001 0 1
+      1 DCH -2 2 1.20216 0.0147748 1400 1 -0.0679396 0 0.0001 0 1
+      1 DCH -2 2 1.21694 0.0147748 1400 1 0.068772 0 0.0001 0 1
+      1 DCH -2 2 1.23171 0.0147748 1400 1 -0.0696042 0 0.0001 0 1
+      1 DCH -2 2 1.24649 0.0147748 1400 1 0.0704364 0 0.0001 0 1
+      1 DCH -2 2 1.26126 0.0147748 1400 1 -0.0712685 0 0.0001 0 1
+      1 DCH -2 2 1.27604 0.0147748 1400 1 0.0721005 0 0.0001 0 1
+      1 DCH -2 2 1.29081 0.0147748 1400 1 -0.0729324 0 0.0001 0 1
+      1 DCH -2 2 1.30559 0.0147748 1400 1 0.0737642 0 0.0001 0 1
+      1 DCH -2 2 1.32036 0.0147748 1400 1 -0.0745958 0 0.0001 0 1
+      1 DCH -2 2 1.33514 0.0147748 1400 1 0.0754274 0 0.0001 0 1
+      1 DCH -2 2 1.34991 0.0147748 1400 1 -0.0762589 0 0.0001 0 1
+      1 DCH -2 2 1.36468 0.0147748 1400 1 0.0770903 0 0.0001 0 1
+      1 DCH -2 2 1.37946 0.0147748 1400 1 -0.0779215 0 0.0001 0 1
+      1 DCH -2 2 1.39423 0.0147748 1400 1 0.0787527 0 0.0001 0 1
+      1 DCH -2 2 1.40901 0.0147748 1400 1 -0.0795837 0 0.0001 0 1
+      1 DCH -2 2 1.42378 0.0147748 1400 1 0.0804147 0 0.0001 0 1
+      1 DCH -2 2 1.43856 0.0147748 1400 1 -0.0812455 0 0.0001 0 1
+      1 DCH -2 2 1.45333 0.0147748 1400 1 0.0820762 0 0.0001 0 1
+      1 DCH -2 2 1.46811 0.0147748 1400 1 -0.0829068 0 0.0001 0 1
+      1 DCH -2 2 1.48288 0.0147748 1400 1 0.0837373 0 0.0001 0 1
+      1 DCH -2 2 1.49766 0.0147748 1400 1 -0.0845677 0 0.0001 0 1
+      1 DCH -2 2 1.51243 0.0147748 1400 1 0.0853979 0 0.0001 0 1
+      1 DCH -2 2 1.52721 0.0147748 1400 1 -0.086228 0 0.0001 0 1
+      1 DCH -2 2 1.54198 0.0147748 1400 1 0.087058 0 0.0001 0 1
+      1 DCH -2 2 1.55676 0.0147748 1400 1 -0.0878879 0 0.0001 0 1
+      1 DCH -2 2 1.57153 0.0147748 1400 1 0.0887177 0 0.0001 0 1
+      1 DCH -2 2 1.58631 0.0147748 1400 1 -0.0895474 0 0.0001 0 1
+      1 DCH -2 2 1.60108 0.0147748 1400 1 0.0903769 0 0.0001 0 1
+      1 DCH -2 2 1.61586 0.0147748 1400 1 -0.0912063 0 0.0001 0 1
+      1 DCH -2 2 1.63063 0.0147748 1400 1 0.0920356 0 0.0001 0 1
+      1 DCH -2 2 1.64541 0.0147748 1400 1 -0.0928647 0 0.0001 0 1
+      1 DCH -2 2 1.66018 0.0147748 1400 1 0.0936937 0 0.0001 0 1
+      1 DCH -2 2 1.67495 0.0147748 1400 1 -0.0945226 0 0.0001 0 1
+      1 DCH -2 2 1.68973 0.0147748 1400 1 0.0953514 0 0.0001 0 1
+      1 DCH -2 2 1.7045 0.0147748 1400 1 -0.09618 0 0.0001 0 1
+      1 DCH -2 2 1.71928 0.0147748 1400 1 0.0970085 0 0.0001 0 1
+      1 DCH -2 2 1.73405 0.0147748 1400 1 -0.0978369 0 0.0001 0 1
+      1 DCH -2 2 1.74883 0.0147748 1400 1 0.0986651 0 0.0001 0 1
+      1 DCH -2 2 1.7636 0.0147748 1400 1 -0.0994932 0 0.0001 0 1
+      1 DCH -2 2 1.77838 0.0147748 1400 1 0.100321 0 0.0001 0 1
+      1 DCH -2 2 1.79315 0.0147748 1400 1 -0.101149 0 0.0001 0 1
+      1 DCH -2 2 1.80793 0.0147748 1400 1 0.101977 0 0.0001 0 1
+      1 DCH -2 2 1.8227 0.0147748 1400 1 -0.102804 0 0.0001 0 1
+      1 DCH -2 2 1.83748 0.0147748 1400 1 0.103632 0 0.0001 0 1
+      1 DCH -2 2 1.85225 0.0147748 1400 1 -0.104459 0 0.0001 0 1
+      1 DCH -2 2 1.86703 0.0147748 1400 1 0.105286 0 0.0001 0 1
+      1 DCH -2 2 1.8818 0.0147748 1400 1 -0.106113 0 0.0001 0 1
+      1 DCH -2 2 1.89658 0.0147748 1400 1 0.10694 0 0.0001 0 1
+      1 DCH -2 2 1.91135 0.0147748 1400 1 -0.107766 0 0.0001 0 1
+      1 DCH -2 2 1.92613 0.0147748 1400 1 0.108593 0 0.0001 0 1
+      1 DCH -2 2 1.9409 0.0147748 1400 1 -0.109419 0 0.0001 0 1
+      1 DCH -2 2 1.95568 0.0147748 1400 1 0.110246 0 0.0001 0 1
+      1 DCH -2 2 1.97045 0.0147748 1400 1 -0.111072 0 0.0001 0 1
+      1 DCH -2 2 1.98523 0.0147748 1400 1 0.111898 0 0.0001 0 1
+      1 DCH -2 2 2 0.0147748 1400 1 -0.112723 0 0.0001 0 1
+      1 DCHCANO -2.125 2.125 2.02 0.02 1.667 0 0 0 0 0 0
+      1 BSILWRP -2.35 2.35 2.04 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      1 BSILWRP -2.35 2.35 2.06 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      1 MAG -2.5 2.5 2.25 0.05 0.0658 0 0 0 0 0 0
+      1 BPRESH -2.55 2.55 2.45 0.02 1 2 0 1.5708 7e-005 0.01 1
+
+
+      2 DCHWALL 0.345 2.02 2.125 0.25 5.55 0 0 0 0 0 0
+      2 DCHWALL 0.345 2.02 -2.125 0.25 5.55 0 0 0 0 0 0
+      2 FSILWRP 0.354 2.02 -2.32 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      2 FSILWRP 0.35 2.02 -2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      2 FSILWRP 0.35 2.02 2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      2 FSILWRP 0.354 2.02 2.32 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1
+      2 FRAD 0.38 2.09 2.49 0.0043 0.005612 0 0 0 0 0 0
+      2 FRAD 0.38 2.09 -2.49 0.0043 0.005612 0 0 0 0 0 0
+      2 FPRESH 0.39 2.43 -2.55 0.02 1 2 0 1.5708 7e-005 0.01 1
+      2 FPRESH 0.39 2.43 2.55 0.02 1 2 0 1.5708 7e-005 0.01 1
+    }
+
+}
+
+
+##############
+# Track merger
+##############
+
 module Merger TrackMerger {
 # add InputArray InputArray
-  add InputArray ChargedHadronMomentumSmearing/chargedHadrons
-  add InputArray ElectronMomentumSmearing/electrons
-  add InputArray MuonMomentumSmearing/muons
+  add InputArray TrackSmearing/tracks
   set OutputArray tracks
 }
 
 
-#############                                                                                                                         
-# Calorimeter                                                                                                                                            
-#############                                                                                                                                           
+#############
+# Calorimeter
+#############
 module DualReadoutCalorimeter Calorimeter {
   set ParticleInputArray ParticlePropagator/stableParticles
@@ -224,17 +375,17 @@
     set pi [expr {acos(-1)}]
 
-    # Lists of the edges of each tower in eta and phi;                                                                                            
-    # each list starts with the lower edge of the first tower;                                                                                                    
-    # the list ends with the higher edged of the last tower.                                                                                        
-    # Barrel:  deta=0.02 towers up to |eta| <= 0.88 ( up to 45Â°)                                                                                        
-    # Endcaps: deta=0.02 towers up to |eta| <= 3.0 (8.6Â° = 100 mrad)                                                                                           
-    # Cell size: about 6 cm x 6 cm                                                  
-
-    #barrel:                                                                                        
+    # Lists of the edges of each tower in eta and phi;
+    # each list starts with the lower edge of the first tower;
+    # the list ends with the higher edged of the last tower.
+    # Barrel:  deta=0.02 towers up to |eta| <= 0.88 ( up to 45Â°)
+    # Endcaps: deta=0.02 towers up to |eta| <= 3.0 (8.6Â° = 100 mrad)
+    # Cell size: about 6 cm x 6 cm
+
+    #barrel:
     set PhiBins {}
     for {set i -120} {$i <= 120} {incr i} {
         add PhiBins [expr {$i * $pi/120}]
     }
-    #deta=0.02 units for |eta| <= 0.88                                                              
+    #deta=0.02 units for |eta| <= 0.88
     for {set i -44} {$i < 45} {incr i} {
         set eta [expr {$i * 0.02}]
@@ -242,16 +393,16 @@
     }
 
-    #endcaps:                                                                                       
+    #endcaps:
     set PhiBins {}
     for {set i -120} {$i <= 120} {incr i} {
         add PhiBins [expr {$i* $pi/120}]
     }
-    #deta=0.02 units for 0.88 < |eta| <= 3.0                                                        
-    #first, from -3.0 to -0.88                                                                      
+    #deta=0.02 units for 0.88 < |eta| <= 3.0
+    #first, from -3.0 to -0.88
     for {set i 1} {$i <=106} {incr i} {
         set eta [expr {-3.00 + $i * 0.02}]
         add EtaPhiBins $eta $PhiBins
     }
-    #same for 0.88 to 3.0                                                                           
+    #same for 0.88 to 3.0
     for  {set i 1} {$i <=106} {incr i} {
         set eta [expr {0.88 + $i * 0.02}]
@@ -259,11 +410,11 @@
     }
 
-    # default energy fractions {abs(PDG code)} {Fecal Fhcal}                                                                                  
+    # default energy fractions {abs(PDG code)} {Fecal Fhcal}
     add EnergyFraction {0} {0.0 1.0}
-    # energy fractions for e, gamma and pi0                                                                                                           
+    # energy fractions for e, gamma and pi0
     add EnergyFraction {11} {1.0 0.0}
     add EnergyFraction {22} {1.0 0.0}
     add EnergyFraction {111} {1.0 0.0}
-    # energy fractions for muon, neutrinos and neutralinos                                                                             
+    # energy fractions for muon, neutrinos and neutralinos
     add EnergyFraction {12} {0.0 0.0}
     add EnergyFraction {13} {0.0 0.0}
@@ -275,10 +426,10 @@
     add EnergyFraction {1000035} {0.0 0.0}
     add EnergyFraction {1000045} {0.0 0.0}
-    # energy fractions for K0short and Lambda                                                                                                            
+    # energy fractions for K0short and Lambda
     add EnergyFraction {310} {0.3 0.7}
     add EnergyFraction {3122} {0.3 0.7}
 
 
-    # set ECalResolutionFormula {resolution formula as a function of eta and energy}                                
+    # set ECalResolutionFormula {resolution formula as a function of eta and energy}
     set ECalResolutionFormula {
     (abs(eta) <= 0.88 )                     * sqrt(energy^2*0.01^2 + energy*0.11^2)+
@@ -286,5 +437,5 @@
     }
 
-    # set HCalResolutionFormula {resolution formula as a function of eta and energy}                                                
+    # set HCalResolutionFormula {resolution formula as a function of eta and energy}
     set HCalResolutionFormula {
     (abs(eta) <= 0.88 )                     * sqrt(energy^2*0.01^2 + energy*0.30^2)+
@@ -352,4 +503,18 @@
 }
 
+
+#################
+# Muon filter
+#################
+
+module PdgCodeFilter MuonFilter {
+  set InputArray Calorimeter/eflowTracks
+  set OutputArray muons
+  set Invert true
+  add PdgCode {13}
+  add PdgCode {-13}
+}
+
+
 #####################
 # Electron efficiency
@@ -363,5 +528,5 @@
 
   # efficiency formula for electrons
-  set EfficiencyFormula {          
+  set EfficiencyFormula {
         (energy < 2.0)                                         * (0.000)+
         (energy >= 2.0) * (abs(eta) <= 0.88)                   * (0.99) +
@@ -388,4 +553,5 @@
 }
 
+
 #################
 # Muon efficiency
@@ -393,5 +559,5 @@
 
 module Efficiency MuonEfficiency {
-  set InputArray MuonMomentumSmearing/muons
+  set InputArray MuonFilter/muons
   set OutputArray muons
 
@@ -399,5 +565,5 @@
 
   # efficiency formula for muons
-  set EfficiencyFormula {                                   
+  set EfficiencyFormula {
         (energy < 2.0)                                         * (0.000)+
         (energy >= 2.0) * (abs(eta) <= 0.88)                   * (0.99) +
@@ -547,5 +713,5 @@
 
   # add EfficiencyFormula {abs(PDG code)} {efficiency formula as a function of eta and pt}
-  
+
   # default efficiency formula (misidentification rate)
   add EfficiencyFormula {0} {0.01}
@@ -603,10 +769,10 @@
 module TreeWriter TreeWriter {
     # add Branch InputArray BranchName BranchClass
-    
+
     add Branch Delphes/allParticles Particle GenParticle
 
     add Branch TrackMerger/tracks Track Track
     add Branch Calorimeter/towers Tower Tower
-    
+
     add Branch Calorimeter/eflowTracks EFlowTrack Track
     add Branch Calorimeter/eflowPhotons EFlowPhoton Tower
@@ -616,17 +782,16 @@
     add Branch PhotonEfficiency/photons PhotonEff Photon
     add Branch PhotonIsolation/photons PhotonIso Photon
-    
+
     add Branch GenJetFinder/jets GenJet Jet
     add Branch GenMissingET/momentum GenMissingET MissingET
-    
+
     add Branch UniqueObjectFinder/jets Jet Jet
     add Branch UniqueObjectFinder/electrons Electron Electron
     add Branch UniqueObjectFinder/photons Photon Photon
     add Branch UniqueObjectFinder/muons Muon Muon
-    
-    add Branch JetEnergyScale/jets AntiKtJet Jet  
-    
+
+    add Branch JetEnergyScale/jets AntiKtJet Jet
+
     add Branch MissingET/momentum MissingET MissingET
     add Branch ScalarHT/energy ScalarHT ScalarHT
 }
-
