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 237 of file tauTools.py.

Constructor & Destructor Documentation

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 246 of file tauTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._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, 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().

246  def __init__(self):
247  ConfigToolBase.__init__(self)
248  self.addParameter(self._defaultParameters, 'tauCollection',
249  self._defaultValue, 'Input tau collection', cms.InputTag)
250  self.addParameter(self._defaultParameters, 'algoLabel',
251  self._defaultValue, "label to indicate the tau algorithm (e.g.'hps')", str)
252  self.addParameter(self._defaultParameters, 'typeLabel',
253  self._defaultValue, "label to indicate the type of constituents (either 'PFTau' or 'Tau')", str)
254  self.addParameter(self._defaultParameters, 'doPFIsoDeposits',
255  True, "run sequence for computing particle-flow based IsoDeposits")
256  self.addParameter(self._defaultParameters, 'standardAlgo',
257  "hps", "standard algorithm label of the collection from which the clones " \
258  + "for the new tau collection will be taken from " \
259  + "(note that this tau collection has to be available in the event before hand)")
260  self.addParameter(self._defaultParameters, 'standardType',
261  "PFTau", "standard constituent type label of the collection from which the clones " \
262  + " for the new tau collection will be taken from "\
263  + "(note that this tau collection has to be available in the event before hand)")
264 
265  self._parameters=copy.deepcopy(self._defaultParameters)
266  self._comment = ""
267 

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 278 of file tauTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._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(), gen::PhotosInterfaceBase.apply(), SurveyParameters.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), DummyOOTPileupCorrection.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), ConfigToolBase.ConfigToolBase.apply(), OOTPileupCorrData.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), AbsOOTPileupCorrection.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), TwoBowedSurfacesAlignmentParameters.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(), ArrayND< Num2, Len2, Dim2 >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Accumulator >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.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().

278  standardType = None):
279 
280  if tauCollection is None:
281  tauCollection = self._defaultParameters['tauCollection'].value
282  if algoLabel is None:
283  algoLabel = self._defaultParameters['algoLabel'].value
284  if typeLabel is None:
285  typeLabel = self._defaultParameters['typeLabel'].value
286  if doPFIsoDeposits is None:
287  doPFIsoDeposits = self._defaultParameters['doPFIsoDeposits'].value
288  if standardAlgo is None:
289  standardAlgo = self._defaultParameters['standardAlgo'].value
290  if standardType is None:
291  standardType = self._defaultParameters['standardType'].value
292 
293  self.setParameter('tauCollection', tauCollection)
294  self.setParameter('algoLabel', algoLabel)
295  self.setParameter('typeLabel', typeLabel)
296  self.setParameter('doPFIsoDeposits', doPFIsoDeposits)
297  self.setParameter('standardAlgo', standardAlgo)
298  self.setParameter('standardType', standardType)
299 
300  self.apply(process)
301 
def tauTools.AddTauCollection.getDefaultParameters (   self)
def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 302 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(), tauTools.switchToCaloTau(), and tauTools.switchToPFTauByType().

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

Member Data Documentation

tauTools.AddTauCollection._comment
private

Definition at line 266 of file tauTools.py.

tauTools.AddTauCollection._defaultParameters
staticprivate

Definition at line 245 of file tauTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), editorTools.ChangeSource.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), tauTools.AddTauCollection.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), editorTools.UserCodeTool.__init__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.__init__(), editorTools.ChangeSource.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), tauTools.AddTauCollection.__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(), editorTools.ChangeSource.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), tauTools.AddTauCollection.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 265 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(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), tauTools.AddTauCollection.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().