CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Private Attributes
runJetUncertainties.RunJetUncertainties Class Reference
Inheritance diagram for runJetUncertainties.RunJetUncertainties:

Public Member Functions

def __call__
 
def __init__
 
def toolCode
 

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
 
string _label = 'runJetUncertainties'
 

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 runJetUncertainties.RunJetUncertainties.__call__(), editorTools.UserCodeTool._comment, heavyIonTools.ConfigureHeavyIons._comment, HiCoreTools.RestrictInputToAOD._comment, coreTools.RunOnData._comment, trackTools.MakeAODTrackCandidates._comment, metTools.AddMETCollection._comment, heavyIonTools.ProductionDefaults._comment, editorTools.ChangeSource._comment, ConfigToolBase.ConfigToolBase._comment, HiCoreTools.RemoveMCMatching._comment, coreTools.RemoveMCMatching._comment, cmsswVersionTools.PickRelValInputFiles._comment, trackTools.MakePATTrackCandidates._comment, jetTools.AddJetCollection._comment, trigTools.SwitchOnTrigger._comment, heavyIonTools.SelectionDefaults._comment, HiCoreTools.RemoveAllPATObjectsBut._comment, heavyIonTools.DisbaleMonteCarloDeps._comment, HiCoreTools.RemoveSpecificPATObjects._comment, trigTools.SwitchOnTriggerStandAlone._comment, trackTools.MakeTrackCandidates._comment, tauTools.AddTauCollection._comment, trigTools.SwitchOnTriggerMatching._comment, HiCoreTools.RemoveCleaning._comment, HiCoreTools.AddCleaning._comment, trigTools.SwitchOnTriggerMatchingStandAlone._comment, trigTools.SwitchOnTriggerMatchEmbedding._comment, jetTools.SwitchJetCollection._comment, jetTools.AddJetID._comment, jetTools.SetTagInfos._comment, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, runJetUncertainties.RunJetUncertainties._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._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.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, HiCoreTools.RestrictInputToAOD._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, HiCoreTools.RemoveMCMatching._parameters, TAbsFitParticle._parameters, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, jetTools.AddJetCollection._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, HiCoreTools.RemoveAllPATObjectsBut._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, HiCoreTools.RemoveSpecificPATObjects._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, HiCoreTools.RemoveCleaning._parameters, HiCoreTools.AddCleaning._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

20 
21  def __init__(self):
JetMEtUncertaintyTools.__init__(self)

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 metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, runJetUncertainties.RunJetUncertainties._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._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.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), MatrixReader.MatrixReader.apply, DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), HcalDeterministicFit.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), PulseShapeFitOOTPileupCorrection.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(), 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, StackLen, StackDim >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Numeric, Len, Dim >.apply(), Config.ProcessModifier.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), ora::PoolMainTable.setParameter(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by runJetUncertainties.RunJetUncertainties.__init__().

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

Definition at line 74 of file runJetUncertainties.py.

References trigTools._addEventContent(), editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, HiCoreTools.RestrictInputToAOD._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._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, HiCoreTools.RemoveMCMatching._parameters, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, jetTools.AddJetCollection._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, HiCoreTools.RemoveAllPATObjectsBut._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, HiCoreTools.RemoveSpecificPATObjects._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, HiCoreTools.RemoveCleaning._parameters, HiCoreTools.AddCleaning._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, and jetTools.SetTagInfos._parameters.

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

Member Data Documentation

tuple runJetUncertainties.RunJetUncertainties._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 19 of file runJetUncertainties.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), HiCoreTools.RemoveMCMatching.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__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(), 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().

string runJetUncertainties.RunJetUncertainties._label = 'runJetUncertainties'
staticprivate

Definition at line 18 of file runJetUncertainties.py.