00001 import FWCore.ParameterSet.Config as cms 00002 00003 ## 00004 ## Modules for shifting and smearing 4-vectors' energies of Objects 00005 ## 00006 ## Parameters: 00007 ## - InputTag scaledObject: 00008 ## Specify objects to shift & smear. 00009 ## Object type should correspond to module (e.g. Electron in module ElectronEnergyScale) 00010 ## - bool fixMass: 00011 ## Set to "true", if mass should not be smeared, e.g. for leptons with known masses. 00012 ## IMPORTANT: Don't trust this feature at the moment !!! (s. remarks below) 00013 ## - double shiftFactor: 00014 ## Scales the 4-vector with this fixed value. 00015 ## E.g. to have all muon energies increased by 12.5%, set "1.125" here. 00016 ## Default is "1.", which has -- of course -- no effect 00017 ## - bool useDefaultInitialResolution: 00018 ## Objects contain individual 4-vector resolutions (in terms of Et, theta/eta, phi). 00019 ## Set this to "true" if these should be used to compute initial resolutions for the smearing. 00020 ## - double initialResolution: 00021 ## Initial resolution to be used for the energy smearing. 00022 ## Can be an absolute value (in GeV) or a factor giving the fraction of the smeared energy. 00023 ## Overwritten, if 'useDefaultInitialResolution' is "true". 00024 ## - bool initialResolutionByFraction: 00025 ## Flags the usage mode of 'initialResolution'. 00026 ## E.g. to set the initial resolution to 5% of the energy, set this to "true" and 'initialResolution' to "0.05". 00027 ## To use a fixed resolution of 1GeV, set this to "false" and 'initialResolution' to "1.". 00028 ## - double worsenResolution: 00029 ## Used to calculate the final resolution (after smearing) from the initial resolution. 00030 ## Can be an absolute value (in GeV) or a factor. 00031 ## The energy is smeared with a Gaussion of 00032 ## mu = energy and 00033 ## sigma = sqrt(finalRes^2-iniRes^2) 00034 ## with a cut-off at 0. 00035 ## - bool worsenResolutionByFactor: 00036 ## Flags the usage mode of 'worsenResolution'. 00037 ## 00038 ## Examples: 00039 ## - smear Electron 4-vector (fixed mass) with a fixed initial resolution of 500MeV to as final resolution of 1.25GeV: 00040 ## scaledElectrons = cms.module(ElectronEnergyScale) { 00041 ## scaledObject = cms.InputTag("selectedPatElectrons") 00042 ## fixMass = cms.bool(True) 00043 ## shiftFactor = cms.double(1.) 00044 ## useDefaultInitialResolution = cms.bool(False) 00045 ## initialResolution = cms.double(0.5) 00046 ## initialResolutionByFraction = cms.bool(False) ## alternative: 00047 ## worsenResolution = cms.double(0.75) ## 2.5 00048 ## worsenResolutionByFactor = cms.bool(False) ## true 00049 ## } 00050 ## - smear Muon 4-vector (fixed mass) with a initial resolution of 10% to as final resoltion of 20%: 00051 ## scaledMuons = cms.module(MuonEnergyScale) { 00052 ## scaledObject = cms.InputTag("selectedPatMuons") 00053 ## fixMass = cms.bool(True) 00054 ## shiftFactor = cms.double(1.) 00055 ## useDefaultInitialResolution = cms.bool(True) 00056 ## initialResolution = cms.double(0.1) 00057 ## initialResolutionByFraction = cms.bool(True) 00058 ## worsenResolution = cms.double(2.) 00059 ## worsenResolutionByFactor = cms.bool(True) 00060 ## } 00061 ## - smear Jet 4-vector to a final resoltion of 150% of the default initial resolution: 00062 ## scaledJets = cms.module(JetEnergyScale) { 00063 ## scaledObject = cms.InputTag("selectedPatAK5CaloJets") 00064 ## fixMass = cms.bool(False) ## ===> no fixed mass for the jet 00065 ## shiftFactor = cms.double(1.) 00066 ## useDefaultInitialResolution = cms.bool(True) 00067 ## initialResolution = cms.double(0.05) ## ===> overwritten by "useDefaultInitialResolution = true" 00068 ## initialResolutionByFraction = cms.bool(True) 00069 ## worsenResolution = cms.double(1.5) 00070 ## worsenResolutionByFactor = cms.bool(True) 00071 ## } 00072 ## 00073 ## Remarks: 00074 ## - Due to the inclusion of the default initial resolutions, these modules are limited to Objects for the moment. 00075 ## - The smearing takes care, that final resolutions do not become smaller than initial resolutions. 00076 ## E.g. if (worsenResolution=0.6 && worsenResolutionByFactor=true) is set, it is assumed that the final resolution 00077 ## should be 40% worse than the initial resolution. So, 'worsenResolution' is set to 1.4 internally. 00078 ## (Analogously for (worsenResolution<0. && worsenResolutionByFactor=false).) 00079 ## - To switch off energy shifting, use (shiftFactor=1.). 00080 ## - To switch off energy smearing, use (worsenResolution=0. && worsenResolutionByFactor=false) or 00081 ## (worsenResolution=1. && worsenResolutionByFactor=true). 00082 ## - In the standard sequence at the bottom of this file, Taus are commented. 00083 ## - (fixMass=true) isn't reliable so far :-( 00084 ## The input provided by class Particle is not yet understood (Negative mass for positive mass^2 in contradiction to ROOT::TLorentzVector). 00085 ## 00086 ## Contact: volker.adler@cern.ch 00087 ## 00088 00089 00090 ## initialize random number generator 00091 RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", 00092 scaledElectrons = cms.PSet( 00093 initialSeed = cms.untracked.uint32(897867), 00094 engineName = cms.untracked.string('HepJamesRandom') 00095 ), 00096 scaledMuons = cms.PSet( 00097 initialSeed = cms.untracked.uint32(17987), 00098 engineName = cms.untracked.string('HepJamesRandom') 00099 ), 00100 theSource = cms.PSet( 00101 initialSeed = cms.untracked.uint32(7893456), 00102 engineName = cms.untracked.string('HepJamesRandom') 00103 ), 00104 scaledTaus = cms.PSet( 00105 initialSeed = cms.untracked.uint32(38476), 00106 engineName = cms.untracked.string('HepJamesRandom') 00107 ), 00108 scaledJets = cms.PSet( 00109 initialSeed = cms.untracked.uint32(61587), 00110 engineName = cms.untracked.string('HepJamesRandom') 00111 ), 00112 scaledMETs = cms.PSet( 00113 initialSeed = cms.untracked.uint32(3489766), 00114 engineName = cms.untracked.string('HepJamesRandom') 00115 ) 00116 ) 00117 00118 ## Electrons 00119 scaledElectrons = cms.EDFilter("ElectronEnergyScale", 00120 scaledObject = cms.InputTag("selectedPatElectrons"), 00121 fixMass = cms.bool(False), 00122 shiftFactor = cms.double(1.), 00123 useDefaultInitialResolution = cms.bool(True), 00124 initialResolution = cms.double(0.), 00125 initialResolutionByFraction = cms.bool(True), 00126 worsenResolution = cms.double(1.), 00127 worsenResolutionByFactor = cms.bool(True), 00128 ) 00129 00130 ## Muons 00131 scaledMuons = cms.EDFilter("MuonEnergyScale", 00132 scaledObject = cms.InputTag("selectedPatMuons"), 00133 fixMass = cms.bool(False), 00134 shiftFactor = cms.double(1.), 00135 useDefaultInitialResolution = cms.bool(True), 00136 initialResolution = cms.double(0.), 00137 initialResolutionByFraction = cms.bool(True), 00138 worsenResolution = cms.double(1.), 00139 worsenResolutionByFactor = cms.bool(True), 00140 ) 00141 00142 ## Taus 00143 scaledTaus = cms.EDFilter("TauEnergyScale", 00144 scaledObject = cms.InputTag("selectedPatTaus"), 00145 fixMass = cms.bool(False), 00146 shiftFactor = cms.double(1.), 00147 useDefaultInitialResolution = cms.bool(True), 00148 initialResolution = cms.double(0.), 00149 initialResolutionByFraction = cms.bool(True), 00150 worsenResolution = cms.double(1.), 00151 worsenResolutionByFactor = cms.bool(True), 00152 ) 00153 00154 ## Jets 00155 scaledJets = cms.EDFilter("JetEnergyScale", 00156 scaledObject = cms.InputTag("selectedPatJets"), 00157 fixMass = cms.bool(False), 00158 shiftFactor = cms.double(1.), 00159 useDefaultInitialResolution = cms.bool(True), 00160 initialResolution = cms.double(0.), 00161 initialResolutionByFraction = cms.bool(True), 00162 worsenResolution = cms.double(1.), 00163 worsenResolutionByFactor = cms.bool(True), 00164 ) 00165 00166 ## METs 00167 scaledMETs = cms.EDFilter("METEnergyScale", 00168 scaledObject = cms.InputTag("selectedPatMETs"), 00169 fixMass = cms.bool(False), 00170 shiftFactor = cms.double(1.), 00171 useDefaultInitialResolution = cms.bool(True), 00172 initialResolution = cms.double(0.), 00173 initialResolutionByFraction = cms.bool(True), 00174 worsenResolution = cms.double(1.), 00175 worsenResolutionByFactor = cms.bool(True), 00176 ) 00177 00178 ## Standard sequence for all Objects 00179 scaledObjects = cms.Sequence( 00180 scaledElectrons + 00181 scaledMuons + 00182 scaledJets + 00183 # scaledTaus + 00184 scaledMETs 00185 )