CMS 3D CMS Logo

gedGsfElectronsTo106X_cff.py
Go to the documentation of this file.
1 #
2 # While reducing the AOD data tier produced in 80X to miniAOD, the electron
3 # MVAs are computed before slimming. However, the object updators in
4 # egammaObjectModificationsInMiniAOD_cff are written for pat::Electrons.
5 # Therefore, we must adapt the object modifiers to the AOD level such that the
6 # MVA producer can run on electrons that are updated and correctly store the
7 # conversion rejection variables.
8 #
9 # Little annoyance: updating the object also requires computing the HEEP value
10 # maps for the gedGsfElectrons, even though they are recomputed later from the
11 # reducedEgamma collections. Unfortunately we can't use these HEEP value maps
12 # that already exists, because reducedEgamma in turn depends on the
13 # electronMVAValueMap producer. Hence, this is a problem of circular
14 # dependency.
15 #
16 
17 import FWCore.ParameterSet.Config as cms
18 
19 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
20 from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import (
21  egamma8XObjectUpdateModifier,
22  egamma9X105XUpdateModifier,
23 )
24 from RecoEgamma.ElectronIdentification.heepIdVarValueMapProducer_cfi import heepIDVarValueMaps
25 
26 heepIDVarValueMapsAOD = heepIDVarValueMaps.copy()
27 heepIDVarValueMapsAOD.dataFormat = 1
28 
29 gsfElectron8XObjectUpdateModifier = egamma8XObjectUpdateModifier.clone(
30  ecalRecHitsEB="reducedEcalRecHitsEB", ecalRecHitsEE="reducedEcalRecHitsEE"
31 )
32 gsfElectron9X105XUpdateModifier = egamma9X105XUpdateModifier.clone(
33  eleCollVMsAreKeyedTo="gedGsfElectrons",
34  eleTrkIso="heepIDVarValueMapsAOD:eleTrkPtIso",
35  eleTrkIso04="heepIDVarValueMapsAOD:eleTrkPtIso04",
36  conversions="allConversions",
37  ecalRecHitsEB="reducedEcalRecHitsEB",
38  ecalRecHitsEE="reducedEcalRecHitsEE",
39 )
40 
41 # we have dataformat changes to 106X so to read older releases we use egamma updators
42 gedGsfElectronsFrom80XTo106X = cms.EDProducer(
43  "ModifiedGsfElectronProducer",
44  src=cms.InputTag("gedGsfElectrons"),
45  modifierConfig=cms.PSet(
46  modifications=cms.VPSet(gsfElectron8XObjectUpdateModifier, gsfElectron9X105XUpdateModifier)
47  ),
48 )
49 
50 gedGsfElectronsFrom80XTo106XTask = cms.Task(heepIDVarValueMapsAOD, gedGsfElectronsFrom80XTo106X)
51 
52 gedGsfElectronsFrom94XTo106X = cms.EDProducer(
53  "ModifiedGsfElectronProducer",
54  src=cms.InputTag("gedGsfElectrons"),
55  modifierConfig=cms.PSet(
56  modifications=cms.VPSet(gsfElectron9X105XUpdateModifier)
57  ),
58 )
59 
60 gedGsfElectronsFrom94XTo106XTask = cms.Task(heepIDVarValueMapsAOD, gedGsfElectronsFrom94XTo106X)