ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Betchart/TopRefTuple/python/tuple.py
Revision: 1.13
Committed: Fri Nov 16 06:11:42 2012 UTC (12 years, 5 months ago) by bbetchar
Content type: text/x-python
Branch: MAIN
Changes since 1.12: +15 -4 lines
Log Message:
smearing and resolutions

File Contents

# Content
1 import math
2 from FWCore.ParameterSet import Config as cms
3
4 def tags(stuff) :
5 return ( cms.InputTag(stuff) if type(stuff)!=list else
6 cms.VInputTag([tags(item) for item in stuff]) )
7
8 class Tuple(object) :
9
10 def __init__(self,process,options) :
11 self.process = process
12 self.options = options
13 self.empty = process.empty = cms.Sequence()
14
15 def path(self) :
16 return cms.Path( self.events() *
17 self.gen() *
18 self.triggers() *
19 self.electron() *
20 self.muon() *
21 self.met() *
22 self.jet() *
23 #vertex
24 self.tree() )
25
26 def attr(self, item) : return getattr(self.process, item)
27
28 def tree(self) :
29 self.process.topRef = cms.EDAnalyzer( "TreeMaker", outputCommands = cms.untracked.vstring(
30 'drop *',
31 'keep *_tuple*_*_*',) )
32 return self.process.topRef
33
34 def events(self) :
35 self.process.tupleEvents = cms.EDProducer("Tuple_Event")
36 return self.empty + self.process.tupleEvents
37
38 def gen(self) :
39 if self.options.isData : return self.empty
40 self.process.tupleGen = cms.EDProducer("Tuple_GenParticle",
41 InputTag = tags('genParticles'),
42 JetCollections = tags([]),
43 Prefix = cms.string('gen'),
44 Suffix = cms.string(''),
45 GenStatus1PtCut = cms.double(1000.0),
46 GenJetPtCut = cms.double(10.0),
47 )
48 self.process.tuplePileup = cms.EDProducer("Tuple_PileupSummary",
49 InputTag = tags('addPileupInfo'),
50 Prefix = cms.string('pileup'),
51 Suffix = cms.string('')
52 )
53 return self.empty + self.process.tupleGen + self.process.tuplePileup
54
55 def triggers(self) :
56 if not self.options.isData : return self.empty
57 self.process.tupleTriggers = cms.EDProducer("Tuple_Triggers",
58 InputTag = tags('TriggerResults'),
59 TriggerEventInputTag = tags('hltTriggerSummaryAOD'),
60 )
61 return self.empty + self.process.tupleTriggers
62
63 def electron(self) :
64 self.process.tupleElectron = cms.EDProducer("Tuple_Electron",
65 electronTag = tags('selectedPatElectrons'+self.options.postfix),
66 vertexTag = tags('goodOfflinePrimaryVertices'),
67 prefix = cms.string('el'),
68 electronIDs = cms.vstring('mvaTrigV0')
69 )
70 return self.empty + self.process.tupleElectron
71
72
73 def muon(self) :
74 self.process.tupleMuon = cms.EDProducer("Tuple_Muon",
75 muonTag = tags('selectedPatMuons'+self.options.postfix),
76 vertexTag = tags('goodOfflinePrimaryVertices'),
77 prefix = cms.string('mu') )
78 return self.empty + self.process.tupleMuon
79
80 def met(self) :
81 self.process.tupleMET = cms.EDProducer("Tuple_PatMET",
82 metTag = tags("patMETs"+self.options.postfix),
83 prefix = cms.string("met"),
84 particlesTag = tags("particleFlow"),
85 particlesPrefix = cms.string('pf')
86 )
87 return self.empty + self.process.tupleMET
88
89 def jet(self) :
90 self.process.tupleJet = cms.EDProducer("Tuple_PatJet",
91 prefix = cms.string("jet"),
92 jetsTag = tags("selectedPatJets"+self.options.postfix),
93 allJetsTag = tags("patJets"+self.options.postfix),
94 jecRecord = cms.string("AK5PFchs"),
95 bTags = cms.vstring(self.options.btags),
96 pfInfo = cms.bool(True),
97 genInfo = cms.bool( not self.options.isData),
98 jetResolutionFile = cms.string('Spring10_PtResolution_AK5PF.txt'),
99
100 # https://twiki.cern.ch/twiki/bin/view/CMS/JetResolution
101 resolutionRatioBins = cms.vdouble(0.0, 0.5, 1.1, 1.7, 2.3, 5.0),
102 resolutionRatio = cms.vdouble(1.052, 1.057, 1.096, 1.134, 1.288),
103 resolutionRatioErr = cms.vdouble( math.sqrt( 0.012**2 + 0.0615**2 ),
104 math.sqrt( 0.012**2 + 0.0555**2 ),
105 math.sqrt( 0.017**2 + 0.0625**2 ),
106 math.sqrt( 0.035**2 + 0.086**2 ),
107 math.sqrt( 0.127**2 + 0.154**2 )
108 )
109 )
110 return self.empty + self.process.tupleJet