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

Constructor & Destructor Documentation

def tauTools.AddTauCollection.__init__ (   self)

Definition at line 206 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().

207  def __init__(self):
208  ConfigToolBase.__init__(self)
209  self.addParameter(self._defaultParameters, 'tauCollection',
210  self._defaultValue, 'Input tau collection', cms.InputTag)
211  self.addParameter(self._defaultParameters, 'algoLabel',
212  self._defaultValue, "label to indicate the tau algorithm (e.g.'hps')", str)
213  self.addParameter(self._defaultParameters, 'typeLabel',
214  self._defaultValue, "label to indicate the type of constituents (either 'PFTau' or 'Tau')", str)
215  self.addParameter(self._defaultParameters, 'doPFIsoDeposits',
216  True, "run sequence for computing particle-flow based IsoDeposits")
217  self.addParameter(self._defaultParameters, 'standardAlgo',
218  "hps", "standard algorithm label of the collection from which the clones " \
219  + "for the new tau collection will be taken from " \
220  + "(note that this tau collection has to be available in the event before hand)")
221  self.addParameter(self._defaultParameters, 'standardType',
222  "PFTau", "standard constituent type label of the collection from which the clones " \
223  + " for the new tau collection will be taken from "\
224  + "(note that this tau collection has to be available in the event before hand)")
226  self._parameters=copy.deepcopy(self._defaultParameters)
227  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 238 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(), MatrixReader.MatrixReader.apply, SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), SurveyParameters.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), RigidBodyAlignmentParameters.apply(), BeamSpotAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.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< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Accumulator >.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), ora::PoolMainTable.setParameter(), PedeReader.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by tauTools.AddTauCollection.getDefaultParameters().

239  standardType = None):
240 
241  if tauCollection is None:
242  tauCollection = self._defaultParameters['tauCollection'].value
243  if algoLabel is None:
244  algoLabel = self._defaultParameters['algoLabel'].value
245  if typeLabel is None:
246  typeLabel = self._defaultParameters['typeLabel'].value
247  if doPFIsoDeposits is None:
248  doPFIsoDeposits = self._defaultParameters['doPFIsoDeposits'].value
249  if standardAlgo is None:
250  standardAlgo = self._defaultParameters['standardAlgo'].value
251  if standardType is None:
252  standardType = self._defaultParameters['standardType'].value
253 
254  self.setParameter('tauCollection', tauCollection)
255  self.setParameter('algoLabel', algoLabel)
256  self.setParameter('typeLabel', typeLabel)
257  self.setParameter('doPFIsoDeposits', doPFIsoDeposits)
258  self.setParameter('standardAlgo', standardAlgo)
259  self.setParameter('standardType', standardType)
260 
261  self.apply(process)
def tauTools.AddTauCollection.getDefaultParameters (   self)

Definition at line 228 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.

229  def getDefaultParameters(self):
230  return self._defaultParameters
def tauTools.AddTauCollection.toolCode (   self,
  process 
)

Definition at line 262 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, jetTools.AddJetCollection._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._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(), linker.replace(), tauTools.switchToCaloTau(), and tauTools.switchToPFTauByType().

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

Member Data Documentation

tauTools.AddTauCollection._comment
private

Definition at line 226 of file tauTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__().

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

Definition at line 205 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__(), tauTools.AddTauCollection.__call__(), trackTools.MakeTrackCandidates.__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__(), tauTools.AddTauCollection.__init__(), trackTools.MakeTrackCandidates.__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(), tauTools.AddTauCollection.getDefaultParameters(), trackTools.MakeTrackCandidates.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 204 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 225 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(), tauTools.AddTauCollection.toolCode(), trackTools.MakeTrackCandidates.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and metUncertaintyTools.RunMEtUncertainties.toolCode().