CMS 3D CMS Logo

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

Public Member Functions

def __call__ (self, process, tauCollection=None, algoLabel=None, typeLabel=None, doPFIsoDeposits=None, jetCorrLabel=None, standardAlgo=None, standardType=None)
 
def __init__ (self)
 
def getDefaultParameters (self)
 
def toolCode (self, process)
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

 _defaultParameters
 
 _label
 

Detailed Description

Add a new collection of taus. Takes the configuration from the
already configured standard tau collection as starting point;
replaces before calling addTauCollection will also affect the
new tau collections

Definition at line 211 of file tauTools.py.

Constructor & Destructor Documentation

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 220 of file tauTools.py.

References editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, ConfigToolBase.ConfigToolBase._defaultValue, GenObject.GenObject._defaultValue, 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().

220  def __init__(self):
221  ConfigToolBase.__init__(self)
222  self.addParameter(self._defaultParameters, 'tauCollection',
223  self._defaultValue, 'Input tau collection', cms.InputTag)
224  self.addParameter(self._defaultParameters, 'algoLabel',
225  self._defaultValue, "label to indicate the tau algorithm (e.g.'hps')", str)
226  self.addParameter(self._defaultParameters, 'typeLabel',
227  self._defaultValue, "label to indicate the type of constituents (either 'PFTau' or 'Tau')", str)
228  self.addParameter(self._defaultParameters, 'doPFIsoDeposits',
229  True, "run sequence for computing particle-flow based IsoDeposits")
230  self.addParameter(self._defaultParameters, 'standardAlgo',
231  "hps", "standard algorithm label of the collection from which the clones " \
232  + "for the new tau collection will be taken from " \
233  + "(note that this tau collection has to be available in the event before hand)")
234  self.addParameter(self._defaultParameters, 'standardType',
235  "PFTau", "standard constituent type label of the collection from which the clones " \
236  + " for the new tau collection will be taken from "\
237  + "(note that this tau collection has to be available in the event before hand)")
238 
239  self._parameters=copy.deepcopy(self._defaultParameters)
240  self._comment = ""
241 

Member Function Documentation

def tauTools.AddTauCollection.__call__ (   self,
  process,
  tauCollection = None,
  algoLabel = None,
  typeLabel = None,
  doPFIsoDeposits = None,
  jetCorrLabel = None,
  standardAlgo = None,
  standardType = None 
)

Definition at line 252 of file tauTools.py.

References editorTools.UserCodeTool._defaultParameters, metTools.AddMETCollection._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), gen::PhotosInterfaceBase.apply(), SurveyParameters.apply(), DummyOOTPileupCorrection.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), RigidBodyAlignmentParameters.apply(), BeamSpotAlignmentParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), AlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.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(), cmsswVersionTools.PickRelValInputFiles.apply(), models.RegExp.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), npstat::ArrayND< Numeric >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Numeric, Len, Dim >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), Config.ProcessModifier.apply(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), SiStripLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by tauTools.AddTauCollection.getDefaultParameters().

252  standardType = None):
253 
254  if tauCollection is None:
255  tauCollection = self._defaultParameters['tauCollection'].value
256  if algoLabel is None:
257  algoLabel = self._defaultParameters['algoLabel'].value
258  if typeLabel is None:
259  typeLabel = self._defaultParameters['typeLabel'].value
260  if doPFIsoDeposits is None:
261  doPFIsoDeposits = self._defaultParameters['doPFIsoDeposits'].value
262  if standardAlgo is None:
263  standardAlgo = self._defaultParameters['standardAlgo'].value
264  if standardType is None:
265  standardType = self._defaultParameters['standardType'].value
266 
267  self.setParameter('tauCollection', tauCollection)
268  self.setParameter('algoLabel', algoLabel)
269  self.setParameter('typeLabel', typeLabel)
270  self.setParameter('doPFIsoDeposits', doPFIsoDeposits)
271  self.setParameter('standardAlgo', standardAlgo)
272  self.setParameter('standardType', standardType)
273 
274  self.apply(process)
275 
def tauTools.AddTauCollection.getDefaultParameters (   self)
def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 276 of file tauTools.py.

References editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._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, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, tauTools.AddTauCollection._parameters, jetTools.AddJetCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.UpdateJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, clone(), edm.print(), python.rootplot.root2matplotlib.replace(), and tauTools.switchToPFTauByType().

