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

Constructor & Destructor Documentation

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 241 of file tauTools.py.

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, jetTools.AddJetCollection._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.SwitchJetCollection._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().

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

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

Referenced by tauTools.AddTauCollection.getDefaultParameters().

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

Definition at line 263 of file tauTools.py.

References tauTools.AddTauCollection.__call__(), metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, jetTools.AddJetCollection._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.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

264  def getDefaultParameters(self):
265  return self._defaultParameters
def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 297 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, jetTools.AddJetCollection._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, tauTools.AddTauCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, clone(), python.rootplot.root2matplotlib.replace(), tauTools.switchToCaloTau(), and tauTools.switchToPFTauByType().

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

Member Data Documentation

tauTools.AddTauCollection._comment
private

Definition at line 261 of file tauTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__().

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

Definition at line 240 of file tauTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__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__(), metUncertaintyTools.RunMEtUncertainties.__call__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), metUncertaintyTools.RunMEtUncertainties.__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__(), metUncertaintyTools.RunMEtUncertainties._initializeInputTag(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), trackTools.MakeAODTrackCandidates.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), metUncertaintyTools.RunMEtUncertainties.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.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(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string tauTools.AddTauCollection._label = 'addTauCollection'
staticprivate

Definition at line 239 of file tauTools.py.

Referenced by trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

tauTools.AddTauCollection._parameters
private

Definition at line 260 of file tauTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__(), HiCoreTools.RestrictInputToAOD.toolCode(), trackTools.MakeAODTrackCandidates.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trackTools.MakeTrackCandidates.toolCode(), tauTools.AddTauCollection.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and metUncertaintyTools.RunMEtUncertainties.toolCode().