29 |
|
jetAlgo = 'AK5', |
30 |
|
jetCorrections = ('AK5PFchs', ['L1FastJet','L2Relative','L3Absolute','L2L3Residual'][:None if options.isData else -1] ) |
31 |
|
) |
32 |
+ |
|
33 |
+ |
getattr( process, 'pfPileUp'+options.postfix).checkClosestZVertex = False # https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookJetEnergyCorrections#JetEnCorPFnoPU2012 |
34 |
|
getattr( process, 'pfPileUpIso'+options.postfix).checkClosestZVertex = True |
35 |
+ |
getattr( process, 'patJetCorrFactors'+options.postfix).flavorType = 'T' # top events, not dijets, but only relevant for L5Flavor,L7Parton |
36 |
+ |
#getattr( process, 'patJetCorrFactors'+options.postfix).levels.append('L5Flavor') # apparently not available in GlobalTags |
37 |
|
if options.isData: coreTools.runOnData( process, names = [ 'PFAll' ], postfix = options.postfix ) |
38 |
|
coreTools.removeSpecificPATObjects( process, names = [ 'Photons', 'Taus' ], postfix = options.postfix ) |
39 |
|
|
40 |
|
self.isoValues = {'el':0.15,'mu':0.20} |
41 |
|
self.eleID = 'mvaTrigV0' |
42 |
|
self.minEleID = 0. |
43 |
< |
self.dBFactor = -0.5 |
43 |
> |
self.isoEA = 'elPFIsoValueEA03' |
44 |
> |
self.dBFactorEl = -1.0 if options.doElectronEA else -0.5 |
45 |
> |
self.dBFactorMu = -0.5 |
46 |
|
self.cuts = {'el': ['abs(eta)<2.5', |
47 |
|
'pt>20.', |
48 |
|
'gsfTrackRef.isNonnull', |
49 |
|
'gsfTrackRef.trackerExpectedHitsInner.numberOfLostHits<2', |
50 |
< |
'(chargedHadronIso+max(0.,neutralHadronIso+photonIso%+f*puChargedHadronIso))/pt < %f'%(self.dBFactor, self.isoValues['el']), |
51 |
< |
'electronID("%s") > %f'%(self.eleID,self.minEleID), |
50 |
> |
'(chargedHadronIso+max(0.,neutralHadronIso+photonIso%+.1f*%s))/pt < %.2f'%(self.dBFactorEl, 'userIsolation("User1Iso")' if options.doElectronEA else 'puChargedHadronIso',self.isoValues['el']), |
51 |
> |
'electronID("%s") > %.2f'%(self.eleID,self.minEleID), |
52 |
|
], |
53 |
|
'mu' :['abs(eta)<2.5', |
54 |
|
'pt>10.', |
55 |
< |
'(chargedHadronIso+neutralHadronIso+photonIso%+f*puChargedHadronIso)/pt < %f'%(self.dBFactor, self.isoValues['mu']), |
55 |
> |
'(chargedHadronIso+neutralHadronIso+photonIso%+.2f*puChargedHadronIso)/pt < %.2f'%(self.dBFactorMu, self.isoValues['mu']), |
56 |
|
'(isPFMuon && (isGlobalMuon || isTrackerMuon) )', |
57 |
|
], |
58 |
|
'jet' : ['abs(eta)<2.5', # Careful! these jet cuts affect the typeI met corrections |
70 |
|
self.options = options |
71 |
|
self.fix = options.postfix |
72 |
|
self.patSeq = getattr(process, 'patPF2PATSequence' + self.fix) |
73 |
< |
self.btags = ['combinedSecondaryVertex','jetProbability'] |
73 |
> |
self.btags = self.options.btags |
74 |
|
self.taginfos = ["impactParameter","secondaryVertex"] |
75 |
|
|
76 |
|
self.configTopProjections() |
99 |
|
iso = self.attr('pfIsolated'+full) |
100 |
|
iso.isolationCut = self.isoValues[lep] |
101 |
|
iso.doDeltaBetaCorrection = True |
102 |
< |
iso.deltaBetaFactor = self.dBFactor |
102 |
> |
iso.deltaBetaFactor = getattr(self, 'dBFactor' + full[:2]) |
103 |
|
sel = self.attr('pfSelected'+full) |
104 |
|
sel.cut = ' && '.join(self.cuts[lep][:-2]) |
105 |
+ |
isoEA = getattr(self.process, self.isoEA) |
106 |
|
print >>self.stdout, "" |
107 |
|
if lep == 'el' : |
108 |
|
idName = 'pfIdentifiedElectrons'+self.fix |
112 |
|
electronIdMap = cms.InputTag(self.eleID), |
113 |
|
electronIdCut = cms.double(self.minEleID)) |
114 |
|
setattr(self.process, idName, id ) |
115 |
< |
self.patSeq.replace( sel, id*sel) |
115 |
> |
self.patSeq.replace( sel, id*sel*isoEA) |
116 |
|
sel.src = idName |
117 |
+ |
isoEA.pfElectrons = 'pfSelectedElectrons'+self.fix |
118 |
+ |
if not iso3 : isoEA.EffectiveAreaType = "kEleGammaAndNeutralHadronIso04" |
119 |
|
self.show(idName) |
120 |
|
|
121 |
|
if iso3: |
132 |
|
val.pfPhotons = tags( lep+'PFIsoValueGamma03' + pf ) |
133 |
|
val.pfChargedHadrons = tags( lep+'PFIsoValueCharged03' + pf ) |
134 |
|
|
135 |
+ |
if lep == 'el' and self.options.doElectronEA : |
136 |
+ |
self.attr( 'pfIsolated' + full).deltaBetaIsolationValueMap = self.isoEA |
137 |
+ |
|
138 |
|
self.show('pfSelected'+full) |
139 |
|
self.show('pfIsolated'+full) |
140 |
|
return |
152 |
|
for mod,attr,val in [('patElectrons','electronIDSources', electronIDSources), |
153 |
|
('selectedPatElectrons','cut', ' && '.join(c for c in self.cuts['el'] if 'gsfTrackRef' not in c)), |
154 |
|
] : setattr( self.attr( mod+self.fix), attr, val ) |
155 |
+ |
self.attr('patElectrons'+self.fix).isolationValues.user = tags( [self.isoEA] ) |
156 |
+ |
|
157 |
|
self.show('selectedPatElectrons'+self.fix) |
158 |
|
return |
159 |
|
|