test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
objectEnergyScale_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 ##
4 ## Modules for shifting and smearing 4-vectors' energies of Objects
5 ##
6 ## Parameters:
7 ## - InputTag scaledObject:
8 ## Specify objects to shift & smear.
9 ## Object type should correspond to module (e.g. Electron in module ElectronEnergyScale)
10 ## - bool fixMass:
11 ## Set to "true", if mass should not be smeared, e.g. for leptons with known masses.
12 ## IMPORTANT: Don't trust this feature at the moment !!! (s. remarks below)
13 ## - double shiftFactor:
14 ## Scales the 4-vector with this fixed value.
15 ## E.g. to have all muon energies increased by 12.5%, set "1.125" here.
16 ## Default is "1.", which has -- of course -- no effect
17 ## - bool useDefaultInitialResolution:
18 ## Objects contain individual 4-vector resolutions (in terms of Et, theta/eta, phi).
19 ## Set this to "true" if these should be used to compute initial resolutions for the smearing.
20 ## - double initialResolution:
21 ## Initial resolution to be used for the energy smearing.
22 ## Can be an absolute value (in GeV) or a factor giving the fraction of the smeared energy.
23 ## Overwritten, if 'useDefaultInitialResolution' is "true".
24 ## - bool initialResolutionByFraction:
25 ## Flags the usage mode of 'initialResolution'.
26 ## E.g. to set the initial resolution to 5% of the energy, set this to "true" and 'initialResolution' to "0.05".
27 ## To use a fixed resolution of 1GeV, set this to "false" and 'initialResolution' to "1.".
28 ## - double worsenResolution:
29 ## Used to calculate the final resolution (after smearing) from the initial resolution.
30 ## Can be an absolute value (in GeV) or a factor.
31 ## The energy is smeared with a Gaussion of
32 ## mu = energy and
33 ## sigma = sqrt(finalRes^2-iniRes^2)
34 ## with a cut-off at 0.
35 ## - bool worsenResolutionByFactor:
36 ## Flags the usage mode of 'worsenResolution'.
37 ##
38 ## Examples:
39 ## - smear Electron 4-vector (fixed mass) with a fixed initial resolution of 500MeV to as final resolution of 1.25GeV:
40 ## scaledElectrons = cms.module(ElectronEnergyScale) {
41 ## scaledObject = cms.InputTag("selectedPatElectrons")
42 ## fixMass = cms.bool(True)
43 ## shiftFactor = cms.double(1.)
44 ## useDefaultInitialResolution = cms.bool(False)
45 ## initialResolution = cms.double(0.5)
46 ## initialResolutionByFraction = cms.bool(False) ## alternative:
47 ## worsenResolution = cms.double(0.75) ## 2.5
48 ## worsenResolutionByFactor = cms.bool(False) ## true
49 ## }
50 ## - smear Muon 4-vector (fixed mass) with a initial resolution of 10% to as final resoltion of 20%:
51 ## scaledMuons = cms.module(MuonEnergyScale) {
52 ## scaledObject = cms.InputTag("selectedPatMuons")
53 ## fixMass = cms.bool(True)
54 ## shiftFactor = cms.double(1.)
55 ## useDefaultInitialResolution = cms.bool(True)
56 ## initialResolution = cms.double(0.1)
57 ## initialResolutionByFraction = cms.bool(True)
58 ## worsenResolution = cms.double(2.)
59 ## worsenResolutionByFactor = cms.bool(True)
60 ## }
61 ## - smear Jet 4-vector to a final resoltion of 150% of the default initial resolution:
62 ## scaledJets = cms.module(JetEnergyScale) {
63 ## scaledObject = cms.InputTag("selectedPatAK5CaloJets")
64 ## fixMass = cms.bool(False) ## ===> no fixed mass for the jet
65 ## shiftFactor = cms.double(1.)
66 ## useDefaultInitialResolution = cms.bool(True)
67 ## initialResolution = cms.double(0.05) ## ===> overwritten by "useDefaultInitialResolution = true"
68 ## initialResolutionByFraction = cms.bool(True)
69 ## worsenResolution = cms.double(1.5)
70 ## worsenResolutionByFactor = cms.bool(True)
71 ## }
72 ##
73 ## Remarks:
74 ## - Due to the inclusion of the default initial resolutions, these modules are limited to Objects for the moment.
75 ## - The smearing takes care, that final resolutions do not become smaller than initial resolutions.
76 ## E.g. if (worsenResolution=0.6 && worsenResolutionByFactor=true) is set, it is assumed that the final resolution
77 ## should be 40% worse than the initial resolution. So, 'worsenResolution' is set to 1.4 internally.
78 ## (Analogously for (worsenResolution<0. && worsenResolutionByFactor=false).)
79 ## - To switch off energy shifting, use (shiftFactor=1.).
80 ## - To switch off energy smearing, use (worsenResolution=0. && worsenResolutionByFactor=false) or
81 ## (worsenResolution=1. && worsenResolutionByFactor=true).
82 ## - In the standard sequence at the bottom of this file, Taus are commented.
83 ## - (fixMass=true) isn't reliable so far :-(
84 ## The input provided by class Particle is not yet understood (Negative mass for positive mass^2 in contradiction to ROOT::TLorentzVector).
85 ##
86 ## Contact: volker.adler@cern.ch
87 ##
88 
89 
90 ## initialize random number generator
91 RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
92  scaledElectrons = cms.PSet(
93  initialSeed = cms.untracked.uint32(897867),
94  engineName = cms.untracked.string('HepJamesRandom')
95  ),
96  scaledMuons = cms.PSet(
97  initialSeed = cms.untracked.uint32(17987),
98  engineName = cms.untracked.string('HepJamesRandom')
99  ),
100  theSource = cms.PSet(
101  initialSeed = cms.untracked.uint32(7893456),
102  engineName = cms.untracked.string('HepJamesRandom')
103  ),
104  scaledTaus = cms.PSet(
105  initialSeed = cms.untracked.uint32(38476),
106  engineName = cms.untracked.string('HepJamesRandom')
107  ),
108  scaledJets = cms.PSet(
109  initialSeed = cms.untracked.uint32(61587),
110  engineName = cms.untracked.string('HepJamesRandom')
111  ),
112  scaledMETs = cms.PSet(
113  initialSeed = cms.untracked.uint32(3489766),
114  engineName = cms.untracked.string('HepJamesRandom')
115  )
116 )
117 
118 ## Electrons
119 scaledElectrons = cms.EDFilter("ElectronEnergyScale",
120  scaledObject = cms.InputTag("selectedPatElectrons"),
121  fixMass = cms.bool(False),
122  shiftFactor = cms.double(1.),
123  useDefaultInitialResolution = cms.bool(True),
124  initialResolution = cms.double(0.),
125  initialResolutionByFraction = cms.bool(True),
126  worsenResolution = cms.double(1.),
127  worsenResolutionByFactor = cms.bool(True),
128 )
129 
130 ## Muons
131 scaledMuons = cms.EDFilter("MuonEnergyScale",
132  scaledObject = cms.InputTag("selectedPatMuons"),
133  fixMass = cms.bool(False),
134  shiftFactor = cms.double(1.),
135  useDefaultInitialResolution = cms.bool(True),
136  initialResolution = cms.double(0.),
137  initialResolutionByFraction = cms.bool(True),
138  worsenResolution = cms.double(1.),
139  worsenResolutionByFactor = cms.bool(True),
140 )
141 
142 ## Taus
143 scaledTaus = cms.EDFilter("TauEnergyScale",
144  scaledObject = cms.InputTag("selectedPatTaus"),
145  fixMass = cms.bool(False),
146  shiftFactor = cms.double(1.),
147  useDefaultInitialResolution = cms.bool(True),
148  initialResolution = cms.double(0.),
149  initialResolutionByFraction = cms.bool(True),
150  worsenResolution = cms.double(1.),
151  worsenResolutionByFactor = cms.bool(True),
152 )
153 
154 ## Jets
155 scaledJets = cms.EDFilter("JetEnergyScale",
156  scaledObject = cms.InputTag("selectedPatJets"),
157  fixMass = cms.bool(False),
158  shiftFactor = cms.double(1.),
159  useDefaultInitialResolution = cms.bool(True),
160  initialResolution = cms.double(0.),
161  initialResolutionByFraction = cms.bool(True),
162  worsenResolution = cms.double(1.),
163  worsenResolutionByFactor = cms.bool(True),
164 )
165 
166 ## METs
167 scaledMETs = cms.EDFilter("METEnergyScale",
168  scaledObject = cms.InputTag("selectedPatMETs"),
169  fixMass = cms.bool(False),
170  shiftFactor = cms.double(1.),
171  useDefaultInitialResolution = cms.bool(True),
172  initialResolution = cms.double(0.),
173  initialResolutionByFraction = cms.bool(True),
174  worsenResolution = cms.double(1.),
175  worsenResolutionByFactor = cms.bool(True),
176 )
177 
178 ## Standard sequence for all Objects
179 scaledObjects = cms.Sequence(
180  scaledElectrons +
181  scaledMuons +
182  scaledJets +
183 # scaledTaus +
184  scaledMETs
185 )