CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
runJetUncertainties.RunJetUncertainties Class Reference
Inheritance diagram for runJetUncertainties.RunJetUncertainties:

Public Member Functions

def __call__ (self, process, electronCollection=None, photonCollection=None, muonCollection=None, tauCollection=None, jetCollection=None, dRjetCleaning=None, jetCorrLabel=None, doSmearJets=None, jetSmearFileName=None, jetSmearHistogram=None, jetCorrPayloadName=None, jetCorrLabelUpToL3=None, jetCorrLabelUpToL3Res=None, jecUncertaintyFile=None, jecUncertaintyTag=None, varyByNsigmas=None, addToPatDefaultSequence=None, outputModule=None, postfix=None)
 
def __init__ (self)
 
def toolCode (self, process)
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

 _defaultParameters
 
 _label
 

Detailed Description

Produce collection of pat::Jets with jet energy and resolution shifted up/down,
    in order to estimate effect of systematic uncertainties

Definition at line 13 of file runJetUncertainties.py.

Constructor & Destructor Documentation

def runJetUncertainties.RunJetUncertainties.__init__ (   self)

Definition at line 20 of file runJetUncertainties.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, runJetUncertainties.RunJetUncertainties._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), Python11ParameterSet.addParameter(), cmspython3::Python11ParameterSet.addParameter(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

20  def __init__(self):
21  JetMEtUncertaintyTools.__init__(self)
22  self.addParameter(self._defaultParameters, 'dRjetCleaning', 0.5,
23  "Eta-phi distance for extra jet cleaning", Type=float)
24  self._parameters = copy.deepcopy(self._defaultParameters)
25  self._comment = ""
26 

Member Function Documentation

def runJetUncertainties.RunJetUncertainties.__call__ (   self,
  process,
  electronCollection = None,
  photonCollection = None,
  muonCollection = None,
  tauCollection = None,
  jetCollection = None,
  dRjetCleaning = None,
  jetCorrLabel = None,
  doSmearJets = None,
  jetSmearFileName = None,
  jetSmearHistogram = None,
  jetCorrPayloadName = None,
  jetCorrLabelUpToL3 = None,
  jetCorrLabelUpToL3Res = None,
  jecUncertaintyFile = None,
  jecUncertaintyTag = None,
  varyByNsigmas = None,
  addToPatDefaultSequence = None,
  outputModule = None,
  postfix = None 
)

Definition at line 46 of file runJetUncertainties.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, runJetUncertainties.RunJetUncertainties._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SurveyParameters.apply(), SignedDecayLength3D.apply(), MatrixReader.MatrixReader.apply, DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), AbsOOTPileupCorrection.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::And< bool >.apply(), models.RegExp.apply(), reco::Or< bool >.apply(), reco::Less< T >.apply(), reco::LessEqual< T >.apply(), reco::More< T >.apply(), reco::MoreEqual< T >.apply(), reco::Equal< T >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Numeric, Len, Dim >.apply(), Config.ProcessModifier.apply(), PedeReader.setParameter(), QIE8Simulator.setParameter(), SiStripLorentzAngleCalibration.setParameter(), AbsElectronicODERHS.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

46  postfix = None):
47  JetMEtUncertaintyTools.__call__(
48  self, process,
49  electronCollection = electronCollection,
50  photonCollection = photonCollection,
51  muonCollection = muonCollection,
52  tauCollection = tauCollection,
53  jetCollection = jetCollection,
54  jetCorrLabel = jetCorrLabel,
55  doSmearJets = doSmearJets,
56  jetSmearFileName = jetSmearFileName,
57  jetSmearHistogram = jetSmearHistogram,
58  jetCorrPayloadName = jetCorrPayloadName,
59  jetCorrLabelUpToL3 = jetCorrLabelUpToL3,
60  jetCorrLabelUpToL3Res = jetCorrLabelUpToL3Res,
61  jecUncertaintyFile = jecUncertaintyFile,
62  jecUncertaintyTag = jecUncertaintyTag,
63  varyByNsigmas = varyByNsigmas,
64  addToPatDefaultSequence = addToPatDefaultSequence,
65  outputModule = outputModule,
66  postfix = postfix)
67  if dRjetCleaning is None:
68  dRjetCleaning = self._defaultParameters['dRjetCleaning'].value
69 
70  self.setParameter('dRjetCleaning', dRjetCleaning)
71 
72  self.apply(process)
73 
def runJetUncertainties.RunJetUncertainties.toolCode (   self,
  process 
)

Definition at line 74 of file runJetUncertainties.py.

References trigTools._addEventContent(), editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._parameters, runJetUncertainties.RunJetUncertainties._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.AddJetCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.UpdateJetCollection._parameters, jetTools.AddJetID._parameters, and jetTools.SetTagInfos._parameters.

