CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

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

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

Constructor & Destructor Documentation

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 249 of file tauTools.py.

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._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, 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(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

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

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

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._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(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), HcalDeterministicFit.apply(), MatrixReader.MatrixReader.apply, DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.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< Numeric >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Numeric, Len, Dim >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.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 tauTools.AddTauCollection.getDefaultParameters().

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

Definition at line 271 of file tauTools.py.

References tauTools.AddTauCollection.__call__(), metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._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, and jetTools.SetTagInfos._defaultParameters.

272  def getDefaultParameters(self):
273  return self._defaultParameters
def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 305 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, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._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(), python.rootplot.root2matplotlib.replace(), tauTools.switchToCaloTau(), and tauTools.switchToPFTauByType().

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

Member Data Documentation

tauTools.AddTauCollection._comment
private

Definition at line 269 of file tauTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__().

tuple tauTools.AddTauCollection._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 248 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__(), trackTools.MakeTrackCandidates.__call__(), tauTools.AddTauCollection.__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__(), 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(), 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().

string tauTools.AddTauCollection._label = 'addTauCollection'
staticprivate

Definition at line 247 of file tauTools.py.

Referenced by validation.SimpleSample.digest(), validation.SimpleSample.label(), trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

tauTools.AddTauCollection._parameters
private

Definition at line 268 of file tauTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), 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().