276  def toolCode(self, process):
277  tauCollection = self._parameters['tauCollection'].value
278  algoLabel = self._parameters['algoLabel'].value
279  typeLabel = self._parameters['typeLabel'].value
280  doPFIsoDeposits = self._parameters['doPFIsoDeposits'].value
281  standardAlgo = self._parameters['standardAlgo'].value
282  standardType = self._parameters['standardType'].value
283 
284  ## disable computation of particle-flow based IsoDeposits
285  ## in case tau is of CaloTau type
286  if typeLabel == 'Tau':
287  print("NO PF Isolation will be computed for CaloTau (this could be improved later)")
288  doPFIsoDeposits = False
289 
290  ## create old module label from standardAlgo
291  ## and standardType and return
292  def oldLabel(prefix = ''):
293  if prefix == '':
294  return "patTaus"
295  else:
296  return prefix + "PatTaus"
297 
298  ## capitalize first character of appended part
299  ## when creating new module label
300  ## (giving e.g. "patTausCaloRecoTau")
301  def capitalize(label):
302  return label[0].capitalize() + label[1:]
303 
304  ## create new module label from old module
305  ## label and return
306  def newLabel(oldLabel):
307  newLabel = oldLabel
308  if ( oldLabel.find(standardAlgo) >= 0 and oldLabel.find(standardType) >= 0 ):
309  oldLabel = oldLabel.replace(standardAlgo, algoLabel).replace(standardType, typeLabel)
310  else:
311  oldLabel = oldLabel + capitalize(algoLabel + typeLabel)
312  return oldLabel
313 
314  ## clone module and add it to the patDefaultSequence
315  def addClone(hook, **replaceStatements):
316  ## create a clone of the hook with corresponding
317  ## parameter replacements
318  newModule = getattr(process, hook).clone(**replaceStatements)
319 
320  ## clone module for computing particle-flow IsoDeposits
321  def addPFIsoDepositClone(hook, **replaceStatements):
322  newModule = getattr(process, hook).clone(**replaceStatements)
323  newModuleIsoDepositExtractor = getattr(newModule, "ExtractorPSet")
324  setattr(newModuleIsoDepositExtractor, "tauSource", getattr(newModule, "src"))
325 
326  ## add a clone of patTaus
327  addClone(oldLabel(), tauSource = tauCollection)
328 
329  ## add a clone of selectedPatTaus
330  addClone(oldLabel('selected'), src = cms.InputTag(newLabel(oldLabel())))
331 
332  ## add a clone of cleanPatTaus
333  addClone(oldLabel('clean'), src=cms.InputTag(newLabel(oldLabel('selected'))))
334 
335  ## get attributes of new module
336  newTaus = getattr(process, newLabel(oldLabel()))
337 
338  ## add a clone of gen tau matching
339  addClone('tauMatch', src = tauCollection)
340  addClone('tauGenJetMatch', src = tauCollection)
341 
342  ## add a clone of IsoDeposits computed based on particle-flow
343  if doPFIsoDeposits:
344  addPFIsoDepositClone('tauIsoDepositPFCandidates', src = tauCollection)
345  addPFIsoDepositClone('tauIsoDepositPFChargedHadrons', src = tauCollection)
346  addPFIsoDepositClone('tauIsoDepositPFNeutralHadrons', src = tauCollection)
347  addPFIsoDepositClone('tauIsoDepositPFGammas', src = tauCollection)
348 
349  ## fix label for input tag
350  def fixInputTag(x):
351  x.setModuleLabel(newLabel(x.moduleLabel))
352 
353  ## provide patTau inputs with individual labels
354  fixInputTag(newTaus.genParticleMatch)
355  fixInputTag(newTaus.genJetMatch)
356  fixInputTag(newTaus.isoDeposits.pfAllParticles)
357  fixInputTag(newTaus.isoDeposits.pfNeutralHadron)
358  fixInputTag(newTaus.isoDeposits.pfChargedHadron)
359  fixInputTag(newTaus.isoDeposits.pfGamma)
360  fixInputTag(newTaus.userIsolation.pfAllParticles.src)
361  fixInputTag(newTaus.userIsolation.pfNeutralHadron.src)
362  fixInputTag(newTaus.userIsolation.pfChargedHadron.src)
363  fixInputTag(newTaus.userIsolation.pfGamma.src)
364 
365  ## set discriminators
366  ## (using switchTauCollection functions)
367  oldTaus = getattr(process, oldLabel())
368  switchToPFTauByType(process, pfTauType = algoLabel + typeLabel,
369  tauSource = getattr(newTaus, "tauSource"),
370  patTauLabel = capitalize(algoLabel + typeLabel))
371 
372 addTauCollection=AddTauCollection()
373 
def replace(string, replacements)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def switchToPFTauByType(process, pfTauType=None, tauSource=cms.InputTag('hpsPFTauProducer'), patTauLabel="", postfix="")
Definition: tauTools.py:199
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def toolCode(self, process)
Definition: tauTools.py:276

Member Data Documentation

tauTools.AddTauCollection._comment
private

Definition at line 240 of file tauTools.py.

tauTools.AddTauCollection._defaultParameters
staticprivate

Definition at line 219 of file tauTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), tauTools.AddTauCollection.__call__(), trackTools.MakeTrackCandidates.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), tauTools.AddTauCollection.__init__(), trackTools.MakeTrackCandidates.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), trackTools.MakeAODTrackCandidates.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), tauTools.AddTauCollection.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.initializeInputTag(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

tauTools.AddTauCollection._parameters
private

Definition at line 239 of file tauTools.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(), trackTools.MakeAODTrackCandidates.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), tauTools.AddTauCollection.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().