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

Constructor & Destructor Documentation

◆ __init__()

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 225 of file tauTools.py.

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

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, 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().

Member Function Documentation

◆ __call__()

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

Definition at line 250 of file tauTools.py.

250  def __call__(self,process,
251  tauCollection = None,
252  algoLabel = None,
253  typeLabel = None,
254  doPFIsoDeposits = None,
255  jetCorrLabel = None,
256  standardAlgo = None,
257  standardType = None):
258 
259  if tauCollection is None:
260  tauCollection = self._defaultParameters['tauCollection'].value
261  if algoLabel is None:
262  algoLabel = self._defaultParameters['algoLabel'].value
263  if typeLabel is None:
264  typeLabel = self._defaultParameters['typeLabel'].value
265  if doPFIsoDeposits is None:
266  doPFIsoDeposits = self._defaultParameters['doPFIsoDeposits'].value
267  if standardAlgo is None:
268  standardAlgo = self._defaultParameters['standardAlgo'].value
269  if standardType is None:
270  standardType = self._defaultParameters['standardType'].value
271 
272  self.setParameter('tauCollection', tauCollection)
273  self.setParameter('algoLabel', algoLabel)
274  self.setParameter('typeLabel', typeLabel)
275  self.setParameter('doPFIsoDeposits', doPFIsoDeposits)
276  self.setParameter('standardAlgo', standardAlgo)
277  self.setParameter('standardType', standardType)
278 
279  self.apply(process)
280 

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(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), gen::PhotosInterfaceBase.apply(), DummyOOTPileupCorrection.apply(), SurveyParameters.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), AlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), models.RegExp.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.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().

◆ getDefaultParameters()

def tauTools.AddTauCollection.getDefaultParameters (   self)

◆ toolCode()

def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 281 of file tauTools.py.

281  def toolCode(self, process):
282  tauCollection = self._parameters['tauCollection'].value
283  algoLabel = self._parameters['algoLabel'].value
284  typeLabel = self._parameters['typeLabel'].value
285  doPFIsoDeposits = self._parameters['doPFIsoDeposits'].value
286  standardAlgo = self._parameters['standardAlgo'].value
287  standardType = self._parameters['standardType'].value
288 
289 
291  if typeLabel == 'Tau':
292  print("NO PF Isolation will be computed for CaloTau (this could be improved later)")
293  doPFIsoDeposits = False
294 
295 
297  def oldLabel(prefix = ''):
298  if prefix == '':
299  return "patTaus"
300  else:
301  return prefix + "PatTaus"
302 
303 
306  def capitalize(label):
307  return label[0].capitalize() + label[1:]
308 
309 
311  def newLabel(oldLabel):
312  newLabel = oldLabel
313  if ( oldLabel.find(standardAlgo) >= 0 and oldLabel.find(standardType) >= 0 ):
314  oldLabel = oldLabel.replace(standardAlgo, algoLabel).replace(standardType, typeLabel)
315  else:
316  oldLabel = oldLabel + capitalize(algoLabel + typeLabel)
317  return oldLabel
318 
319 
320  def addClone(hook, **replaceStatements):
321 
323  newModule = getattr(process, hook).clone(**replaceStatements)
324 
325 
326  def addPFIsoDepositClone(hook, **replaceStatements):
327  newModule = getattr(process, hook).clone(**replaceStatements)
328  newModuleIsoDepositExtractor = getattr(newModule, "ExtractorPSet")
329  setattr(newModuleIsoDepositExtractor, "tauSource", getattr(newModule, "src"))
330 
331 
332  addClone(oldLabel(), tauSource = tauCollection)
333 
334 
335  addClone(oldLabel('selected'), src = cms.InputTag(newLabel(oldLabel())))
336 
337 
338  addClone(oldLabel('clean'), src=cms.InputTag(newLabel(oldLabel('selected'))))
339 
340 
341  newTaus = getattr(process, newLabel(oldLabel()))
342 
343 
344  addClone('tauMatch', src = tauCollection)
345  addClone('tauGenJetMatch', src = tauCollection)
346 
347 
348  if doPFIsoDeposits:
349  addPFIsoDepositClone('tauIsoDepositPFCandidates', src = tauCollection)
350  addPFIsoDepositClone('tauIsoDepositPFChargedHadrons', src = tauCollection)
351  addPFIsoDepositClone('tauIsoDepositPFNeutralHadrons', src = tauCollection)
352  addPFIsoDepositClone('tauIsoDepositPFGammas', src = tauCollection)
353 
354 
355  def fixInputTag(x):
356  x.setModuleLabel(newLabel(x.moduleLabel))
357 
358 
359  fixInputTag(newTaus.genParticleMatch)
360  fixInputTag(newTaus.genJetMatch)
361  fixInputTag(newTaus.isoDeposits.pfAllParticles)
362  fixInputTag(newTaus.isoDeposits.pfNeutralHadron)
363  fixInputTag(newTaus.isoDeposits.pfChargedHadron)
364  fixInputTag(newTaus.isoDeposits.pfGamma)
365  fixInputTag(newTaus.userIsolation.pfAllParticles.src)
366  fixInputTag(newTaus.userIsolation.pfNeutralHadron.src)
367  fixInputTag(newTaus.userIsolation.pfChargedHadron.src)
368  fixInputTag(newTaus.userIsolation.pfGamma.src)
369 
370 
372  oldTaus = getattr(process, oldLabel())
373  switchToPFTauByType(process, pfTauType = algoLabel + typeLabel,
374  tauSource = getattr(newTaus, "tauSource"),
375  patTauLabel = capitalize(algoLabel + typeLabel))
376 
377 addTauCollection=AddTauCollection()

References heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, metTools.AddMETCollection._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._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(), print(), python.rootplot.root2matplotlib.replace(), and tauTools.switchToPFTauByType().

Member Data Documentation

◆ _comment

tauTools.AddTauCollection._comment
private

Definition at line 245 of file tauTools.py.

◆ _defaultParameters

tauTools.AddTauCollection._defaultParameters
staticprivate

Definition at line 224 of file tauTools.py.

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

◆ _label

tauTools.AddTauCollection._label
staticprivate

◆ _parameters

tauTools.AddTauCollection._parameters
private

Definition at line 244 of file tauTools.py.

Referenced by 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.recomputeRawMetFromPfcs(), trackTools.MakeAODTrackCandidates.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), tauTools.AddTauCollection.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().

clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
tauTools.switchToPFTauByType
def switchToPFTauByType(process, pfTauType=None, tauSource=cms.InputTag('hpsPFTauProducer'), patTauLabel="", postfix="")
Definition: tauTools.py:200
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444