CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
WElectronSkim_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 ## _ _
4 ## ___ ___ _ __ ___| |_ __ _ _ __ | |_ ___
5 ## / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __|
6 ## | (_| (_) | | | \__ \ || (_| | | | | |_\__ \
7 ## \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/
8 ##
9 
10 HLTPath = "HLT_Ele*"
11 HLTProcessName = "HLT"
12 
13 #electron cuts
14 ELECTRON_ET_CUT_MIN = 10.0
15 TAG_ELECTRON_ET_CUT_MIN = 20.0
16 W_ELECTRON_ET_CUT_MIN = 27.0
17 ELECTRON_COLL = "gedGsfElectrons"
18 ELECTRON_CUTS = "(abs(superCluster.eta)<2.5) && (ecalEnergy*sin(superClusterPosition.theta)>" + str(ELECTRON_ET_CUT_MIN) + ")"
19 
20 #met, mt cuts for W selection
21 MET_CUT_MIN = 20.
22 MT_CUT_MIN = 50.
23 
24 ## ____ __ _____ _ _
25 ## / ___|___ / _| ____| | ___ ___| |_ _ __ ___ _ __
26 ## | | _/ __| |_| _| | |/ _ \/ __| __| '__/ _ \| '_ \
27 ## | |_| \__ \ _| |___| | __/ (__| |_| | | (_) | | | |
28 ## \____|___/_| |_____|_|\___|\___|\__|_| \___/|_| |_|
29 ##
30 # GsfElectron ################
31 goodElectrons = cms.EDFilter("GsfElectronRefSelector",
32  src = cms.InputTag( ELECTRON_COLL ),
33  cut = cms.string( ELECTRON_CUTS )
34 )
35 
36 GsfMatchedPhotonCands = cms.EDProducer("ElectronMatchedCandidateProducer",
37  src = cms.InputTag("goodPhotons"),
38  ReferenceElectronCollection = cms.untracked.InputTag("goodElectrons"),
39  deltaR = cms.untracked.double(0.3)
40 )
41 
42 ## _____ _ _ ___ _
43 ## | ____| | ___ ___| |_ _ __ ___ _ __ |_ _|__| |
44 ## | _| | |/ _ \/ __| __| '__/ _ \| '_ \ | |/ _` |
45 ## | |___| | __/ (__| |_| | | (_) | | | | | | (_| |
46 ## |_____|_|\___|\___|\__|_| \___/|_| |_| |___\__,_|
47 ##
48 # Electron ID ######
49 PassingWP90 = goodElectrons.clone(
50 cut = cms.string(
51  goodElectrons.cut.value() +
52  " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')<=1 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))" #wrt std WP90 allowing 1 numberOfMissingExpectedHits
53  " && (ecalEnergy*sin(superClusterPosition.theta)>" + str(ELECTRON_ET_CUT_MIN) + ")"
54  " && ((isEB"
55  " && ( dr03TkSumPt/p4.Pt <0.12 && dr03EcalRecHitSumEt/p4.Pt < 0.09 && dr03HcalTowerSumEt/p4.Pt < 0.1 )"
56  " && (sigmaIetaIeta<0.01)"
57  " && ( -0.8<deltaPhiSuperClusterTrackAtVtx<0.8 )"
58  " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
59  " && (hadronicOverEm<0.12)"
60  ")"
61  " || (isEE"
62  " && ( dr03TkSumPt/p4.Pt <0.07 && dr03EcalRecHitSumEt/p4.Pt < 0.07 && dr03HcalTowerSumEt/p4.Pt < 0.07 )"
63  " && (sigmaIetaIeta<0.03)"
64  " && ( -0.7<deltaPhiSuperClusterTrackAtVtx<0.7 )"
65  " && ( -0.009<deltaEtaSuperClusterTrackAtVtx<0.009 )"
66  " && (hadronicOverEm<0.1) "
67  "))"
68  )
69 )
70 
71 PassingWP80 = goodElectrons.clone(
72 cut = cms.string(
73  goodElectrons.cut.value() +
74  " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')==0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
75  " && (ecalEnergy*sin(superClusterPosition.theta)>" + str(ELECTRON_ET_CUT_MIN) + ")"
76  " && ((isEB"
77  " && ( dr03TkSumPt/p4.Pt <0.12 && dr03EcalRecHitSumEt/p4.Pt < 0.09 && dr03HcalTowerSumEt/p4.Pt < 0.1 )" #wrt std WP80 relaxing iso cuts to WP90
78  " && (sigmaIetaIeta<0.01)"
79  " && ( -0.06<deltaPhiSuperClusterTrackAtVtx<0.06 )"
80  " && ( -0.004<deltaEtaSuperClusterTrackAtVtx<0.004 )"
81  " && (hadronicOverEm<0.12)"
82  ")"
83  " || (isEE"
84  " && ( dr03TkSumPt/p4.Pt <0.05 && dr03EcalRecHitSumEt/p4.Pt < 0.06 && dr03HcalTowerSumEt/p4.Pt < 0.03 )"
85  " && (sigmaIetaIeta<0.03)"
86  " && ( -0.03<deltaPhiSuperClusterTrackAtVtx<0.03 )"
87  " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
88  " && (hadronicOverEm<0.10) "
89  "))"
90  )
91 )
92 
93 
94 ## _____ _ __ __ _ _ _
95 ## |_ _| __(_) __ _ __ _ ___ _ __ | \/ | __ _| |_ ___| |__ (_)_ __ __ _
96 ## | || '__| |/ _` |/ _` |/ _ \ '__| | |\/| |/ _` | __/ __| '_ \| | '_ \ / _` |
97 ## | || | | | (_| | (_| | __/ | | | | | (_| | || (__| | | | | | | | (_| |
98 ## |_||_| |_|\__, |\__, |\___|_| |_| |_|\__,_|\__\___|_| |_|_|_| |_|\__, |
99 ## |___/ |___/ |___/
100 ##
101 # Trigger ##################
102 PassingHLT = cms.EDProducer("trgMatchGsfElectronProducer",
103  InputProducer = cms.InputTag( ELECTRON_COLL ),
104  hltTags = cms.untracked.string( HLTPath ),
105  triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",HLTProcessName),
106  triggerResultsTag = cms.untracked.InputTag("TriggerResults","",HLTProcessName),
107  stageL1Trigger = cms.uint32(1)
108 )
109 from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
110 stage2L1Trigger.toModify(PassingHLT, stageL1Trigger = 2)
111 
112 ## _____ ____ __ _ _ _ _
113 ## |_ _|_ _ __ _ | _ \ ___ / _(_)_ __ (_) |_(_) ___ _ __
114 ## | |/ _` |/ _` | | | | |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \
115 ## | | (_| | (_| | | |_| | __/ _| | | | | | |_| | (_) | | | |
116 ## |_|\__,_|\__, | |____/ \___|_| |_|_| |_|_|\__|_|\___/|_| |_|
117 ## |___/
118 ##
119 WElecTagHLT = PassingHLT.clone(
120  InputProducer = cms.InputTag( "PassingWP80" )
121  )
122 
123 ele_sequence = cms.Sequence(
124  goodElectrons +
125  PassingWP80 +
126  WElecTagHLT
127  )
128 
129 
130 ## _____ ___ ____ ____ _
131 ## |_ _( _ ) | _ \ | _ \ __ _(_)_ __ ___
132 ## | | / _ \/\ |_) | | |_) / _` | | '__/ __|
133 ## | || (_> < __/ | __/ (_| | | | \__ \
134 ## |_| \___/\/_| |_| \__,_|_|_| |___/
135 ##
136 ##
137 
138 MT="sqrt(2*daughter(0).pt*daughter(1).pt*(1 - cos(daughter(0).phi - daughter(1).phi)))"
139 elecMet = cms.EDProducer("CandViewShallowCloneCombiner",
140  decay = cms.string("pfMet WElecTagHLT"), # charge coniugate states are implied
141  checkCharge = cms.bool(False),
142  cut = cms.string(("daughter(0).pt > %f && daughter(1).pt > %f && "+MT+" > %f") % (MET_CUT_MIN, W_ELECTRON_ET_CUT_MIN, MT_CUT_MIN))
143 )
144 elecMetCounter = cms.EDFilter("CandViewCountFilter",
145  src = cms.InputTag("elecMet"),
146  minNumber = cms.uint32(1)
147  )
148 elecMetFilter = cms.Sequence(elecMet * elecMetCounter)
149 
151 WEnuHltFilter = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
152  throw = cms.bool(False),
153  HLTPaths = [HLTPath]
154  )
155 
156 #--------------------------#
157 #recompute rho
159 kt6PFJetsForRhoCorrectionWElectronSkim = RecoJets.Configuration.RecoPFJets_cff.kt6PFJets.clone(
160  doRhoFastjet = True,
161  Rho_EtaMax = 2.5
162 )
163 
164 
165 elecMetSeq = cms.Sequence( WEnuHltFilter * ele_sequence * elecMetFilter * kt6PFJetsForRhoCorrectionWElectronSkim)
166 
167 
168 from Configuration.EventContent.AlCaRecoOutput_cff import OutALCARECOEcalCalElectron
169 WElectronSkimContent = OutALCARECOEcalCalElectron.clone()
170 WElectronSkimContent.outputCommands.extend( [
171  "keep *_pfMet_*_*",
172  "keep *_kt6*_rho_*",
173  "keep *_offlinePrimaryVerticesWithBS_*_*",
174  "keep *_generator_*_*",
175  "keep *_rawDataCollector_*_*",
176  'keep recoCaloClusters_*_*_*',
177  'keep recoPreshowerClusters_*_*_*',
178  'keep *_reducedEcalRecHits*_*_*',
179  'keep *_offlineBeamSpot_*_*',
180  'keep *_allConversions_*_*',
181  'keep *_gtDigis_*_*'
182  ] )
#define str(s)