5 """ add userIsolation to patElectron
7 _label=
'addElectronUserIsolation'
8 _defaultParameters=dicttypes.SortedKeysDict()
11 ConfigToolBase.__init__(self)
12 self.addParameter(self.
_defaultParameters,
'isolationTypes',[
'All'],
'List of predefined userIsolation types to be added; possible values are [\'Tracker\',\'Ecal\',\'Hcal\'] or just [\'All\']', allowedValues=[
'Tracker',
'Ecal',
'Hcal',
'All'])
19 def __call__(self,process,isolationTypes=None) :
20 if isolationTypes
is None:
22 self.setParameter(
'isolationTypes',isolationTypes)
26 isolationTypes=self.
_parameters[
'isolationTypes'].value
32 eleIsoDepositEcalFromHits.ExtractorPSet.barrelEcalHits = cms.InputTag(
"reducedEcalRecHitsEB")
33 eleIsoDepositEcalFromHits.ExtractorPSet.endcapEcalHits = cms.InputTag(
"reducedEcalRecHitsEE")
38 for obj
in range(len(isolationTypes)):
39 if ( isolationTypes[obj] ==
'Tracker' or isolationTypes[obj] ==
'All'):
40 print "adding predefined userIsolation to pat::Electron for Tracker"
41 print " -> to access this information call pat::Electron::userIsolation(pat::TrackIso) in your analysis code <-"
42 isolationKey=isolationKey+1
44 process.patElectronTrackIsolation
45 process.patDefaultSequence.replace( process.patElectrons, process.patElectronTrackIsolation*process.patElectrons )
47 if ( isolationTypes[obj] ==
'Ecal' or isolationTypes[obj] ==
'All'):
48 print "adding predefined userIsolation to pat::Electron for Ecal"
49 print " -> to access this information call pat::Electron::userIsolation(pat::EcalIso ) in your analysis code <-"
50 isolationKey=isolationKey+10
52 process.patElectronEcalIsolation
53 process.patDefaultSequence.replace( process.patElectrons, process.patElectronEcalIsolation*process.patElectrons )
55 if ( isolationTypes[obj] ==
'Hcal' or isolationTypes[obj] ==
'All'):
56 print "adding predefined userIsolation to pat::Electron for Hcal"
57 print " -> to access this information call pat::Electron::userIsolation(pat::HcalIso ) in your analysis code <-"
58 isolationKey=isolationKey+100
60 process.patElectronHcalIsolation = patElectronHcalIsolation
61 process.patDefaultSequence.replace( process.patElectrons, process.patElectronHcalIsolation*process.patElectrons )
64 if ( isolationKey == 1 ):
66 process.patElectrons.isoDeposits = cms.PSet(
67 tracker = cms.InputTag(
"eleIsoDepositTk"),
69 process.patElectrons.userIsolation = cms.PSet(
71 src = cms.InputTag(
"eleIsoFromDepsTk"),
74 if ( isolationKey == 10 ):
76 process.patElectrons.isoDeposits = cms.PSet(
77 ecal = cms.InputTag(
"eleIsoDepositEcalFromHits"),
79 process.patElectrons.userIsolation = cms.PSet(
81 src = cms.InputTag(
"eleIsoFromDepsEcalFromHitsByCrystal"),
84 if ( isolationKey == 100 ):
86 process.patElectrons.isoDeposits = cms.PSet(
87 hcal = cms.InputTag(
"eleIsoDepositHcalFromTowers"),
89 process.patElectrons.userIsolation = cms.PSet(
91 src = cms.InputTag(
"eleIsoFromDepsHcalFromTowers"),
94 if ( isolationKey == 11 ):
96 process.patElectrons.isoDeposits = cms.PSet(
97 tracker = cms.InputTag(
"eleIsoDepositTk"),
98 ecal = cms.InputTag(
"eleIsoDepositEcalFromHits"),
100 process.patElectrons.userIsolation = cms.PSet(
102 src = cms.InputTag(
"eleIsoFromDepsTk"),
105 src = cms.InputTag(
"eleIsoFromDepsEcalFromHitsByCrystal"),
108 if ( isolationKey == 101 ):
110 process.patElectrons.isoDeposits = cms.PSet(
111 tracker = cms.InputTag(
"eleIsoDepositTk"),
112 hcal = cms.InputTag(
"eleIsoDepositHcalFromTowers"),
114 process.patElectrons.userIsolation = cms.PSet(
116 src = cms.InputTag(
"eleIsoFromDepsTk"),
119 src = cms.InputTag(
"eleIsoFromDepsHcalFromTowers"),
122 if ( isolationKey == 110 ):
124 process.patElectrons.isoDeposits = cms.PSet(
125 ecal = cms.InputTag(
"eleIsoDepositEcalFromHits"),
126 hcal = cms.InputTag(
"eleIsoDepositHcalFromTowers"),
128 process.patElectrons.userIsolation = cms.PSet(
130 src = cms.InputTag(
"eleIsoFromDepsEcalFromHitsByCrystal"),
133 src = cms.InputTag(
"eleIsoFromDepsHcalFromTowers"),
136 if ( isolationKey == 111 ):
138 process.patElectrons.isoDeposits = cms.PSet(
139 tracker = cms.InputTag(
"eleIsoDepositTk"),
140 ecal = cms.InputTag(
"eleIsoDepositEcalFromHits"),
141 hcal = cms.InputTag(
"eleIsoDepositHcalFromTowers"),
143 process.patElectrons.userIsolation = cms.PSet(
145 src = cms.InputTag(
"eleIsoFromDepsTk"),
148 src = cms.InputTag(
"eleIsoFromDepsEcalFromHitsByCrystal"),
151 src = cms.InputTag(
"eleIsoFromDepsHcalFromTowers"),