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
trigTools.SwitchOnTriggerMatchingStandAlone Class Reference
Inheritance diagram for trigTools.SwitchOnTriggerMatchingStandAlone:

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

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

Detailed Description

Enables trigger matching in PAT
SwitchOnTriggerMatchingStandAlone( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' )
- [cms.Process]  : the 'cms.Process'
- triggerMatchers: PAT trigger matcher module labels (list)
                   optional; default: defined in 'triggerMatchingDefaultSequence'
                   (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py)
- triggerProducer: PATTriggerProducer module label;
                   optional, default: 'patTrigger'
- path           : name of path to use;
                   optional, default: ''
- hltProcess     : HLT process name;
                   optional, default: 'HLT'
- outputModule   : output module label;
                   empty label indicates no output;
                   optional, default: 'out'
- postfix        : postfix to apply to PAT module labels;
                   optional, default: ''
Using None as any argument restores its default value.

Definition at line 417 of file trigTools.py.

Constructor & Destructor Documentation

def trigTools.SwitchOnTriggerMatchingStandAlone.__init__ (   self)

Definition at line 440 of file trigTools.py.

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, 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().

441  def __init__( self ):
442  ConfigToolBase.__init__( self )
443  self.addParameter( self._defaultParameters, 'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
444  self.addParameter( self._defaultParameters, 'exampleMatchers', False , '' )
445  self.addParameter( self._defaultParameters, 'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
446  self.addParameter( self._defaultParameters, 'path' , _defaultPath , _defaultPathComment )
447  self.addParameter( self._defaultParameters, 'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
448  self.addParameter( self._defaultParameters, 'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
449  self.addParameter( self._defaultParameters, 'postfix' , _defaultPostfix , _defaultPostfixComment )
450  self._parameters = copy.deepcopy( self._defaultParameters )
451  self._comment = ""

Member Function Documentation

def trigTools.SwitchOnTriggerMatchingStandAlone.__call__ (   self,
  process,
  triggerMatchers = None,
  triggerProducer = None,
  path = None,
  hltProcess = None,
  outputModule = None,
  postfix = None 
)

Definition at line 462 of file trigTools.py.

References metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), MatrixReader.MatrixReader.apply, DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), HcalDeterministicFit.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.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, Len, Dim >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Accumulator >.apply(), Config.ProcessModifier.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), PedeReader.setParameter(), ora::PoolMainTable.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters().

463  ):
464  if triggerMatchers is None:
465  triggerMatchers = self._defaultParameters[ 'triggerMatchers' ].value
466  self.setParameter( 'exampleMatchers', True )
467  if triggerProducer is None:
468  triggerProducer = self._defaultParameters[ 'triggerProducer' ].value
469  if path is None:
470  path = self._defaultParameters[ 'path' ].value
471  if hltProcess is None:
472  hltProcess = self._defaultParameters[ 'hltProcess' ].value
473  if outputModule is None:
474  outputModule = self._defaultParameters[ 'outputModule' ].value
475  if postfix is None:
476  postfix = self._defaultParameters[ 'postfix' ].value
477  self.setParameter( 'triggerMatchers', triggerMatchers )
478  self.setParameter( 'triggerProducer', triggerProducer )
479  self.setParameter( 'path' , path )
480  self.setParameter( 'hltProcess' , hltProcess )
481  self.setParameter( 'outputModule' , outputModule )
482  self.setParameter( 'postfix' , postfix )
483  self.apply( process )
def trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters (   self)

Definition at line 452 of file trigTools.py.

References trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

453  def getDefaultParameters( self ):
454  return self._defaultParameters
def trigTools.SwitchOnTriggerMatchingStandAlone.toolCode (   self,
  process 
)

Definition at line 484 of file trigTools.py.

References trigTools._addEventContent(), ElectronCalibrator.EmbeddedElectronCalibrator._label, metTools.AddMETCollection._label, editorTools.UserCodeTool._label, trackTools.MakeAODTrackCandidates._label, heavyIonTools.ConfigureHeavyIons._label, coreTools.RunOnData._label, MagneticFieldMapESProducer._label, TrackerInteractionGeometryESProducer._label, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._label, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._label, jetTools.AddJetCollection._label, heavyIonTools.ProductionDefaults._label, editorTools.ChangeSource._label, ConfigToolBase.ConfigToolBase._label, LHECOMWeightProducer._label, cmsswVersionTools.PickRelValInputFiles._label, coreTools.RemoveMCMatching._label, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool._label, trackTools.MakePATTrackCandidates._label, trigTools.SwitchOnTrigger._label, heavyIonTools.SelectionDefaults._label, heavyIonTools.DisbaleMonteCarloDeps._label, trigTools.SwitchOnTriggerStandAlone._label, trackTools.MakeTrackCandidates._label, tauTools.AddTauCollection._label, trigTools.SwitchOnTriggerMatching._label, trigTools.SwitchOnTriggerMatchingStandAlone._label, jetTools.SwitchJetCollection._label, jetTools.AddJetID._label, jetTools.SetTagInfos._label, Vispa.Views.LineDecayView.DecayLine._label, editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._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, trackTools.MakePATTrackCandidates._parameters, jetTools.AddJetCollection._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, and trigTools.switchOnTriggerStandAlone.

485  def toolCode( self, process ):
486  triggerMatchers = self._parameters[ 'triggerMatchers' ].value
487  exampleMatchers = self._parameters[ 'exampleMatchers' ].value
488  triggerProducer = self._parameters[ 'triggerProducer' ].value
489  path = self._parameters[ 'path' ].value
490  hltProcess = self._parameters[ 'hltProcess' ].value
491  outputModule = self._parameters[ 'outputModule' ].value
492  postfix = self._parameters[ 'postfix' ].value
493 
494  # Load default producers from existing config file, if needed
495  if exampleMatchers:
496  process.load( "PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
497 
498  # Switch on PAT trigger information if needed
499  if not hasattr( process, triggerProducer ):
500  print '%s():'%( self._label )
501  print ' PAT trigger production switched on automatically using'
502  print ' switchOnTriggerStandAlone( process, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule )
503  print _longLine
504  switchOnTriggerStandAlone( process, triggerProducer, path, hltProcess, outputModule )
505 
506  # Maintain configurations
507  triggerMatchersKnown = []
508  for matcher in triggerMatchers:
509  if not hasattr( process, matcher ):
510  print '%s():'%( self._label )
511  print ' Matcher \'%s\' not known to process'%( matcher )
512  print ' ==> skipped'
513  print _longLine
514  continue
515  triggerMatchersKnown.append( matcher )
516  trigMchMod = getattr( process, matcher )
517  trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
518  trigMchMod.matched = triggerProducer
519 
520  # Add event content
521  if outputModule is not '':
522  patTriggerEventContent = []
523  for matcher in triggerMatchersKnown:
524  patTriggerEventContent += [ 'keep patTriggerObjectStandAlonesedmAssociation_%s_*_%s'%( matcher, process.name_() )
525  , 'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
526  ]
527  getattr( process, outputModule ).outputCommands = _addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
tuple switchOnTriggerStandAlone
Definition: trigTools.py:276
def _addEventContent
Definition: trigTools.py:29

Member Data Documentation

trigTools.SwitchOnTriggerMatchingStandAlone._comment
private

Definition at line 450 of file trigTools.py.

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

tuple trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 438 of file trigTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), HiCoreTools.RemoveMCMatching.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.initializeInputTag(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string trigTools.SwitchOnTriggerMatchingStandAlone._label = 'switchOnTriggerMatchingStandAlone'
staticprivate

Definition at line 437 of file trigTools.py.

Referenced by trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

trigTools.SwitchOnTriggerMatchingStandAlone._parameters
private

Definition at line 449 of file trigTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), HiCoreTools.RestrictInputToAOD.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().