Index: cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl
===================================================================
--- cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl	(revision ba65969e652e2cc13ff9d997ae84a00322d369d8)
+++ cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_0PU.tcl	(revision ba65969e652e2cc13ff9d997ae84a00322d369d8)
@@ -0,0 +1,1307 @@
+#
+#  Phase II - No Pile-Up
+#
+#  Main authors: Michele Selvaggi (UCL)
+#
+#  Released on:
+#
+#  Version: v01
+#
+#
+#######################################
+# Order of execution of various modules
+#######################################
+
+set ExecutionPath {
+
+  PileUpMerger
+  ParticlePropagator
+
+  ChargedHadronTrackingEfficiency
+  ElectronTrackingEfficiency
+  MuonTrackingEfficiency
+
+  ChargedHadronMomentumSmearing
+  ElectronEnergySmearing
+  MuonMomentumSmearing
+
+  TrackMerger
+
+  ECal
+  HCal
+
+  PhotonEnergySmearing
+  ElectronFilter
+  TrackPileUpSubtractor
+
+  TowerMerger
+  NeutralEFlowMerger
+  EFlowMergerAllTracks
+  EFlowMerger
+
+  LeptonFilterNoLep
+  LeptonFilterLep
+  RunPUPPIBase
+  RunPUPPI
+
+  PhotonFilter
+
+  PhotonIsolation
+  PhotonEfficiency
+
+  ElectronIsolation
+  ElectronEfficiency
+
+  MuonIsolation
+  MuonLooseIdEfficiency
+  MuonTightIdEfficiency
+
+  NeutrinoFilter
+
+  MissingET
+  PuppiMissingET
+  GenMissingET
+  GenPileUpMissingET
+
+  GenJetFinder
+  GenJetFinderAK8
+  FastJetFinder
+  FastJetFinderAK8
+  FastJetFinderPUPPI
+  FastJetFinderPUPPIAK8
+
+  ScalarHT
+
+  JetEnergyScale
+  JetEnergyScaleAK8
+  JetEnergyScalePUPPI
+  JetEnergyScalePUPPIAK8
+
+  JetFlavorAssociation
+  JetFlavorAssociationAK8
+  JetFlavorAssociationPUPPI
+  JetFlavorAssociationPUPPIAK8
+
+  BTaggingLoose
+  BTaggingMedium
+  BTaggingTight
+  BTaggingLooseAK8
+  BTaggingMediumAK8
+  BTaggingTightAK8
+  BTaggingLoosePUPPI
+  BTaggingMediumPUPPI
+  BTaggingTightPUPPI
+  BTaggingLoosePUPPIAK8
+  BTaggingMediumPUPPIAK8
+  BTaggingTightPUPPIAK8
+
+  TauTagging
+
+  GenParticleFilter
+
+  TreeWriter
+}
+
+###############
+# PileUp Merger
+###############
+
+module PileUpMerger PileUpMerger {
+  set InputArray Delphes/stableParticles
+
+  set ParticleOutputArray stableParticles
+  set VertexOutputArray vertices
+
+  # pre-generated minbias input file
+  set PileUpFile ../eos/cms/store/group/upgrade/delphes/PhaseII/MinBias_100k.pileup
+  #set PileUpFile MinBias.pileup
+
+  # average expected pile up
+  set MeanPileUp 0
+
+  # maximum spread in the beam direction in m
+  set ZVertexSpread 0
+
+  # maximum spread in time in s
+  set TVertexSpread 0
+
+  # 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
+
+}
+
+
+#################################
+# Propagate particles in cylinder
+#################################
+
+module ParticlePropagator ParticlePropagator {
+  #set InputArray PileUpMerger/stableParticles
+  set InputArray Delphes/stableParticles
+
+  set OutputArray stableParticles
+  set ChargedHadronOutputArray chargedHadrons
+  set ElectronOutputArray electrons
+  set MuonOutputArray muons
+
+  # radius of the magnetic field coverage, in m
+  set Radius 1.29
+  # half-length of the magnetic field coverage, in m
+  set HalfLength 3.0
+
+  # magnetic field
+  set Bz 3.8
+}
+
+
+####################################
+# Charged hadron tracking efficiency
+####################################
+
+module Efficiency ChargedHadronTrackingEfficiency {
+  ## particles after propagation
+  set InputArray  ParticlePropagator/chargedHadrons
+  set OutputArray chargedHadrons
+  # tracking efficiency formula for charged hadrons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 0.96) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (0.97) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 0.2 && pt <= 1.0) * (pt*0.85) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 1.0) * (0.87) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.8) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 1.0) * (0.82) + \
+	  (abs(eta) > 4.0) * (0.00)
+  }
+}
+
+
+#####################################
+# Electron tracking efficiency - ID
+####################################
+
+module Efficiency ElectronTrackingEfficiency {
+  set InputArray  ParticlePropagator/electrons
+  set OutputArray electrons
+  # tracking efficiency formula for electrons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 0.96) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (0.97) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 0.2 && pt <= 1.0) * (pt*0.85) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 1.0 && pt <= 10.0) * (0.82+pt*0.01) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 10.0) * (0.90) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.8) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 1.0 && pt <= 10.0) * (0.8+pt*0.01) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 10.0) * (0.85) + \
+	  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+##########################
+# Muon tracking efficiency
+##########################
+
+module Efficiency MuonTrackingEfficiency {
+  set InputArray ParticlePropagator/muons
+  set OutputArray muons
+  # tracking efficiency formula for muons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 1.00) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (1.00) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.8) * (pt > 0.2 && pt <= 1.0) * (pt*1.00) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.8) * (pt > 1.0) * (1.00) + \
+	  (abs(eta) > 2.8 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.95) + \
+	  (abs(eta) > 2.8 && abs(eta) <= 4.0) * (pt > 1.0) * (0.95) + \
+	  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+
+########################################
+# Momentum resolution for charged tracks
+########################################
+
+module MomentumSmearing ChargedHadronMomentumSmearing {
+  ## hadrons after having applied the tracking efficiency
+  set InputArray  ChargedHadronTrackingEfficiency/chargedHadrons
+  set OutputArray chargedHadrons
+  # resolution formula for charged hadrons ,
+
+  # from http://mersi.web.cern.ch/mersi/layouts/.private/Baseline_tilted_200_Pixel_1_1_1/index.html
+  source trackMomentumResolution_PIX4022.tcl
+}
+
+#################################
+# Energy resolution for electrons
+#################################
+
+module EnergySmearing ElectronEnergySmearing {
+  set InputArray ElectronTrackingEfficiency/electrons
+  set OutputArray electrons
+
+  # set ResolutionFormula {resolution formula as a function of eta and energy}
+
+  # resolution formula for electrons
+
+  # taking something flat in energy for now, ECAL will take over at high energy anyway.
+  # inferred from hep-ex/1306.2016 and 1502.02701
+  set ResolutionFormula {
+
+                        (abs(eta) <= 1.5)  * (energy*0.028) +
+    (abs(eta) > 1.5  && abs(eta) <= 1.75)  * (energy*0.037) +
+    (abs(eta) > 1.75  && abs(eta) <= 2.15) * (energy*0.038) +
+    (abs(eta) > 2.15  && abs(eta) <= 3.00) * (energy*0.044) +
+    (abs(eta) > 3.00  && abs(eta) <= 4.00) * (energy*0.10)}
+
+}
+
+###############################
+# Momentum resolution for muons
+###############################
+
+module MomentumSmearing MuonMomentumSmearing {
+  set InputArray MuonTrackingEfficiency/muons
+  set OutputArray muons
+  # resolution formula for muons
+
+  # up to |eta| < 2.8 take measurement from tracking + muon chambers
+  # for |eta| > 2.8 and pT < 5.0 take measurement from tracking alone taken from
+  # http://mersi.web.cern.ch/mersi/layouts/.private/Baseline_tilted_200_Pixel_1_1_1/index.html
+  source muonMomentumResolution.tcl
+}
+
+
+
+
+##############
+# Track merger
+##############
+
+module Merger TrackMerger {
+# add InputArray InputArray
+  add InputArray ChargedHadronMomentumSmearing/chargedHadrons
+  add InputArray ElectronEnergySmearing/electrons
+  add InputArray MuonMomentumSmearing/muons
+  set OutputArray tracks
+}
+
+#############
+#   ECAL
+#############
+
+module SimpleCalorimeter ECal {
+  set ParticleInputArray ParticlePropagator/stableParticles
+  set TrackInputArray TrackMerger/tracks
+
+  set TowerOutputArray ecalTowers
+  set EFlowTrackOutputArray eflowTracks
+  set EFlowTowerOutputArray eflowPhotons
+
+  set IsEcal true
+
+  set EnergyMin 0.5
+  set EnergySignificanceMin 1.0
+
+  set SmearTowerCenter true
+
+  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
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the barrel |eta| < 1.5
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 1.5 (barrel)
+  for {set i -85} {$i <= 86} {incr i} {
+    set eta [expr {$i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the endcaps 1.5 < |eta| < 3.0 (HGCAL- ECAL)
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 3
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { -2.958 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { 1.4964 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # take present CMS granularity for HF
+
+  # 0.175 x (0.175 - 0.35) resolution in eta,phi in the HF 3.0 < |eta| < 5.0
+  set PhiBins {}
+  for {set i -18} {$i <= 18} {incr i} {
+    add PhiBins [expr {$i * $pi/18.0}]
+  }
+
+  foreach eta {-5 -4.7 -4.525 -4.35 -4.175 -4 -3.825 -3.65 -3.475 -3.3 -3.125 -2.958 3.125 3.3 3.475 3.65 3.825 4 4.175 4.35 4.525 4.7 5} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+
+  add EnergyFraction {0} {0.0}
+  # energy fractions for e, gamma and pi0
+  add EnergyFraction {11} {1.0}
+  add EnergyFraction {22} {1.0}
+  add EnergyFraction {111} {1.0}
+  # energy fractions for muon, neutrinos and neutralinos
+  add EnergyFraction {12} {0.0}
+  add EnergyFraction {13} {0.0}
+  add EnergyFraction {14} {0.0}
+  add EnergyFraction {16} {0.0}
+  add EnergyFraction {1000022} {0.0}
+  add EnergyFraction {1000023} {0.0}
+  add EnergyFraction {1000025} {0.0}
+  add EnergyFraction {1000035} {0.0}
+  add EnergyFraction {1000045} {0.0}
+  # energy fractions for K0short and Lambda
+  add EnergyFraction {310} {0.3}
+  add EnergyFraction {3122} {0.3}
+
+  # set ResolutionFormula {resolution formula as a function of eta and energy}
+
+  # for the ECAL barrel (|eta| < 1.5), see hep-ex/1306.2016 and 1502.02701
+  # for the endcaps (1.5 < |eta| < 3.0), we take HGCAL  see LHCC-P-008, Fig. 3.39, p.117
+
+  set ResolutionFormula {  (abs(eta) <= 1.50)                    * sqrt(energy^2*0.009^2 + energy*0.12^2 + 0.45^2) +
+                           (abs(eta) > 1.50 && abs(eta) <= 1.75) * sqrt(energy^2*0.006^2 + energy*0.20^2) + \
+                           (abs(eta) > 1.75 && abs(eta) <= 2.15) * sqrt(energy^2*0.007^2 + energy*0.21^2) + \
+                           (abs(eta) > 2.15 && abs(eta) <= 3.00) * sqrt(energy^2*0.008^2 + energy*0.24^2) + \
+                           (abs(eta) >= 3.0 && abs(eta) <= 5.0)  * sqrt(energy^2*0.08^2 + energy*1.98^2)}
+
+}
+
+#############
+#   HCAL
+#############
+
+module SimpleCalorimeter HCal {
+  set ParticleInputArray ParticlePropagator/stableParticles
+  set TrackInputArray ECal/eflowTracks
+
+  set TowerOutputArray hcalTowers
+  set EFlowTrackOutputArray eflowTracks
+  set EFlowTowerOutputArray eflowNeutralHadrons
+
+  set IsEcal false
+
+  set EnergyMin 1.0
+  set EnergySignificanceMin 1.0
+
+  set SmearTowerCenter true
+
+  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
+
+  # assume 0.087 x 0.087 resolution in eta,phi in the barrel |eta| < 1.5
+
+  set PhiBins {}
+  for {set i -36} {$i <= 36} {incr i} {
+    add PhiBins [expr {$i * $pi/36.0}]
+  }
+  foreach eta {-1.566 -1.479 -1.392 -1.305 -1.218 -1.131 -1.044 -0.957 -0.87 -0.783 -0.696 -0.609 -0.522 -0.435 -0.348 -0.261 -0.174 -0.087 0 0.087 0.174 0.261 0.348 0.435 0.522 0.609 0.696 0.783 0.87 0.957 1.044 1.131 1.218 1.305 1.392 1.479 1.566 1.65} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the endcaps 1.5 < |eta| < 3.0 (HGCAL- HCAL)
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 3
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { -2.958 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { 1.4964 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # take present CMS granularity for HF
+
+  # 0.175 x (0.175 - 0.35) resolution in eta,phi in the HF 3.0 < |eta| < 5.0
+  set PhiBins {}
+  for {set i -18} {$i <= 18} {incr i} {
+    add PhiBins [expr {$i * $pi/18.0}]
+  }
+
+  foreach eta {-5 -4.7 -4.525 -4.35 -4.175 -4 -3.825 -3.65 -3.475 -3.3 -3.125 -2.958 3.125 3.3 3.475 3.65 3.825 4 4.175 4.35 4.525 4.7 5} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+
+  # default energy fractions {abs(PDG code)} {Fecal Fhcal}
+  add EnergyFraction {0} {1.0}
+  # energy fractions for e, gamma and pi0
+  add EnergyFraction {11} {0.0}
+  add EnergyFraction {22} {0.0}
+  add EnergyFraction {111} {0.0}
+  # energy fractions for muon, neutrinos and neutralinos
+  add EnergyFraction {12} {0.0}
+  add EnergyFraction {13} {0.0}
+  add EnergyFraction {14} {0.0}
+  add EnergyFraction {16} {0.0}
+  add EnergyFraction {1000022} {0.0}
+  add EnergyFraction {1000023} {0.0}
+  add EnergyFraction {1000025} {0.0}
+  add EnergyFraction {1000035} {0.0}
+  add EnergyFraction {1000045} {0.0}
+  # energy fractions for K0short and Lambda
+  add EnergyFraction {310} {0.7}
+  add EnergyFraction {3122} {0.7}
+
+# set ResolutionFormula {resolution formula as a function of eta and energy}
+  set ResolutionFormula {                    (abs(eta) <= 1.5) * sqrt(energy^2*0.05^2 + energy*1.00^2) + \
+						   (abs(eta) > 1.5 && abs(eta) <= 3.0) * sqrt(energy^2*0.05^2 + energy*1.00^2) + \
+						   (abs(eta) > 3.0 && abs(eta) <= 5.0) * sqrt(energy^2*0.11^2 + energy*2.80^2)}
+
+}
+
+#################################
+# Energy resolution for electrons
+#################################
+
+module EnergySmearing PhotonEnergySmearing {
+  set InputArray ECal/eflowPhotons
+  set OutputArray eflowPhotons
+
+  # adding 1% extra photon smearing
+  set ResolutionFormula {energy*0.01}
+
+}
+
+
+
+#################
+# Electron filter
+#################
+
+module PdgCodeFilter ElectronFilter {
+  set InputArray HCal/eflowTracks
+  set OutputArray electrons
+  set Invert true
+  add PdgCode {11}
+  add PdgCode {-11}
+}
+
+
+##########################
+# Track pile-up subtractor
+##########################
+
+module TrackPileUpSubtractor TrackPileUpSubtractor {
+# add InputArray InputArray OutputArray
+  add InputArray HCal/eflowTracks eflowTracks
+  add InputArray ElectronFilter/electrons electrons
+  add InputArray MuonMomentumSmearing/muons muons
+
+  set VertexInputArray PileUpMerger/vertices
+  # assume perfect pile-up subtraction for tracks with |z| > fZVertexResolution
+  # Z vertex resolution in m
+  set ZVertexResolution 0.0001
+}
+
+
+###################################################
+# Tower Merger (in case not using e-flow algorithm)
+###################################################
+
+module Merger TowerMerger {
+# add InputArray InputArray
+  add InputArray ECal/ecalTowers
+  add InputArray HCal/hcalTowers
+  set OutputArray towers
+}
+
+
+####################
+# Neutral eflow erger
+####################
+
+module Merger NeutralEFlowMerger {
+# add InputArray InputArray
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflowTowers
+}
+
+
+####################
+# Energy flow merger
+####################
+
+module Merger EFlowMerger {
+# add InputArray InputArray
+  add InputArray HCal/eflowTracks
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflow
+}
+
+##################################
+# Energy flow merger (all tracks)
+##################################
+
+module Merger EFlowMergerAllTracks {
+# add InputArray InputArray
+  add InputArray TrackMerger/tracks
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflow
+}
+
+#########################################
+### Run the puppi code (to be tuned) ###
+#########################################
+
+module PdgCodeFilter LeptonFilterNoLep {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracksNoLeptons
+  set Invert false
+  add PdgCode {13}
+  add PdgCode {-13}
+  add PdgCode {11}
+  add PdgCode {-11}
+}
+
+module PdgCodeFilter LeptonFilterLep {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracksLeptons
+  set Invert true
+  add PdgCode {11}
+  add PdgCode {-11}
+  add PdgCode {13}
+  add PdgCode {-13}
+}
+
+module RunPUPPI RunPUPPIBase {
+  ## input information
+  set TrackInputArray   LeptonFilterNoLep/eflowTracksNoLeptons
+  set NeutralInputArray NeutralEFlowMerger/eflowTowers
+  set PVInputArray      PileUpMerger/vertices
+  set MinPuppiWeight    0.05
+  set UseExp            false
+  set UseNoLep          false
+
+  ## define puppi algorithm parameters (more than one for the same eta region is possible)
+  add EtaMinBin           0.0   1.5   4.0
+  add EtaMaxBin           1.5   4.0   10.0
+  add PtMinBin            0.0   0.0   0.0
+  add ConeSizeBin         0.2   0.2   0.2
+  add RMSPtMinBin         0.1   0.5   0.5
+  add RMSScaleFactorBin   1.0   1.0   1.0
+  add NeutralMinEBin      0.2   0.2   0.5
+  add NeutralPtSlope      0.006 0.013 0.067
+  add ApplyCHS            true  true  true
+  add UseCharged          true  true  false
+  add ApplyLowPUCorr      true  true  true
+  add MetricId            5     5     5
+  add CombId              0     0     0
+
+  ## output name
+  set OutputArray         PuppiParticles
+  set OutputArrayTracks   puppiTracks
+  set OutputArrayNeutrals puppiNeutrals
+}
+
+module Merger RunPUPPI {
+  add InputArray RunPUPPIBase/PuppiParticles
+  add InputArray LeptonFilterLep/eflowTracksLeptons
+  set OutputArray PuppiParticles
+}
+
+###################
+# Missing ET merger
+###################
+
+module Merger MissingET {
+# add InputArray InputArray
+#  add InputArray RunPUPPI/PuppiParticles
+  add InputArray EFlowMerger/eflow
+  set MomentumOutputArray momentum
+}
+
+module Merger PuppiMissingET {
+  #add InputArray InputArray
+  add InputArray RunPUPPI/PuppiParticles
+  #add InputArray EFlowMerger/eflow
+  set MomentumOutputArray momentum
+}
+
+###################
+# Ger PileUp Missing ET
+###################
+
+module Merger GenPileUpMissingET {
+# add InputArray InputArray
+#  add InputArray RunPUPPI/PuppiParticles
+  add InputArray ParticlePropagator/stableParticles
+  set MomentumOutputArray momentum
+}
+
+##################
+# Scalar HT merger
+##################
+
+module Merger ScalarHT {
+# add InputArray InputArray
+  add InputArray RunPUPPI/PuppiParticles
+  set EnergyOutputArray energy
+}
+
+#################
+# Neutrino Filter
+#################
+
+module PdgCodeFilter NeutrinoFilter {
+
+  set InputArray Delphes/stableParticles
+  set OutputArray filteredParticles
+
+  set PTMin 0.0
+
+  add PdgCode {12}
+  add PdgCode {14}
+  add PdgCode {16}
+  add PdgCode {-12}
+  add PdgCode {-14}
+  add PdgCode {-16}
+
+}
+
+
+#####################
+# MC truth jet finder
+#####################
+
+module FastJetFinder GenJetFinder {
+  set InputArray NeutrinoFilter/filteredParticles
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+module FastJetFinder GenJetFinderAK8 {
+  set InputArray NeutrinoFilter/filteredParticles
+
+  set OutputArray jetsAK8
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set JetPTMin 200.0
+}
+
+#########################
+# Gen Missing ET merger
+########################
+
+module Merger GenMissingET {
+
+# add InputArray InputArray
+  add InputArray NeutrinoFilter/filteredParticles
+  set MomentumOutputArray momentum
+}
+
+
+
+#########################
+# Gen Missing ET merger
+########################
+
+module Merger GenMissingET {
+
+# add InputArray InputArray
+  add InputArray NeutrinoFilter/filteredParticles
+  set MomentumOutputArray momentum
+}
+
+
+
+############
+# Jet finder
+############
+
+module FastJetFinder FastJetFinder {
+#  set InputArray TowerMerger/towers
+  set InputArray EFlowMerger/eflow
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+#module Class Name
+module FastJetFinder FastJetFinderAK8 {
+#  set InputArray TowerMerger/towers
+  set InputArray EFlowMerger/eflow
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set ComputeNsubjettiness 1
+  set Beta 1.0
+  set AxisMode 4
+
+  set ComputeTrimming 1
+  set RTrim 0.2
+  set PtFracTrim 0.05
+
+  set ComputePruning 1
+  set ZcutPrun 0.1
+  set RcutPrun 0.5
+  set RPrun 0.8
+
+  set ComputeSoftDrop 1
+  set BetaSoftDrop 0.0
+  set SymmetryCutSoftDrop 0.1
+  set R0SoftDrop 0.8
+
+  set JetPTMin 200.0
+}
+
+module FastJetFinder FastJetFinderPUPPI {
+#  set InputArray TowerMerger/towers
+  set InputArray RunPUPPI/PuppiParticles
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+
+module FastJetFinder FastJetFinderPUPPIAK8 {
+#  set InputArray TowerMerger/towers
+  set InputArray RunPUPPI/PuppiParticles
+
+  set OutputArray jets
+
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set ComputeNsubjettiness 1
+  set Beta 1.0
+  set AxisMode 4
+
+  set ComputeTrimming 1
+  set RTrim 0.2
+  set PtFracTrim 0.05
+
+  set ComputePruning 1
+  set ZcutPrun 0.1
+  set RcutPrun 0.5
+  set RPrun 0.8
+
+  set ComputeSoftDrop 1
+  set BetaSoftDrop 0.0
+  set SymmetryCutSoftDrop 0.1
+  set R0SoftDrop 0.8
+
+  set JetPTMin 200.0
+}
+
+##################
+# Jet Energy Scale
+##################
+
+module EnergyScale JetEnergyScale {
+  set InputArray FastJetFinder/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScaleAK8 {
+  set InputArray FastJetFinderAK8/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScalePUPPI {
+  set InputArray FastJetFinderPUPPI/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScalePUPPIAK8 {
+  set InputArray FastJetFinderPUPPIAK8/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+#################
+# Photon filter
+#################
+
+module PdgCodeFilter PhotonFilter {
+  set InputArray PhotonEnergySmearing/eflowPhotons
+  set OutputArray photons
+  set Invert true
+  set PTMin 5.0
+  add PdgCode {22}
+}
+
+
+####################
+# Photon isolation #
+####################
+
+module Isolation PhotonIsolation {
+
+  # particle for which calculate the isolation
+  set CandidateInputArray PhotonFilter/photons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+
+  # output array
+  set OutputArray photons
+
+  # veto isolation cand. based on proximity to input cand.
+  set DeltaRMin 0.01
+  set UseMiniCone true
+
+  # isolation cone
+  set DeltaRMax 0.3
+
+  # minimum pT
+  set PTMin     1.0
+
+  # iso ratio to cut
+  set PTRatioMax 9999.
+
+}
+
+
+
+#####################
+# Photon efficiency #
+#####################
+
+module Efficiency PhotonEfficiency {
+
+  ## input particles
+  set InputArray PhotonIsolation/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 #
+######################
+
+module Isolation ElectronIsolation {
+
+  set CandidateInputArray ElectronFilter/electrons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+  #set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray electrons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+
+#######################
+# Electron efficiency #
+#######################
+
+module Efficiency ElectronEfficiency {
+
+  set InputArray ElectronIsolation/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 #
+##################
+
+module Isolation MuonIsolation {
+  set CandidateInputArray MuonMomentumSmearing/muons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+
+  set OutputArray muons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+##################
+# Muon Loose Id  #
+##################
+
+module Efficiency MuonLooseIdEfficiency {
+    set InputArray MuonIsolation/muons
+    set OutputArray muons
+    # tracking + LooseID efficiency formula for muons
+    source muonLooseId.tcl
+
+}
+
+
+##################
+# Muon Tight Id  #
+##################
+
+module Efficiency MuonTightIdEfficiency {
+    set InputArray MuonIsolation/muons
+    set OutputArray muons
+    # tracking + TightID efficiency formula for muons
+    source muonTightId.tcl
+}
+
+
+
+########################
+# Jet Flavor Association
+########################
+
+module JetFlavorAssociation JetFlavorAssociation {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScale/jets
+
+  set DeltaR 0.5
+  set PartonPTMin 10.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationAK8 {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set DeltaR 0.8
+  set PartonPTMin 100.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationPUPPI {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set DeltaR 0.5
+  set PartonPTMin 10.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationPUPPIAK8 {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set DeltaR 0.8
+  set PartonPTMin 100.0
+  set PartonEtaMax 4.0
+
+}
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingLoose {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLooseAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLoosePUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLoosePUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingMedium {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumPUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumPUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingTight {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightPUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightPUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+#############
+# tau-tagging
+#############
+
+
+module TauTagging TauTagging {
+  set ParticleInputArray Delphes/allParticles
+  set PartonInputArray Delphes/partons
+  set JetInputArray JetEnergyScale/jets
+
+  set DeltaR 0.5
+
+  set TauPTMin 20.0
+
+  set TauEtaMax 2.3
+
+  # add EfficiencyFormula {abs(PDG code)} {efficiency formula as a function of eta and pt}
+
+  add EfficiencyFormula {0}  { (abs(eta) < 2.3) * ((( -0.00621816+0.00130097*pt-2.19642e-5*pt^2+1.49393e-7*pt^3-4.58972e-10*pt^4+5.27983e-13*pt^5 )) * (pt<250) + 0.0032*(pt>250)) + \
+                               (abs(eta) > 2.3) * (0.000)
+                             }
+  add EfficiencyFormula {15} { (abs(eta) < 2.3) * 0.97*0.77*( (0.32 + 0.01*pt - 0.000054*pt*pt )*(pt<100)+0.78*(pt>100) ) + \
+                               (abs(eta) > 2.3) * (0.000)
+                             }
+}
+
+
+###############################################################################################################
+# StatusPidFilter: this module removes all generated particles except electrons, muons, taus, and status == 3 #
+###############################################################################################################
+
+module StatusPidFilter GenParticleFilter {
+
+    set InputArray  Delphes/allParticles
+    set OutputArray filteredParticles
+    set PTMin 5.0
+
+}
+
+
+##################
+# ROOT tree writer
+##################
+
+module TreeWriter TreeWriter {
+# add Branch InputArray BranchName BranchClass
+  add Branch GenParticleFilter/filteredParticles Particle GenParticle
+  add Branch PileUpMerger/vertices Vertex Vertex
+
+  add Branch GenJetFinder/jets GenJet Jet
+  add Branch GenJetFinderAK8/jetsAK8 GenJetAK8 Jet
+  add Branch GenMissingET/momentum GenMissingET MissingET
+
+#  add Branch HCal/eflowTracks EFlowTrack Track
+#  add Branch ECal/eflowPhotons EFlowPhoton Tower
+#  add Branch HCal/eflowNeutralHadrons EFlowNeutralHadron Tower
+
+  add Branch PhotonEfficiency/photons Photon Photon
+  add Branch ElectronEfficiency/electrons Electron Electron
+  add Branch MuonLooseIdEfficiency/muons MuonLoose Muon
+  add Branch MuonTightIdEfficiency/muons MuonTight Muon
+
+  add Branch JetEnergyScale/jets Jet Jet
+#  add Branch FatJetFinder/jets FatJet Jet
+  add Branch JetEnergyScalePUPPI/jets JetPUPPI Jet
+  add Branch JetEnergyScaleAK8/jets JetAK8 Jet
+  add Branch JetEnergyScalePUPPIAK8/jets JetPUPPIAK8 Jet
+
+  add Branch MissingET/momentum MissingET MissingET
+  add Branch PuppiMissingET/momentum PuppiMissingET MissingET
+  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 ba65969e652e2cc13ff9d997ae84a00322d369d8)
+++ cards/CMS_PhaseII/CMS_PhaseII_Substructure_PIX4022_200PU.tcl	(revision ba65969e652e2cc13ff9d997ae84a00322d369d8)
@@ -0,0 +1,1306 @@
+#
+#  Phase II - No Pile-Up
+#
+#  Main authors: Michele Selvaggi (UCL)
+#
+#  Released on:
+#
+#  Version: v01
+#
+#
+#######################################
+# Order of execution of various modules
+#######################################
+
+set ExecutionPath {
+
+  PileUpMerger
+  ParticlePropagator
+
+  ChargedHadronTrackingEfficiency
+  ElectronTrackingEfficiency
+  MuonTrackingEfficiency
+
+  ChargedHadronMomentumSmearing
+  ElectronEnergySmearing
+  MuonMomentumSmearing
+
+  TrackMerger
+
+  ECal
+  HCal
+
+  PhotonEnergySmearing
+  ElectronFilter
+  TrackPileUpSubtractor
+
+  TowerMerger
+  NeutralEFlowMerger
+  EFlowMergerAllTracks
+  EFlowMerger
+
+  LeptonFilterNoLep
+  LeptonFilterLep
+  RunPUPPIBase
+  RunPUPPI
+
+  PhotonFilter
+
+  PhotonIsolation
+  PhotonEfficiency
+
+  ElectronIsolation
+  ElectronEfficiency
+
+  MuonIsolation
+  MuonLooseIdEfficiency
+  MuonTightIdEfficiency
+
+  NeutrinoFilter
+
+  MissingET
+  PuppiMissingET
+  GenMissingET
+  GenPileUpMissingET
+
+  GenJetFinder
+  GenJetFinderAK8
+  FastJetFinder
+  FastJetFinderAK8
+  FastJetFinderPUPPI
+  FastJetFinderPUPPIAK8
+
+  ScalarHT
+
+  JetEnergyScale
+  JetEnergyScaleAK8
+  JetEnergyScalePUPPI
+  JetEnergyScalePUPPIAK8
+
+  JetFlavorAssociation
+  JetFlavorAssociationAK8
+  JetFlavorAssociationPUPPI
+  JetFlavorAssociationPUPPIAK8
+
+  BTaggingLoose
+  BTaggingMedium
+  BTaggingTight
+  BTaggingLooseAK8
+  BTaggingMediumAK8
+  BTaggingTightAK8
+  BTaggingLoosePUPPI
+  BTaggingMediumPUPPI
+  BTaggingTightPUPPI
+  BTaggingLoosePUPPIAK8
+  BTaggingMediumPUPPIAK8
+  BTaggingTightPUPPIAK8
+
+  TauTagging
+
+  GenParticleFilter
+
+  TreeWriter
+}
+
+###############
+# PileUp Merger
+###############
+
+module PileUpMerger PileUpMerger {
+  set InputArray Delphes/stableParticles
+
+  set ParticleOutputArray stableParticles
+  set VertexOutputArray vertices
+
+  # pre-generated minbias input file
+  set PileUpFile ../eos/cms/store/group/upgrade/delphes/PhaseII/MinBias_100k.pileup
+  #set PileUpFile MinBias.pileup
+
+  # average expected pile up
+  set MeanPileUp 200
+
+  # maximum spread in the beam direction in m
+  set ZVertexSpread 0.25
+
+  # maximum spread in time in s
+  set TVertexSpread 800E-12
+
+  # vertex smearing formula f(z,t) (z,t need to be respectively given in m,s)
+  set VertexDistributionFormula {exp(-(t^2/160e-12^2/2))*exp(-(z^2/0.053^2/2))}
+
+}
+
+
+#################################
+# Propagate particles in cylinder
+#################################
+
+module ParticlePropagator ParticlePropagator {
+  set InputArray PileUpMerger/stableParticles
+
+  set OutputArray stableParticles
+  set ChargedHadronOutputArray chargedHadrons
+  set ElectronOutputArray electrons
+  set MuonOutputArray muons
+
+  # radius of the magnetic field coverage, in m
+  set Radius 1.29
+  # half-length of the magnetic field coverage, in m
+  set HalfLength 3.0
+
+  # magnetic field
+  set Bz 3.8
+}
+
+
+####################################
+# Charged hadron tracking efficiency
+####################################
+
+module Efficiency ChargedHadronTrackingEfficiency {
+  ## particles after propagation
+  set InputArray  ParticlePropagator/chargedHadrons
+  set OutputArray chargedHadrons
+  # tracking efficiency formula for charged hadrons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 0.96) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (0.97) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 0.2 && pt <= 1.0) * (pt*0.85) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 1.0) * (0.87) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.8) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 1.0) * (0.82) + \
+	  (abs(eta) > 4.0) * (0.00)
+  }
+}
+
+
+#####################################
+# Electron tracking efficiency - ID
+####################################
+
+module Efficiency ElectronTrackingEfficiency {
+  set InputArray  ParticlePropagator/electrons
+  set OutputArray electrons
+  # tracking efficiency formula for electrons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 0.96) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (0.97) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 0.2 && pt <= 1.0) * (pt*0.85) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 1.0 && pt <= 10.0) * (0.82+pt*0.01) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.5) * (pt > 10.0) * (0.90) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.8) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 1.0 && pt <= 10.0) * (0.8+pt*0.01) + \
+	  (abs(eta) > 2.5 && abs(eta) <= 4.0) * (pt > 10.0) * (0.85) + \
+	  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+##########################
+# Muon tracking efficiency
+##########################
+
+module Efficiency MuonTrackingEfficiency {
+  set InputArray ParticlePropagator/muons
+  set OutputArray muons
+  # tracking efficiency formula for muons
+  set EfficiencyFormula {
+      (pt <= 0.2) * (0.00) + \
+	  (abs(eta) <= 1.2) * (pt > 0.2 && pt <= 1.0) * (pt * 1.00) + \
+	  (abs(eta) <= 1.2) * (pt > 1.0) * (1.00) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.8) * (pt > 0.2 && pt <= 1.0) * (pt*1.00) + \
+	  (abs(eta) > 1.2 && abs(eta) <= 2.8) * (pt > 1.0) * (1.00) + \
+	  (abs(eta) > 2.8 && abs(eta) <= 4.0) * (pt > 0.2 && pt <= 1.0) * (pt*0.95) + \
+	  (abs(eta) > 2.8 && abs(eta) <= 4.0) * (pt > 1.0) * (0.95) + \
+	  (abs(eta) > 4.0) * (0.00)
+
+  }
+}
+
+
+########################################
+# Momentum resolution for charged tracks
+########################################
+
+module MomentumSmearing ChargedHadronMomentumSmearing {
+  ## hadrons after having applied the tracking efficiency
+  set InputArray  ChargedHadronTrackingEfficiency/chargedHadrons
+  set OutputArray chargedHadrons
+  # resolution formula for charged hadrons ,
+
+  # from http://mersi.web.cern.ch/mersi/layouts/.private/Baseline_tilted_200_Pixel_1_1_1/index.html
+  source trackMomentumResolution_PIX4022.tcl
+}
+
+#################################
+# Energy resolution for electrons
+#################################
+
+module EnergySmearing ElectronEnergySmearing {
+  set InputArray ElectronTrackingEfficiency/electrons
+  set OutputArray electrons
+
+  # set ResolutionFormula {resolution formula as a function of eta and energy}
+
+  # resolution formula for electrons
+
+  # taking something flat in energy for now, ECAL will take over at high energy anyway.
+  # inferred from hep-ex/1306.2016 and 1502.02701
+  set ResolutionFormula {
+
+                        (abs(eta) <= 1.5)  * (energy*0.028) +
+    (abs(eta) > 1.5  && abs(eta) <= 1.75)  * (energy*0.037) +
+    (abs(eta) > 1.75  && abs(eta) <= 2.15) * (energy*0.038) +
+    (abs(eta) > 2.15  && abs(eta) <= 3.00) * (energy*0.044) +
+    (abs(eta) > 3.00  && abs(eta) <= 4.00) * (energy*0.10)}
+
+}
+
+###############################
+# Momentum resolution for muons
+###############################
+
+module MomentumSmearing MuonMomentumSmearing {
+  set InputArray MuonTrackingEfficiency/muons
+  set OutputArray muons
+  # resolution formula for muons
+
+  # up to |eta| < 2.8 take measurement from tracking + muon chambers
+  # for |eta| > 2.8 and pT < 5.0 take measurement from tracking alone taken from
+  # http://mersi.web.cern.ch/mersi/layouts/.private/Baseline_tilted_200_Pixel_1_1_1/index.html
+  source muonMomentumResolution.tcl
+}
+
+
+
+
+##############
+# Track merger
+##############
+
+module Merger TrackMerger {
+# add InputArray InputArray
+  add InputArray ChargedHadronMomentumSmearing/chargedHadrons
+  add InputArray ElectronEnergySmearing/electrons
+  add InputArray MuonMomentumSmearing/muons
+  set OutputArray tracks
+}
+
+#############
+#   ECAL
+#############
+
+module SimpleCalorimeter ECal {
+  set ParticleInputArray ParticlePropagator/stableParticles
+  set TrackInputArray TrackMerger/tracks
+
+  set TowerOutputArray ecalTowers
+  set EFlowTrackOutputArray eflowTracks
+  set EFlowTowerOutputArray eflowPhotons
+
+  set IsEcal true
+
+  set EnergyMin 0.5
+  set EnergySignificanceMin 1.0
+
+  set SmearTowerCenter true
+
+  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
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the barrel |eta| < 1.5
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 1.5 (barrel)
+  for {set i -85} {$i <= 86} {incr i} {
+    set eta [expr {$i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the endcaps 1.5 < |eta| < 3.0 (HGCAL- ECAL)
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 3
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { -2.958 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { 1.4964 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # take present CMS granularity for HF
+
+  # 0.175 x (0.175 - 0.35) resolution in eta,phi in the HF 3.0 < |eta| < 5.0
+  set PhiBins {}
+  for {set i -18} {$i <= 18} {incr i} {
+    add PhiBins [expr {$i * $pi/18.0}]
+  }
+
+  foreach eta {-5 -4.7 -4.525 -4.35 -4.175 -4 -3.825 -3.65 -3.475 -3.3 -3.125 -2.958 3.125 3.3 3.475 3.65 3.825 4 4.175 4.35 4.525 4.7 5} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+
+  add EnergyFraction {0} {0.0}
+  # energy fractions for e, gamma and pi0
+  add EnergyFraction {11} {1.0}
+  add EnergyFraction {22} {1.0}
+  add EnergyFraction {111} {1.0}
+  # energy fractions for muon, neutrinos and neutralinos
+  add EnergyFraction {12} {0.0}
+  add EnergyFraction {13} {0.0}
+  add EnergyFraction {14} {0.0}
+  add EnergyFraction {16} {0.0}
+  add EnergyFraction {1000022} {0.0}
+  add EnergyFraction {1000023} {0.0}
+  add EnergyFraction {1000025} {0.0}
+  add EnergyFraction {1000035} {0.0}
+  add EnergyFraction {1000045} {0.0}
+  # energy fractions for K0short and Lambda
+  add EnergyFraction {310} {0.3}
+  add EnergyFraction {3122} {0.3}
+
+  # set ResolutionFormula {resolution formula as a function of eta and energy}
+
+  # for the ECAL barrel (|eta| < 1.5), see hep-ex/1306.2016 and 1502.02701
+  # for the endcaps (1.5 < |eta| < 3.0), we take HGCAL  see LHCC-P-008, Fig. 3.39, p.117
+
+  set ResolutionFormula {  (abs(eta) <= 1.50)                    * sqrt(energy^2*0.009^2 + energy*0.12^2 + 0.45^2) +
+                           (abs(eta) > 1.50 && abs(eta) <= 1.75) * sqrt(energy^2*0.006^2 + energy*0.20^2) + \
+                           (abs(eta) > 1.75 && abs(eta) <= 2.15) * sqrt(energy^2*0.007^2 + energy*0.21^2) + \
+                           (abs(eta) > 2.15 && abs(eta) <= 3.00) * sqrt(energy^2*0.008^2 + energy*0.24^2) + \
+                           (abs(eta) >= 3.0 && abs(eta) <= 5.0)  * sqrt(energy^2*0.08^2 + energy*1.98^2)}
+
+}
+
+#############
+#   HCAL
+#############
+
+module SimpleCalorimeter HCal {
+  set ParticleInputArray ParticlePropagator/stableParticles
+  set TrackInputArray ECal/eflowTracks
+
+  set TowerOutputArray hcalTowers
+  set EFlowTrackOutputArray eflowTracks
+  set EFlowTowerOutputArray eflowNeutralHadrons
+
+  set IsEcal false
+
+  set EnergyMin 1.0
+  set EnergySignificanceMin 1.0
+
+  set SmearTowerCenter true
+
+  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
+
+  # assume 0.087 x 0.087 resolution in eta,phi in the barrel |eta| < 1.5
+
+  set PhiBins {}
+  for {set i -36} {$i <= 36} {incr i} {
+    add PhiBins [expr {$i * $pi/36.0}]
+  }
+  foreach eta {-1.566 -1.479 -1.392 -1.305 -1.218 -1.131 -1.044 -0.957 -0.87 -0.783 -0.696 -0.609 -0.522 -0.435 -0.348 -0.261 -0.174 -0.087 0 0.087 0.174 0.261 0.348 0.435 0.522 0.609 0.696 0.783 0.87 0.957 1.044 1.131 1.218 1.305 1.392 1.479 1.566 1.65} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # assume 0.02 x 0.02 resolution in eta,phi in the endcaps 1.5 < |eta| < 3.0 (HGCAL- HCAL)
+
+  set PhiBins {}
+  for {set i -180} {$i <= 180} {incr i} {
+    add PhiBins [expr {$i * $pi/180.0}]
+  }
+
+  # 0.02 unit in eta up to eta = 3
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { -2.958 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  for {set i 1} {$i <= 84} {incr i} {
+    set eta [expr { 1.4964 + $i * 0.0174}]
+    add EtaPhiBins $eta $PhiBins
+  }
+
+  # take present CMS granularity for HF
+
+  # 0.175 x (0.175 - 0.35) resolution in eta,phi in the HF 3.0 < |eta| < 5.0
+  set PhiBins {}
+  for {set i -18} {$i <= 18} {incr i} {
+    add PhiBins [expr {$i * $pi/18.0}]
+  }
+
+  foreach eta {-5 -4.7 -4.525 -4.35 -4.175 -4 -3.825 -3.65 -3.475 -3.3 -3.125 -2.958 3.125 3.3 3.475 3.65 3.825 4 4.175 4.35 4.525 4.7 5} {
+    add EtaPhiBins $eta $PhiBins
+  }
+
+
+  # default energy fractions {abs(PDG code)} {Fecal Fhcal}
+  add EnergyFraction {0} {1.0}
+  # energy fractions for e, gamma and pi0
+  add EnergyFraction {11} {0.0}
+  add EnergyFraction {22} {0.0}
+  add EnergyFraction {111} {0.0}
+  # energy fractions for muon, neutrinos and neutralinos
+  add EnergyFraction {12} {0.0}
+  add EnergyFraction {13} {0.0}
+  add EnergyFraction {14} {0.0}
+  add EnergyFraction {16} {0.0}
+  add EnergyFraction {1000022} {0.0}
+  add EnergyFraction {1000023} {0.0}
+  add EnergyFraction {1000025} {0.0}
+  add EnergyFraction {1000035} {0.0}
+  add EnergyFraction {1000045} {0.0}
+  # energy fractions for K0short and Lambda
+  add EnergyFraction {310} {0.7}
+  add EnergyFraction {3122} {0.7}
+
+# set ResolutionFormula {resolution formula as a function of eta and energy}
+  set ResolutionFormula {                    (abs(eta) <= 1.5) * sqrt(energy^2*0.05^2 + energy*1.00^2) + \
+						   (abs(eta) > 1.5 && abs(eta) <= 3.0) * sqrt(energy^2*0.05^2 + energy*1.00^2) + \
+						   (abs(eta) > 3.0 && abs(eta) <= 5.0) * sqrt(energy^2*0.11^2 + energy*2.80^2)}
+
+}
+
+#################################
+# Energy resolution for electrons
+#################################
+
+module EnergySmearing PhotonEnergySmearing {
+  set InputArray ECal/eflowPhotons
+  set OutputArray eflowPhotons
+
+  # adding 1% extra photon smearing
+  set ResolutionFormula {energy*0.01}
+
+}
+
+
+
+#################
+# Electron filter
+#################
+
+module PdgCodeFilter ElectronFilter {
+  set InputArray HCal/eflowTracks
+  set OutputArray electrons
+  set Invert true
+  add PdgCode {11}
+  add PdgCode {-11}
+}
+
+
+##########################
+# Track pile-up subtractor
+##########################
+
+module TrackPileUpSubtractor TrackPileUpSubtractor {
+# add InputArray InputArray OutputArray
+  add InputArray HCal/eflowTracks eflowTracks
+  add InputArray ElectronFilter/electrons electrons
+  add InputArray MuonMomentumSmearing/muons muons
+
+  set VertexInputArray PileUpMerger/vertices
+  # assume perfect pile-up subtraction for tracks with |z| > fZVertexResolution
+  # Z vertex resolution in m
+  set ZVertexResolution 0.0001
+}
+
+
+###################################################
+# Tower Merger (in case not using e-flow algorithm)
+###################################################
+
+module Merger TowerMerger {
+# add InputArray InputArray
+  add InputArray ECal/ecalTowers
+  add InputArray HCal/hcalTowers
+  set OutputArray towers
+}
+
+
+####################
+# Neutral eflow erger
+####################
+
+module Merger NeutralEFlowMerger {
+# add InputArray InputArray
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflowTowers
+}
+
+
+####################
+# Energy flow merger
+####################
+
+module Merger EFlowMerger {
+# add InputArray InputArray
+  add InputArray HCal/eflowTracks
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflow
+}
+
+##################################
+# Energy flow merger (all tracks)
+##################################
+
+module Merger EFlowMergerAllTracks {
+# add InputArray InputArray
+  add InputArray TrackMerger/tracks
+  add InputArray PhotonEnergySmearing/eflowPhotons
+  add InputArray HCal/eflowNeutralHadrons
+  set OutputArray eflow
+}
+
+#########################################
+### Run the puppi code (to be tuned) ###
+#########################################
+
+module PdgCodeFilter LeptonFilterNoLep {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracksNoLeptons
+  set Invert false
+  add PdgCode {13}
+  add PdgCode {-13}
+  add PdgCode {11}
+  add PdgCode {-11}
+}
+
+module PdgCodeFilter LeptonFilterLep {
+  set InputArray HCal/eflowTracks
+  set OutputArray eflowTracksLeptons
+  set Invert true
+  add PdgCode {11}
+  add PdgCode {-11}
+  add PdgCode {13}
+  add PdgCode {-13}
+}
+
+module RunPUPPI RunPUPPIBase {
+  ## input information
+  set TrackInputArray   LeptonFilterNoLep/eflowTracksNoLeptons
+  set NeutralInputArray NeutralEFlowMerger/eflowTowers
+  set PVInputArray      PileUpMerger/vertices
+  set MinPuppiWeight    0.05
+  set UseExp            false
+  set UseNoLep          false
+
+  ## define puppi algorithm parameters (more than one for the same eta region is possible)
+  add EtaMinBin           0.0   1.5   4.0
+  add EtaMaxBin           1.5   4.0   10.0
+  add PtMinBin            0.0   0.0   0.0
+  add ConeSizeBin         0.2   0.2   0.2
+  add RMSPtMinBin         0.1   0.5   0.5
+  add RMSScaleFactorBin   1.0   1.0   1.0
+  add NeutralMinEBin      0.2   0.2   0.5
+  add NeutralPtSlope      0.006 0.013 0.067
+  add ApplyCHS            true  true  true
+  add UseCharged          true  true  false
+  add ApplyLowPUCorr      true  true  true
+  add MetricId            5     5     5
+  add CombId              0     0     0
+
+  ## output name
+  set OutputArray         PuppiParticles
+  set OutputArrayTracks   puppiTracks
+  set OutputArrayNeutrals puppiNeutrals
+}
+
+module Merger RunPUPPI {
+  add InputArray RunPUPPIBase/PuppiParticles
+  add InputArray LeptonFilterLep/eflowTracksLeptons
+  set OutputArray PuppiParticles
+}
+
+###################
+# Missing ET merger
+###################
+
+module Merger MissingET {
+# add InputArray InputArray
+#  add InputArray RunPUPPI/PuppiParticles
+  add InputArray EFlowMerger/eflow
+  set MomentumOutputArray momentum
+}
+
+module Merger PuppiMissingET {
+  #add InputArray InputArray
+  add InputArray RunPUPPI/PuppiParticles
+  #add InputArray EFlowMerger/eflow
+  set MomentumOutputArray momentum
+}
+
+###################
+# Ger PileUp Missing ET
+###################
+
+module Merger GenPileUpMissingET {
+# add InputArray InputArray
+#  add InputArray RunPUPPI/PuppiParticles
+  add InputArray ParticlePropagator/stableParticles
+  set MomentumOutputArray momentum
+}
+
+##################
+# Scalar HT merger
+##################
+
+module Merger ScalarHT {
+# add InputArray InputArray
+  add InputArray RunPUPPI/PuppiParticles
+  set EnergyOutputArray energy
+}
+
+#################
+# Neutrino Filter
+#################
+
+module PdgCodeFilter NeutrinoFilter {
+
+  set InputArray Delphes/stableParticles
+  set OutputArray filteredParticles
+
+  set PTMin 0.0
+
+  add PdgCode {12}
+  add PdgCode {14}
+  add PdgCode {16}
+  add PdgCode {-12}
+  add PdgCode {-14}
+  add PdgCode {-16}
+
+}
+
+
+#####################
+# MC truth jet finder
+#####################
+
+module FastJetFinder GenJetFinder {
+  set InputArray NeutrinoFilter/filteredParticles
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+module FastJetFinder GenJetFinderAK8 {
+  set InputArray NeutrinoFilter/filteredParticles
+
+  set OutputArray jetsAK8
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set JetPTMin 200.0
+}
+
+#########################
+# Gen Missing ET merger
+########################
+
+module Merger GenMissingET {
+
+# add InputArray InputArray
+  add InputArray NeutrinoFilter/filteredParticles
+  set MomentumOutputArray momentum
+}
+
+
+
+#########################
+# Gen Missing ET merger
+########################
+
+module Merger GenMissingET {
+
+# add InputArray InputArray
+  add InputArray NeutrinoFilter/filteredParticles
+  set MomentumOutputArray momentum
+}
+
+
+
+############
+# Jet finder
+############
+
+module FastJetFinder FastJetFinder {
+#  set InputArray TowerMerger/towers
+  set InputArray EFlowMerger/eflow
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+#module Class Name
+module FastJetFinder FastJetFinderAK8 {
+#  set InputArray TowerMerger/towers
+  set InputArray EFlowMerger/eflow
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set ComputeNsubjettiness 1
+  set Beta 1.0
+  set AxisMode 4
+
+  set ComputeTrimming 1
+  set RTrim 0.2
+  set PtFracTrim 0.05
+
+  set ComputePruning 1
+  set ZcutPrun 0.1
+  set RcutPrun 0.5
+  set RPrun 0.8
+
+  set ComputeSoftDrop 1
+  set BetaSoftDrop 0.0
+  set SymmetryCutSoftDrop 0.1
+  set R0SoftDrop 0.8
+
+  set JetPTMin 200.0
+}
+
+module FastJetFinder FastJetFinderPUPPI {
+#  set InputArray TowerMerger/towers
+  set InputArray RunPUPPI/PuppiParticles
+
+  set OutputArray jets
+
+  # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt
+  set JetAlgorithm 6
+  set ParameterR 0.4
+
+  set JetPTMin 15.0
+}
+
+
+module FastJetFinder FastJetFinderPUPPIAK8 {
+#  set InputArray TowerMerger/towers
+  set InputArray RunPUPPI/PuppiParticles
+
+  set OutputArray jets
+
+  set JetAlgorithm 6
+  set ParameterR 0.8
+
+  set ComputeNsubjettiness 1
+  set Beta 1.0
+  set AxisMode 4
+
+  set ComputeTrimming 1
+  set RTrim 0.2
+  set PtFracTrim 0.05
+
+  set ComputePruning 1
+  set ZcutPrun 0.1
+  set RcutPrun 0.5
+  set RPrun 0.8
+
+  set ComputeSoftDrop 1
+  set BetaSoftDrop 0.0
+  set SymmetryCutSoftDrop 0.1
+  set R0SoftDrop 0.8
+
+  set JetPTMin 200.0
+}
+
+##################
+# Jet Energy Scale
+##################
+
+module EnergyScale JetEnergyScale {
+  set InputArray FastJetFinder/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScaleAK8 {
+  set InputArray FastJetFinderAK8/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScalePUPPI {
+  set InputArray FastJetFinderPUPPI/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+module EnergyScale JetEnergyScalePUPPIAK8 {
+  set InputArray FastJetFinderPUPPIAK8/jets
+  set OutputArray jets
+
+ # scale formula for jets
+  set ScaleFormula {1.00}
+}
+
+#################
+# Photon filter
+#################
+
+module PdgCodeFilter PhotonFilter {
+  set InputArray PhotonEnergySmearing/eflowPhotons
+  set OutputArray photons
+  set Invert true
+  set PTMin 5.0
+  add PdgCode {22}
+}
+
+
+####################
+# Photon isolation #
+####################
+
+module Isolation PhotonIsolation {
+
+  # particle for which calculate the isolation
+  set CandidateInputArray PhotonFilter/photons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+
+  # output array
+  set OutputArray photons
+
+  # veto isolation cand. based on proximity to input cand.
+  set DeltaRMin 0.01
+  set UseMiniCone true
+
+  # isolation cone
+  set DeltaRMax 0.3
+
+  # minimum pT
+  set PTMin     1.0
+
+  # iso ratio to cut
+  set PTRatioMax 9999.
+
+}
+
+
+
+#####################
+# Photon efficiency #
+#####################
+
+module Efficiency PhotonEfficiency {
+
+  ## input particles
+  set InputArray PhotonIsolation/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 #
+######################
+
+module Isolation ElectronIsolation {
+
+  set CandidateInputArray ElectronFilter/electrons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+  #set IsolationInputArray EFlowMerger/eflow
+
+  set OutputArray electrons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+
+#######################
+# Electron efficiency #
+#######################
+
+module Efficiency ElectronEfficiency {
+
+  set InputArray ElectronIsolation/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 #
+##################
+
+module Isolation MuonIsolation {
+  set CandidateInputArray MuonMomentumSmearing/muons
+
+  # isolation collection
+  set IsolationInputArray RunPUPPI/PuppiParticles
+
+  set OutputArray muons
+
+  set DeltaRMax 0.3
+  set PTMin 1.0
+  set PTRatioMax 9999.
+
+}
+
+
+##################
+# Muon Loose Id  #
+##################
+
+module Efficiency MuonLooseIdEfficiency {
+    set InputArray MuonIsolation/muons
+    set OutputArray muons
+    # tracking + LooseID efficiency formula for muons
+    source muonLooseId.tcl
+
+}
+
+
+##################
+# Muon Tight Id  #
+##################
+
+module Efficiency MuonTightIdEfficiency {
+    set InputArray MuonIsolation/muons
+    set OutputArray muons
+    # tracking + TightID efficiency formula for muons
+    source muonTightId.tcl
+}
+
+
+
+########################
+# Jet Flavor Association
+########################
+
+module JetFlavorAssociation JetFlavorAssociation {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScale/jets
+
+  set DeltaR 0.5
+  set PartonPTMin 10.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationAK8 {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set DeltaR 0.8
+  set PartonPTMin 100.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationPUPPI {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set DeltaR 0.5
+  set PartonPTMin 10.0
+  set PartonEtaMax 4.0
+
+}
+
+module JetFlavorAssociation JetFlavorAssociationPUPPIAK8 {
+
+  set PartonInputArray Delphes/partons
+  set ParticleInputArray Delphes/allParticles
+  set ParticleLHEFInputArray Delphes/allParticlesLHEF
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set DeltaR 0.8
+  set PartonPTMin 100.0
+  set PartonEtaMax 4.0
+
+}
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingLoose {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLooseAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLoosePUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+module BTagging BTaggingLoosePUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 0
+
+  source btagLoose.tcl
+}
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingMedium {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumPUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+module BTagging BTaggingMediumPUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 1
+
+  source btagMedium.tcl
+}
+
+
+
+#############
+# b-tagging #
+#############
+module BTagging BTaggingTight {
+
+  set JetInputArray JetEnergyScale/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightAK8 {
+
+  set JetInputArray JetEnergyScaleAK8/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightPUPPI {
+
+  set JetInputArray JetEnergyScalePUPPI/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+module BTagging BTaggingTightPUPPIAK8 {
+
+  set JetInputArray JetEnergyScalePUPPIAK8/jets
+
+  set BitNumber 2
+
+  source btagTight.tcl
+}
+
+#############
+# tau-tagging
+#############
+
+
+module TauTagging TauTagging {
+  set ParticleInputArray Delphes/allParticles
+  set PartonInputArray Delphes/partons
+  set JetInputArray JetEnergyScale/jets
+
+  set DeltaR 0.5
+
+  set TauPTMin 20.0
+
+  set TauEtaMax 2.3
+
+  # add EfficiencyFormula {abs(PDG code)} {efficiency formula as a function of eta and pt}
+
+  add EfficiencyFormula {0}  { (abs(eta) < 2.3) * ((( -0.00621816+0.00130097*pt-2.19642e-5*pt^2+1.49393e-7*pt^3-4.58972e-10*pt^4+5.27983e-13*pt^5 )) * (pt<250) + 0.0032*(pt>250)) + \
+                               (abs(eta) > 2.3) * (0.000)
+                             }
+  add EfficiencyFormula {15} { (abs(eta) < 2.3) * 0.97*0.77*( (0.32 + 0.01*pt - 0.000054*pt*pt )*(pt<100)+0.78*(pt>100) ) + \
+                               (abs(eta) > 2.3) * (0.000)
+                             }
+}
+
+
+###############################################################################################################
+# StatusPidFilter: this module removes all generated particles except electrons, muons, taus, and status == 3 #
+###############################################################################################################
+
+module StatusPidFilter GenParticleFilter {
+
+    set InputArray  Delphes/allParticles
+    set OutputArray filteredParticles
+    set PTMin 5.0
+
+}
+
+
+##################
+# ROOT tree writer
+##################
+
+module TreeWriter TreeWriter {
+# add Branch InputArray BranchName BranchClass
+  add Branch GenParticleFilter/filteredParticles Particle GenParticle
+  add Branch PileUpMerger/vertices Vertex Vertex
+
+  add Branch GenJetFinder/jets GenJet Jet
+  add Branch GenJetFinderAK8/jetsAK8 GenJetAK8 Jet
+  add Branch GenMissingET/momentum GenMissingET MissingET
+
+#  add Branch HCal/eflowTracks EFlowTrack Track
+#  add Branch ECal/eflowPhotons EFlowPhoton Tower
+#  add Branch HCal/eflowNeutralHadrons EFlowNeutralHadron Tower
+
+  add Branch PhotonEfficiency/photons Photon Photon
+  add Branch ElectronEfficiency/electrons Electron Electron
+  add Branch MuonLooseIdEfficiency/muons MuonLoose Muon
+  add Branch MuonTightIdEfficiency/muons MuonTight Muon
+
+  add Branch JetEnergyScale/jets Jet Jet
+#  add Branch FatJetFinder/jets FatJet Jet
+  add Branch JetEnergyScalePUPPI/jets JetPUPPI Jet
+  add Branch JetEnergyScaleAK8/jets JetAK8 Jet
+  add Branch JetEnergyScalePUPPIAK8/jets JetPUPPIAK8 Jet
+
+  add Branch MissingET/momentum MissingET MissingET
+  add Branch PuppiMissingET/momentum PuppiMissingET MissingET
+  add Branch GenPileUpMissingET/momentum GenPileUpMissingET MissingET
+  add Branch ScalarHT/energy ScalarHT ScalarHT
+}
Index: cards/CMS_PhaseII/trackMomentumResolution_PIX4022.tcl
===================================================================
--- cards/CMS_PhaseII/trackMomentumResolution_PIX4022.tcl	(revision ba65969e652e2cc13ff9d997ae84a00322d369d8)
+++ cards/CMS_PhaseII/trackMomentumResolution_PIX4022.tcl	(revision ba65969e652e2cc13ff9d997ae84a00322d369d8)
@@ -0,0 +1,87 @@
+#
+# Automatically generated tracker resolution formula for layout: TDR_OT362_PIX4022
+#
+#  By StefanoMersi on: 2016-08-03.16:52:42
+#
+set ResolutionFormula {    (abs(eta) >= 0.0000 && abs(eta) < 0.2000) * (pt >= 0.0000 && pt < 1.0000) * (0.00458793) + \
+   (abs(eta) >= 0.0000 && abs(eta) < 0.2000) * (pt >= 1.0000 && pt < 10.0000) * (0.004588 + (pt-1.000000)* 0.000044) + \
+   (abs(eta) >= 0.0000 && abs(eta) < 0.2000) * (pt >= 10.0000 && pt < 100.0000) * (0.004984 + (pt-10.000000)* 0.000049) + \
+   (abs(eta) >= 0.0000 && abs(eta) < 0.2000) * (pt >= 100.0000) * (0.009405*pt/100.000000) + \
+   (abs(eta) >= 0.2000 && abs(eta) < 0.4000) * (pt >= 0.0000 && pt < 1.0000) * (0.00502630) + \
+   (abs(eta) >= 0.2000 && abs(eta) < 0.4000) * (pt >= 1.0000 && pt < 10.0000) * (0.005026 + (pt-1.000000)* 0.000039) + \
+   (abs(eta) >= 0.2000 && abs(eta) < 0.4000) * (pt >= 10.0000 && pt < 100.0000) * (0.005377 + (pt-10.000000)* 0.000046) + \
+   (abs(eta) >= 0.2000 && abs(eta) < 0.4000) * (pt >= 100.0000) * (0.009551*pt/100.000000) + \
+   (abs(eta) >= 0.4000 && abs(eta) < 0.6000) * (pt >= 0.0000 && pt < 1.0000) * (0.00498879) + \
+   (abs(eta) >= 0.4000 && abs(eta) < 0.6000) * (pt >= 1.0000 && pt < 10.0000) * (0.004989 + (pt-1.000000)* 0.000044) + \
+   (abs(eta) >= 0.4000 && abs(eta) < 0.6000) * (pt >= 10.0000 && pt < 100.0000) * (0.005388 + (pt-10.000000)* 0.000048) + \
+   (abs(eta) >= 0.4000 && abs(eta) < 0.6000) * (pt >= 100.0000) * (0.009745*pt/100.000000) + \
+   (abs(eta) >= 0.6000 && abs(eta) < 0.8000) * (pt >= 0.0000 && pt < 1.0000) * (0.00544936) + \
+   (abs(eta) >= 0.6000 && abs(eta) < 0.8000) * (pt >= 1.0000 && pt < 10.0000) * (0.005449 + (pt-1.000000)* 0.000051) + \
+   (abs(eta) >= 0.6000 && abs(eta) < 0.8000) * (pt >= 10.0000 && pt < 100.0000) * (0.005906 + (pt-10.000000)* 0.000048) + \
+   (abs(eta) >= 0.6000 && abs(eta) < 0.8000) * (pt >= 100.0000) * (0.010201*pt/100.000000) + \
+   (abs(eta) >= 0.8000 && abs(eta) < 1.0000) * (pt >= 0.0000 && pt < 1.0000) * (0.00665443) + \
+   (abs(eta) >= 0.8000 && abs(eta) < 1.0000) * (pt >= 1.0000 && pt < 10.0000) * (0.006654 + (pt-1.000000)* 0.000059) + \
+   (abs(eta) >= 0.8000 && abs(eta) < 1.0000) * (pt >= 10.0000 && pt < 100.0000) * (0.007187 + (pt-10.000000)* 0.000055) + \
+   (abs(eta) >= 0.8000 && abs(eta) < 1.0000) * (pt >= 100.0000) * (0.012130*pt/100.000000) + \
+   (abs(eta) >= 1.0000 && abs(eta) < 1.2000) * (pt >= 0.0000 && pt < 1.0000) * (0.00973024) + \
+   (abs(eta) >= 1.0000 && abs(eta) < 1.2000) * (pt >= 1.0000 && pt < 10.0000) * (0.009730 + (pt-1.000000)* 0.000073) + \
+   (abs(eta) >= 1.0000 && abs(eta) < 1.2000) * (pt >= 10.0000 && pt < 100.0000) * (0.010384 + (pt-10.000000)* 0.000073) + \
+   (abs(eta) >= 1.0000 && abs(eta) < 1.2000) * (pt >= 100.0000) * (0.016923*pt/100.000000) + \
+   (abs(eta) >= 1.2000 && abs(eta) < 1.4000) * (pt >= 0.0000 && pt < 1.0000) * (0.01339705) + \
+   (abs(eta) >= 1.2000 && abs(eta) < 1.4000) * (pt >= 1.0000 && pt < 10.0000) * (0.013397 + (pt-1.000000)* 0.000037) + \
+   (abs(eta) >= 1.2000 && abs(eta) < 1.4000) * (pt >= 10.0000 && pt < 100.0000) * (0.013733 + (pt-10.000000)* 0.000061) + \
+   (abs(eta) >= 1.2000 && abs(eta) < 1.4000) * (pt >= 100.0000) * (0.019205*pt/100.000000) + \
+   (abs(eta) >= 1.4000 && abs(eta) < 1.6000) * (pt >= 0.0000 && pt < 1.0000) * (0.01550411) + \
+   (abs(eta) >= 1.4000 && abs(eta) < 1.6000) * (pt >= 1.0000 && pt < 10.0000) * (0.015504 + (pt-1.000000)* 0.000020) + \
+   (abs(eta) >= 1.4000 && abs(eta) < 1.6000) * (pt >= 10.0000 && pt < 100.0000) * (0.015685 + (pt-10.000000)* 0.000055) + \
+   (abs(eta) >= 1.4000 && abs(eta) < 1.6000) * (pt >= 100.0000) * (0.020648*pt/100.000000) + \
+   (abs(eta) >= 1.6000 && abs(eta) < 1.8000) * (pt >= 0.0000 && pt < 1.0000) * (0.01618811) + \
+   (abs(eta) >= 1.6000 && abs(eta) < 1.8000) * (pt >= 1.0000 && pt < 10.0000) * (0.016188 + (pt-1.000000)* 0.000044) + \
+   (abs(eta) >= 1.6000 && abs(eta) < 1.8000) * (pt >= 10.0000 && pt < 100.0000) * (0.016585 + (pt-10.000000)* 0.000052) + \
+   (abs(eta) >= 1.6000 && abs(eta) < 1.8000) * (pt >= 100.0000) * (0.021303*pt/100.000000) + \
+   (abs(eta) >= 1.8000 && abs(eta) < 2.0000) * (pt >= 0.0000 && pt < 1.0000) * (0.01551715) + \
+   (abs(eta) >= 1.8000 && abs(eta) < 2.0000) * (pt >= 1.0000 && pt < 10.0000) * (0.015517 + (pt-1.000000)* 0.000140) + \
+   (abs(eta) >= 1.8000 && abs(eta) < 2.0000) * (pt >= 10.0000 && pt < 100.0000) * (0.016774 + (pt-10.000000)* 0.000099) + \
+   (abs(eta) >= 1.8000 && abs(eta) < 2.0000) * (pt >= 100.0000) * (0.025729*pt/100.000000) + \
+   (abs(eta) >= 2.0000 && abs(eta) < 2.2000) * (pt >= 0.0000 && pt < 1.0000) * (0.01631704) + \
+   (abs(eta) >= 2.0000 && abs(eta) < 2.2000) * (pt >= 1.0000 && pt < 10.0000) * (0.016317 + (pt-1.000000)* 0.000206) + \
+   (abs(eta) >= 2.0000 && abs(eta) < 2.2000) * (pt >= 10.0000 && pt < 100.0000) * (0.018170 + (pt-10.000000)* 0.000134) + \
+   (abs(eta) >= 2.0000 && abs(eta) < 2.2000) * (pt >= 100.0000) * (0.030211*pt/100.000000) + \
+   (abs(eta) >= 2.2000 && abs(eta) < 2.4000) * (pt >= 0.0000 && pt < 1.0000) * (0.01627397) + \
+   (abs(eta) >= 2.2000 && abs(eta) < 2.4000) * (pt >= 1.0000 && pt < 10.0000) * (0.016274 + (pt-1.000000)* 0.000175) + \
+   (abs(eta) >= 2.2000 && abs(eta) < 2.4000) * (pt >= 10.0000 && pt < 100.0000) * (0.017851 + (pt-10.000000)* 0.000151) + \
+   (abs(eta) >= 2.2000 && abs(eta) < 2.4000) * (pt >= 100.0000) * (0.031433*pt/100.000000) + \
+   (abs(eta) >= 2.4000 && abs(eta) < 2.6000) * (pt >= 0.0000 && pt < 1.0000) * (0.01878531) + \
+   (abs(eta) >= 2.4000 && abs(eta) < 2.6000) * (pt >= 1.0000 && pt < 10.0000) * (0.018785 + (pt-1.000000)* 0.000146) + \
+   (abs(eta) >= 2.4000 && abs(eta) < 2.6000) * (pt >= 10.0000 && pt < 100.0000) * (0.020102 + (pt-10.000000)* 0.000214) + \
+   (abs(eta) >= 2.4000 && abs(eta) < 2.6000) * (pt >= 100.0000) * (0.039402*pt/100.000000) + \
+   (abs(eta) >= 2.6000 && abs(eta) < 2.8000) * (pt >= 0.0000 && pt < 1.0000) * (0.02109916) + \
+   (abs(eta) >= 2.6000 && abs(eta) < 2.8000) * (pt >= 1.0000 && pt < 10.0000) * (0.021099 + (pt-1.000000)* 0.000167) + \
+   (abs(eta) >= 2.6000 && abs(eta) < 2.8000) * (pt >= 10.0000 && pt < 100.0000) * (0.022601 + (pt-10.000000)* 0.000380) + \
+   (abs(eta) >= 2.6000 && abs(eta) < 2.8000) * (pt >= 100.0000) * (0.056841*pt/100.000000) + \
+   (abs(eta) >= 2.8000 && abs(eta) < 3.0000) * (pt >= 0.0000 && pt < 1.0000) * (0.02394859) + \
+   (abs(eta) >= 2.8000 && abs(eta) < 3.0000) * (pt >= 1.0000 && pt < 10.0000) * (0.023949 + (pt-1.000000)* 0.000253) + \
+   (abs(eta) >= 2.8000 && abs(eta) < 3.0000) * (pt >= 10.0000 && pt < 100.0000) * (0.026226 + (pt-10.000000)* 0.000488) + \
+   (abs(eta) >= 2.8000 && abs(eta) < 3.0000) * (pt >= 100.0000) * (0.070122*pt/100.000000) + \
+   (abs(eta) >= 3.0000 && abs(eta) < 3.2000) * (pt >= 0.0000 && pt < 1.0000) * (0.02400507) + \
+   (abs(eta) >= 3.0000 && abs(eta) < 3.2000) * (pt >= 1.0000 && pt < 10.0000) * (0.024005 + (pt-1.000000)* 0.000253) + \
+   (abs(eta) >= 3.0000 && abs(eta) < 3.2000) * (pt >= 10.0000 && pt < 100.0000) * (0.026281 + (pt-10.000000)* 0.000506) + \
+   (abs(eta) >= 3.0000 && abs(eta) < 3.2000) * (pt >= 100.0000) * (0.071806*pt/100.000000) + \
+   (abs(eta) >= 3.2000 && abs(eta) < 3.4000) * (pt >= 0.0000 && pt < 1.0000) * (0.02839053) + \
+   (abs(eta) >= 3.2000 && abs(eta) < 3.4000) * (pt >= 1.0000 && pt < 10.0000) * (0.028391 + (pt-1.000000)* 0.000430) + \
+   (abs(eta) >= 3.2000 && abs(eta) < 3.4000) * (pt >= 10.0000 && pt < 100.0000) * (0.032264 + (pt-10.000000)* 0.000930) + \
+   (abs(eta) >= 3.2000 && abs(eta) < 3.4000) * (pt >= 100.0000) * (0.115956*pt/100.000000) + \
+   (abs(eta) >= 3.4000 && abs(eta) < 3.6000) * (pt >= 0.0000 && pt < 1.0000) * (0.03771147) + \
+   (abs(eta) >= 3.4000 && abs(eta) < 3.6000) * (pt >= 1.0000 && pt < 10.0000) * (0.037711 + (pt-1.000000)* 0.000816) + \
+   (abs(eta) >= 3.4000 && abs(eta) < 3.6000) * (pt >= 10.0000 && pt < 100.0000) * (0.045051 + (pt-10.000000)* 0.001643) + \
+   (abs(eta) >= 3.4000 && abs(eta) < 3.6000) * (pt >= 100.0000) * (0.192878*pt/100.000000) + \
+   (abs(eta) >= 3.6000 && abs(eta) < 3.8000) * (pt >= 0.0000 && pt < 1.0000) * (0.04779871) + \
+   (abs(eta) >= 3.6000 && abs(eta) < 3.8000) * (pt >= 1.0000 && pt < 10.0000) * (0.047799 + (pt-1.000000)* 0.001523) + \
+   (abs(eta) >= 3.6000 && abs(eta) < 3.8000) * (pt >= 10.0000 && pt < 100.0000) * (0.061505 + (pt-10.000000)* 0.003068) + \
+   (abs(eta) >= 3.6000 && abs(eta) < 3.8000) * (pt >= 100.0000) * (0.337618*pt/100.000000) + \
+   (abs(eta) >= 3.8000 && abs(eta) < 4.0000) * (pt >= 0.0000 && pt < 1.0000) * (0.06185337) + \
+   (abs(eta) >= 3.8000 && abs(eta) < 4.0000) * (pt >= 1.0000 && pt < 10.0000) * (0.061853 + (pt-1.000000)* 0.002638) + \
+   (abs(eta) >= 3.8000 && abs(eta) < 4.0000) * (pt >= 10.0000 && pt < 100.0000) * (0.085595 + (pt-10.000000)* 0.004866) + \
+   (abs(eta) >= 3.8000 && abs(eta) < 4.0000) * (pt >= 100.0000) * (0.523505*pt/100.000000)
+}
+
