test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WZElectronSkims_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 #HLTPath = "HLT_Ele*"
4 #HLTProcessName = "HLT"
5 myEleCollection = cms.InputTag("gedGsfElectrons")
6 
7 MinEleNumberFilter = cms.EDFilter("CandViewCountFilter",
8  src = myEleCollection,
9  minNumber = cms.uint32(1)
10  )
11 
12 ## ____ __ _____ _ _
13 ## / ___|___ / _| ____| | ___ ___| |_ _ __ ___ _ __
14 ## | | _/ __| |_| _| | |/ _ \/ __| __| '__/ _ \| '_ \
15 ## | |_| \__ \ _| |___| | __/ (__| |_| | | (_) | | | |
16 ## \____|___/_| |_____|_|\___|\___|\__|_| \___/|_| |_|
17 ##
18 # GsfElectron ################
19 
20 GsfMatchedPhotonCands = cms.EDProducer("ElectronMatchedCandidateProducer",
21  src = cms.InputTag("goodPhotons"),
22  ReferenceElectronCollection = cms.untracked.InputTag("goodElectrons"),
23  deltaR = cms.untracked.double(0.3)
24 )
25 
26 
27 
28 
29 ## _____ _ __ __ _ _ _
30 ## |_ _| __(_) __ _ __ _ ___ _ __ | \/ | __ _| |_ ___| |__ (_)_ __ __ _
31 ## | || '__| |/ _` |/ _` |/ _ \ '__| | |\/| |/ _` | __/ __| '_ \| | '_ \ / _` |
32 ## | || | | | (_| | (_| | __/ | | | | | (_| | || (__| | | | | | | | (_| |
33 ## |_||_| |_|\__, |\__, |\___|_| |_| |_|\__,_|\__\___|_| |_|_|_| |_|\__, |
34 ## |___/ |___/ |___/
35 ##
36 # Trigger ##################
37 #PassingHLT = cms.EDProducer("trgMatchGsfElectronProducer",
38 # InputProducer = myEleCollection,
39 # hltTags = cms.untracked.string( HLTPath ),
40 # triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",HLTProcessName),
41 # triggerResultsTag = cms.untracked.InputTag("TriggerResults","",HLTProcessName)
42 #)
43 
44 
45 
47 ZSCHltFilter = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
48  throw = cms.bool(False),
49  HLTPaths = ['HLT_Ele27_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele15_CaloIdT_CaloIsoVL_trackless_v*']
50  )
51 
52 # elecMetSeq = cms.Sequence( WEnuHltFilter * ele_sequence * elecMetFilter )
53 
54 ###MC check efficiency
55 genEleFromZ = cms.EDFilter("CandViewSelector",
56  src = cms.InputTag("genParticles"),
57  cut = cms.string("(pdgId == 11 || pdgId == -11) && eta <2.5 && eta>-2.5 && pt > 15 && mother(0).pdgId == 23"),
58  )
59 
60 genEleFromW = cms.EDFilter("CandViewSelector",
61  src = cms.InputTag("genParticles"),
62  cut = cms.string("(pdgId == 11 || pdgId == -11) && eta <2.5 && eta>-2.5 && pt > 25 && (mother(0).pdgId == 24 || mother(0).pdgId == -24)"),
63  )
64 
65 genNuFromW = cms.EDFilter("CandViewSelector",
66  src = cms.InputTag("genParticles"),
67  cut = cms.string("(pdgId == 12 || pdgId == -12) && (mother(0).pdgId == 24 || mother(0).pdgId == -24)"),
68  )
69 
70 combZ = cms.EDProducer("CandViewShallowCloneCombiner",
71  decay = cms.string("genEleFromZ genEleFromZ"),
72  checkCharge = cms.bool(False),
73  cut = cms.string("40 < mass < 140"),
74  )
75 
76 combW = cms.EDProducer("CandViewShallowCloneCombiner",
77  decay = cms.string("genEleFromW genNuFromW"),
78  checkCharge = cms.bool(False),
79  cut = cms.string(""),
80  )
81 
82 ZFilterMC = cms.EDFilter("CandViewCountFilter",
83  src = cms.InputTag("combZ"),
84  minNumber = cms.uint32(1)
85  )
86 
87 WFilterMC = cms.EDFilter("CandViewCountFilter",
88  src = cms.InputTag("combW"),
89  minNumber = cms.uint32(1)
90  )
91 
92 
93 ## _____ _ _ ___ _
94 ## | ____| | ___ ___| |_ _ __ ___ _ __ |_ _|__| |
95 ## | _| | |/ _ \/ __| __| '__/ _ \| '_ \ | |/ _` |
96 ## | |___| | __/ (__| |_| | | (_) | | | | | | (_| |
97 ## |_____|_|\___|\___|\__|_| \___/|_| |_| |___\__,_|
98 ##
99 # Electron ID ######
100 
101 selectedECALElectrons = cms.EDFilter("GsfElectronRefSelector",
102  src = myEleCollection,
103  cut = cms.string(
104  "(abs(superCluster.eta)<3) && (energy*sin(superClusterPosition.theta)> 15)")
105  )
106 
107 selectedECALMuons = cms.EDFilter("MuonRefSelector",
108  src = cms.InputTag( 'muons' ),
109  cut = cms.string("")
110  )
111 
112 selectedECALPhotons = cms.EDFilter("PhotonRefSelector",
113  src = cms.InputTag( 'gedPhotons' ),
114  cut = cms.string(
115  "(abs(superCluster.eta)<3) && (pt > 10)")
116  )
117 
118 
119 # This are the cuts at trigger level except ecalIso
120 PassingVetoId = selectedECALElectrons.clone(
121  cut = cms.string(
122  selectedECALElectrons.cut.value() +
123  " && (gsfTrack.hitPattern().numberOfHits(\'MISSING_INNER_HITS\')<=2)"
124  " && ((isEB"
125  " && ( ((pfIsolationVariables().sumChargedHadronPt + max(0.0,pfIsolationVariables().sumNeutralHadronEt + pfIsolationVariables().sumPhotonEt - 0.5 * pfIsolationVariables().sumPUPt))/p4.pt)<0.164369)"
126  " && (full5x5_sigmaIetaIeta<0.011100)"
127  " && ( - 0.252044<deltaPhiSuperClusterTrackAtVtx< 0.252044 )"
128  " && ( -0.016315<deltaEtaSuperClusterTrackAtVtx<0.016315 )"
129  " && (hadronicOverEm<0.345843)"
130  ")"
131  " || (isEE"
132  " && (gsfTrack.hitPattern().numberOfHits(\'MISSING_INNER_HITS\')<=3)"
133  " && ( ((pfIsolationVariables().sumChargedHadronPt + max(0.0,pfIsolationVariables().sumNeutralHadronEt + pfIsolationVariables().sumPhotonEt - 0.5 * pfIsolationVariables().sumPUPt))/p4.pt)<0.212604 )"
134  " && (full5x5_sigmaIetaIeta<0.033987)"
135  " && ( -0.245263<deltaPhiSuperClusterTrackAtVtx<0.245263 )"
136  " && ( -0.010671<deltaEtaSuperClusterTrackAtVtx<0.010671 )"
137  " && (hadronicOverEm<0.134691) "
138  "))"
139  )
140  )
141 
142 PassingMuonVeryLooseId = selectedECALMuons.clone(
143  cut = cms.string(
144  selectedECALMuons.cut.value() +
145  "(isPFMuon) && (isGlobalMuon || isTrackerMuon)"
146  )
147  )
148 
149 PassingPhotonVeryLooseId = selectedECALPhotons.clone(
150  cut = cms.string(
151  selectedECALPhotons.cut.value() +
152  "&& ( (eta<1.479 && sigmaIetaIeta<0.02 && hadronicOverEm<0.06 )"
153  "||"
154  "( eta>=1.479 && sigmaIetaIeta<0.04 && hadronicOverEm<0.06 ) )"
155  )
156  )
157 
158 MuFilter = cms.EDFilter("CandViewCountFilter",
159  src = cms.InputTag("PassingMuonVeryLooseId"),
160  minNumber = cms.uint32(2)
161  )
162 PhoFilter = cms.EDFilter("CandViewCountFilter",
163  src = cms.InputTag("PassingPhotonVeryLooseId"),
164  minNumber = cms.uint32(1)
165  )
166 
167 
168 #------------------------------ electronID producer
169 SCselector = cms.EDFilter("SuperClusterSelector",
170  src = cms.InputTag('correctedMulti5x5SuperClustersWithPreshower'),
171  cut = cms.string('(eta>2.4 || eta<-2.4) && (energy*sin(position.theta)> 15)')
172  )
173 
174 ### Build candidates from all the merged superclusters
175 eleSC = cms.EDProducer('ConcreteEcalCandidateProducer',
176  src = cms.InputTag('SCselector'),
177  particleType = cms.string('gamma')
178  )
179 
180 # selectedCands = cms.EDFilter("AssociatedVariableMaxCutCandRefSelector",
181 # src = cms.InputTag("eleSelectionProducers:loose"),
182 # max = cms.double("0.5")
183 # )
184 
185 #ecalCandidateMerged = cms.EDProducer("CandViewMerger",
186 # src = cms.VInputTag("PassingVetoId", "eleSC")
187 # )
188 
189 eleSelSeq = cms.Sequence( selectedECALElectrons + PassingVetoId +
190  (SCselector*eleSC)
191  )
192 
193 muSelSeq = cms.Sequence( selectedECALMuons + selectedECALPhotons + PassingMuonVeryLooseId + PassingPhotonVeryLooseId + MuFilter + PhoFilter +
194  (SCselector*eleSC)
195  )
196 
197 
198 ############################################################
199 # Selectors
200 ##############################
201 ZeeSelector = cms.EDProducer("CandViewShallowCloneCombiner",
202  decay = cms.string("PassingVetoId PassingVetoId"),
203  checkCharge = cms.bool(False),
204  cut = cms.string("40 < mass < 140")
205  )
206 
207 
208 #met, mt cuts for W selection
209 MT="sqrt(2*daughter(0).pt*daughter(1).pt*(1 - cos(daughter(0).phi - daughter(1).phi)))"
210 MET_CUT_MIN = 25.
211 W_ELECTRON_ET_CUT_MIN = 30.0
212 MT_CUT_MIN = 50.
213 
214 WenuSelector = cms.EDProducer("CandViewShallowCloneCombiner",
215  decay = cms.string("pfMet PassingVetoId"), # charge coniugate states are implied
216  checkCharge = cms.bool(False),
217  cut = cms.string(("daughter(0).pt > %f && daughter(1).pt > %f && "+MT+" > %f") % (MET_CUT_MIN, W_ELECTRON_ET_CUT_MIN, MT_CUT_MIN))
218 )
219 
220 
221 EleSCSelector = cms.EDProducer("CandViewShallowCloneCombiner",
222  decay = cms.string("PassingVetoId eleSC"),
223  checkCharge = cms.bool(False),
224  cut = cms.string("40 < mass < 140")
225  )
226 
227 # for filtering events passing at least one of the filters
228 WZSelector = cms.EDProducer("CandViewMerger",
229  src = cms.VInputTag("WenuSelector", "ZeeSelector", "EleSCSelector")
230  )
231 
232 ############################################################
233 # Filters
234 ##############################
235 WenuFilter = cms.EDFilter("CandViewCountFilter",
236  src = cms.InputTag("WenuSelector"),
237  minNumber = cms.uint32(1)
238  )
239 # filter events with at least one Zee candidate as identified by the ZeeSelector
240 ZeeFilter = cms.EDFilter("CandViewCountFilter",
241  src = cms.InputTag("ZeeSelector"),
242  minNumber = cms.uint32(1)
243  )
244 
245 ZSCFilter = cms.EDFilter("CandViewCountFilter",
246  src = cms.InputTag("EleSCSelector"),
247  minNumber = cms.uint32(1)
248  )
249 
250 # filter for events passing at least one of the other filters
251 WZFilter = cms.EDFilter("CandViewCountFilter",
252  src = cms.InputTag("WZSelector"),
253  minNumber = cms.uint32(1)
254  )
255 
256 
257 
258 ############################################################
259 # Sequences
260 ##############################
261 
262 preFilterSeq = cms.Sequence(MinEleNumberFilter)
263 
264 selectorProducerSeq = cms.Sequence(eleSelSeq * (ZeeSelector + WenuSelector + EleSCSelector) * WZSelector)
265 
266 ZeeSkimFilterSeq = cms.Sequence(preFilterSeq * selectorProducerSeq *
267  ZeeFilter)
268 ZSCSkimFilterSeq = cms.Sequence(preFilterSeq * selectorProducerSeq *
269  ~ZeeFilter * ZSCFilter)
270 WenuSkimFilterSeq = cms.Sequence(preFilterSeq * selectorProducerSeq *
271  ~ZeeFilter * ~ZSCFilter * WenuFilter)
272 
273 
274 checkMCZSeq = cms.Sequence(genEleFromZ * combZ * ZFilterMC) #sequence to check Zskim efficiency respect to the MC
275 checkMCWSeq = cms.Sequence(genEleFromW * genNuFromW * combW * WFilterMC) #sequence to check Wskim efficiency respect to the MC
276 
277 #FilterMuSeq = cms.Sequence(muSelSeq * (ZeeSelector + WenuSelector + EleSCSelector) * WZSelector)