Skip to content

Commit

Permalink
Consolidate ZDefinitions to avoid code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gude committed May 8, 2014
1 parent 94a8a44 commit a1f29e6
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 149 deletions.
274 changes: 127 additions & 147 deletions ZFinder/Event/python/zdefinitions_cfi.py
Original file line number Diff line number Diff line change
@@ -1,153 +1,133 @@
import FWCore.ParameterSet.Config as cms
MIN_MZ = 60.
MAX_MZ = 120.

MIN_MZ = cms.untracked.double(60.)
MAX_MZ = cms.untracked.double(120.)

# Define common PSets

# All events with at least 2 electrons
all_electrons = cms.untracked.PSet(
name = cms.untracked.string("All Electrons"),
cuts0 = cms.untracked.vstring("acc(ALL)"),
cuts1 = cms.untracked.vstring("acc(ALL)"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

# Only the kinematic cuts for the combined muon result, using generator
# quantities
combined_gen_cuts = cms.untracked.PSet(
name = cms.untracked.string("Combined Gen Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "gaeta<2.1", "gpt>30"),
cuts1 = cms.untracked.vstring("acc(ALL)", "gaeta<2.4", "gpt>20"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(True),
)

# Only the kinematic cuts for the combined muon result, using reco quantities
combined_reco_cuts = cms.untracked.PSet(
name = cms.untracked.string("Combined Reco Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

# Cuts for the combined muon result assuming a double electron trigger or
# single electron trigger
combined_double = cms.untracked.PSet(
name = cms.untracked.string("Combined Double"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "trig(et_et_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "trig(et_et_loose)", "pt>20", "eg_medium"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

combined_double_no_trigger = combined_double.clone(
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
)

combined_single = cms.untracked.PSet(
name = cms.untracked.string("Combined Single"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "trig(single_ele)", "pt>30", "eg_tight"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

combined_single_no_trigger = combined_single.clone(
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30", "eg_tight"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
)

# Cuts for the electron only analysis
ecal_ecal = cms.untracked.PSet(
name = cms.untracked.string("ET-ET Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_et_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_et_loose)", "pt>20", "eg_loose"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

ecal_ecal_no_trigger = ecal_ecal.clone(
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>20", "eg_loose"),
)

ecal_nt = cms.untracked.PSet(
name = cms.untracked.string("ET-NT Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_nt_etleg)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(NT)", "acc(NT)", "pt>20", "nt_loose"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

ecal_nt_no_trigger = ecal_nt.clone(
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(NT)", "pt>20", "nt_loose"),
)

ecal_hf = cms.untracked.PSet(
name = cms.untracked.string("ET-HF Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_hf_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(HF)", "trig(hf_loose)", "pt>20", "hf_2dloose"),
min_mz = MIN_MZ,
max_mz = MAX_MZ,
use_truth_mass = cms.untracked.bool(False),
)

ecal_hf_no_trigger = ecal_hf.clone(
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(HF)", "pt>20", "hf_2dloose"),
)

# The ZDefinition for data
zdefs = cms.untracked.VPSet(
cms.untracked.PSet(
name = cms.untracked.string("All Electrons"),
cuts0 = cms.untracked.vstring("acc(ALL)"),
cuts1 = cms.untracked.vstring("acc(ALL)"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the combined result, but using generator quantities and no
# ID cuts
cms.untracked.PSet(
name = cms.untracked.string("Combined Gen Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "gpt>30", "gaeta<2.1"),
cuts1 = cms.untracked.vstring("acc(ALL)", "gpt>20", "gaeta<2.4"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(True)
),
cms.untracked.PSet(
name = cms.untracked.string("Combined Reco Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the combined result. Some assume a double electron trigger (and
# hence use eg_medium on both legs) and some assume a single electron
# trigger (and hence use eg_tight) on one leg
cms.untracked.PSet(
name = cms.untracked.string("Combined Double"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "trig(et_et_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "trig(et_et_loose)", "pt>20", "eg_medium"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("Combined Single"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "trig(single_ele)", "pt>30", "eg_tight"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the full rapidity measurement, where one electron is required in
# the ECAL Tracked (ET) region and have pt>30, and the other electron is
# required to have pt>20.
cms.untracked.PSet(
name = cms.untracked.string("ET-ET Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_et_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_et_loose)", "pt>20", "eg_loose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("ET-NT Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_nt_etleg)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(NT)", "acc(NT)", "pt>20", "nt_loose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("ET-HF Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "trig(et_hf_tight)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(HF)", "trig(hf_loose)", "pt>20", "hf_2dloose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
all_electrons,
combined_reco_cuts,
combined_double,
combined_single,
ecal_ecal,
ecal_nt,
ecal_hf,
)

zdefs_no_trigger = cms.untracked.VPSet(
cms.untracked.PSet(
name = cms.untracked.string("All Electrons"),
cuts0 = cms.untracked.vstring("acc(ALL)"),
cuts1 = cms.untracked.vstring("acc(ALL)"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the combined result, but using generator quantities and no
# ID cuts
cms.untracked.PSet(
name = cms.untracked.string("Combined Gen Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "gpt>30", "gaeta<2.1"),
cuts1 = cms.untracked.vstring("acc(ALL)", "gpt>20", "gaeta<2.4"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(True)
),
cms.untracked.PSet(
name = cms.untracked.string("Combined Reco Cuts"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the combined result. Some assume a double electron trigger (and
# hence use eg_medium on both legs) and some assume a single electron
# trigger (and hence use eg_tight) on one leg
cms.untracked.PSet(
name = cms.untracked.string("Combined Double"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("Combined Single"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(MUON_TIGHT)", "pt>30", "eg_tight"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(MUON_LOOSE)", "pt>20", "eg_medium"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# Cuts for the full rapidity measurement, where one electron is required in
# the ECAL Tracked (ET) region and have pt>30, and the other electron is
# required to have pt>20.
cms.untracked.PSet(
name = cms.untracked.string("ET-ET Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>20", "eg_loose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("ET-NT Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(NT)", "pt>20", "nt_loose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
cms.untracked.PSet(
name = cms.untracked.string("ET-HF Rapidity"),
cuts0 = cms.untracked.vstring("acc(ALL)", "acc(ET)", "pt>30", "eg_medium"),
cuts1 = cms.untracked.vstring("acc(ALL)", "acc(HF)", "pt>20", "hf_2dloose"),
min_mz = cms.untracked.double(MIN_MZ),
max_mz = cms.untracked.double(MAX_MZ),
use_truth_mass = cms.untracked.bool(False)
),
# The ZDefinition for MC
zdefs_mc = cms.untracked.VPSet(
all_electrons,
combined_gen_cuts,
combined_reco_cuts,
combined_double_no_trigger,
combined_single_no_trigger,
ecal_ecal_no_trigger,
ecal_nt_no_trigger,
ecal_hf_no_trigger,
)
4 changes: 2 additions & 2 deletions ZFinder/Event/zfinder_mc_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
process.pfiso = cms.Sequence(process.pfParticleSelectionSequence + process.eleIsoSequence)

# ZFinder
from ZFinder.Event.zdefinitions_cfi import zdefs_no_trigger
from ZFinder.Event.zdefinitions_cfi import zdefs_mc
from ZFinder.Event.zfinder_cfi import ZFinder
process.ZFinder = ZFinder.clone(
ZDefinitions = zdefs_no_trigger
ZDefinitions = zdefs_mc
)

# RUN
Expand Down

0 comments on commit a1f29e6

Please sign in to comment.