74  def toolCode(self, process):
75  electronCollection = self._parameters['electronCollection'].value
76  photonCollection = self._parameters['photonCollection'].value
77  muonCollection = self._parameters['muonCollection'].value
78  tauCollection = self._parameters['tauCollection'].value
79  jetCollection = self._parameters['jetCollection'].value
80  jetCorrLabel = self._parameters['jetCorrLabel'].value
81  dRjetCleaning = self._parameters['dRjetCleaning'].value
82  doSmearJets = self._parameters['doSmearJets'].value
83  jetSmearFileName = self._parameters['jetSmearFileName'].value
84  jetSmearHistogram = self._parameters['jetSmearHistogram'].value
85  jetCorrPayloadName = self._parameters['jetCorrPayloadName'].value
86  jetCorrLabelUpToL3 = self._parameters['jetCorrLabelUpToL3'].value
87  jetCorrLabelUpToL3Res = self._parameters['jetCorrLabelUpToL3Res'].value
88  jecUncertaintyFile = self._parameters['jecUncertaintyFile'].value
89  jecUncertaintyTag = self._parameters['jecUncertaintyTag'].value
90  varyByNsigmas = self._parameters['varyByNsigmas'].value
91  addToPatDefaultSequence = self._parameters['addToPatDefaultSequence'].value
92  outputModule = self._parameters['outputModule'].value
93  postfix = self._parameters['postfix'].value
94 
95  if not hasattr(process, "jetUncertaintySequence" + postfix):
96  jetUncertaintySequence = cms.Sequence()
97  setattr(process, "jetUncertaintySequence" + postfix, jetUncertaintySequence)
98  jetUncertaintySequence = getattr(process, "jetUncertaintySequence" + postfix)
99 
100  collectionsToKeep = []
101 
102  # produce collection of jets not overlapping with reconstructed
103  # electrons/photons, muons and tau-jet candidates
104  lastJetCollection, cleanedJetCollection = \
105  self._addCleanedJets(process, jetCollection,
106  electronCollection, photonCollection, muonCollection, tauCollection,
107  jetUncertaintySequence, postfix)
108 
109  # smear jet energies to account for difference in jet resolutions between MC and Data
110  # (cf. JME-10-014 PAS)
111  jetCollectionResUp = None
112  jetCollectionResDown = None
113  if doSmearJets:
114  lastJetCollection = \
115  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value() ],
116  jetSmearFileName, jetSmearHistogram, varyByNsigmas,
117  uncertaintySequence = jetUncertaintySequence, postfix = postfix)
118  jetCollectionResUp = \
119  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value(), "ResUp" ],
120  jetSmearFileName, jetSmearHistogram, varyByNsigmas, -1.,
121  uncertaintySequence = jetUncertaintySequence, postfix = postfix)
122  collectionsToKeep.append(jetCollectionResUp)
123  jetCollectionResDown = \
124  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value(), "ResDown" ],
125  jetSmearFileName, jetSmearHistogram, varyByNsigmas, +1.,
126  uncertaintySequence = jetUncertaintySequence, postfix = postfix)
127  collectionsToKeep.append(jetCollectionResDown)
128 
129  collectionsToKeep.append(lastJetCollection)
130 
131  #--------------------------------------------------------------------------------------------
132  # produce collection of electrons/photons, muons, tau-jet candidates and jets
133  # shifted up/down in energy by their respective energy uncertainties
134  #--------------------------------------------------------------------------------------------
135 
136  shiftedParticleSequence, shiftedParticleCollections, addCollectionsToKeep = \
137  self._addShiftedParticleCollections(process,
138  None,
139  None,
140  None,
141  None,
142  jetCollection, cleanedJetCollection, lastJetCollection,
143  jetCollectionResUp, jetCollectionResDown,
144  jetCorrLabelUpToL3, jetCorrLabelUpToL3Res,
145  jecUncertaintyFile, jecUncertaintyTag,
146  varyByNsigmas,
147  postfix)
148  setattr(process, "shiftedParticlesForJetUncertainties" + postfix, shiftedParticleSequence)
149  jetUncertaintySequence += getattr(process, "shiftedParticlesForJetUncertainties" + postfix)
150  collectionsToKeep.extend(addCollectionsToKeep)
151 
152  # insert metUncertaintySequence into patDefaultSequence
153  if addToPatDefaultSequence:
154  if not hasattr(process, "patDefaultSequence"):
155  raise ValueError("PAT default sequence is not defined !!")
156  process.patDefaultSequence += jetUncertaintySequence
157 
158  # add shifted + unshifted collections pf pat::Electrons/Photons,
159  # Muons, Taus, Jets and MET to PAT-tuple event content
160  if outputModule is not None and hasattr(process, outputModule):
161  getattr(process, outputModule).outputCommands = _addEventContent(
162  getattr(process, outputModule).outputCommands,
163  [ 'keep *_%s_*_%s' % (collectionToKeep, process.name_()) for collectionToKeep in collectionsToKeep ])
164 
def _addEventContent(outputCommands, eventContent)
Definition: trigTools.py:31

Member Data Documentation

runJetUncertainties.RunJetUncertainties._comment
private

Definition at line 25 of file runJetUncertainties.py.

runJetUncertainties.RunJetUncertainties._defaultParameters
staticprivate

Definition at line 19 of file runJetUncertainties.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), editorTools.ChangeSource.__call__(), HiCoreTools.RemoveMCMatching.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), editorTools.UserCodeTool.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.__init__(), editorTools.ChangeSource.__init__(), HiCoreTools.RemoveMCMatching.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), editorTools.ChangeSource.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.initializeInputTag(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

runJetUncertainties.RunJetUncertainties._label
staticprivate
runJetUncertainties.RunJetUncertainties._parameters
private

Definition at line 24 of file runJetUncertainties.py.

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.extractMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getMETUncertainties(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getVariations(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPost(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.produceMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.recomputeRawMetFromPfcs(), HiCoreTools.RestrictInputToAOD.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), HiCoreTools.AddCleaning.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().