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 Member Functions | Private Attributes | Static Private Attributes
trigTools.RemoveCleaningFromTriggerMatching Class Reference
Inheritance diagram for trigTools.RemoveCleaningFromTriggerMatching:

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Member Functions

def _renameMatchers
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

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

Detailed Description

Removes cleaning from already existing PAT trigger matching/embedding configuration
RemoveCleaningFromTriggerMatching( [cms.Process], outputModule = 'out' )
- [cms.Process]  : the 'cms.Process'
- sequence       : name of sequence to use;
                   optional, default: 'patDefaultSequence'
- outputModule   : output module label;
                   empty label indicates no output;
                   optional, default: 'out'
Using None as any argument restores its default value.

Definition at line 722 of file trigTools.py.

Constructor & Destructor Documentation

def trigTools.RemoveCleaningFromTriggerMatching.__init__ (   self)

Definition at line 736 of file trigTools.py.

References electronTools.AddElectronUserIsolation._defaultParameters, photonTools.AddPhotonUserIsolation._defaultParameters, metTools.AddTcMET._defaultParameters, muonTools.AddMuonUserIsolation._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, python.editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, jetTools.RunBTagging._defaultParameters, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, python.editorTools.ChangeSource._defaultParameters, metTools.AddPfMET._defaultParameters, coreTools.RunOnData._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, cmsswVersionTools.RunBTagging35X._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.AddJetCollection._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, cmsswVersionTools.AddJetCollection35X._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, cmsswVersionTools.SwitchJetCollection35X._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, trigTools.RemoveCleaningFromTriggerMatching._defaultParameters, jetTools.SwitchJetCorrLevels._defaultParameters, cmsswVersionTools.PickRelValInputFiles._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(), python.ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

737  def __init__( self ):
738  ConfigToolBase.__init__( self )
739  self.addParameter( self._defaultParameters, 'sequence' , _defaultSequence , _defaultSequenceComment )
740  self.addParameter( self._defaultParameters, 'outputModule', _defaultOutputModule, _defaultOutputModuleComment )
741  self._parameters = copy.deepcopy( self._defaultParameters )
742  self._comment = ""

Member Function Documentation

def trigTools.RemoveCleaningFromTriggerMatching.__call__ (   self,
  process,
  sequence = None,
  outputModule = None 
)

Definition at line 749 of file trigTools.py.

References electronTools.AddElectronUserIsolation._defaultParameters, photonTools.AddPhotonUserIsolation._defaultParameters, metTools.AddTcMET._defaultParameters, python.editorTools.UserCodeTool._defaultParameters, muonTools.AddMuonUserIsolation._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, jetTools.RunBTagging._defaultParameters, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, python.editorTools.ChangeSource._defaultParameters, metTools.AddPfMET._defaultParameters, coreTools.RunOnData._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, cmsswVersionTools.RunBTagging35X._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.AddJetCollection._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, cmsswVersionTools.AddJetCollection35X._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, cmsswVersionTools.SwitchJetCollection35X._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, trigTools.RemoveCleaningFromTriggerMatching._defaultParameters, jetTools.SwitchJetCorrLevels._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, SignedImpactParameter3D.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), gen::PhotosInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), jetTools.RunBTagging.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), python.ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), AlignmentParameters.apply(), python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), TwoBowedSurfacesAlignmentParameters.apply(), python.Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), python.Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), reco::And< bool >.apply(), cmsswVersionTools.RunBTagging35X.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(), cmsswVersionTools.PickRelValInputFiles.apply(), PedeReader.setParameter(), fit::RootMinuit< Function >.setParameter(), and python.ConfigToolBase.ConfigToolBase.setParameter().

Referenced by trigTools.RemoveCleaningFromTriggerMatching.getDefaultParameters().

750  ):
751  if sequence is None:
752  sequence = self._defaultParameters[ 'sequence' ].value
753  if outputModule is None:
754  outputModule = self._defaultParameters[ 'outputModule' ].value
755  self.setParameter( 'sequence' , sequence )
756  self.setParameter( 'outputModule', outputModule )
757  self.apply( process )
def trigTools.RemoveCleaningFromTriggerMatching._renameMatchers (   self,
  matchers,
  oldModules 
)
private

Definition at line 823 of file trigTools.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trigTools.RemoveCleaningFromTriggerMatching.toolCode().

824  def _renameMatchers( self, matchers, oldModules ):
825  for matcher in range( len( matchers ) ):
826  if matchers[ matcher ] in oldModules:
827  if matchers[ matcher ][ : 5 ] == 'clean':
828  matchers[ matcher ] = matchers[ matcher ].replace( 'clean', 'selected' )
829  return matchers
def trigTools.RemoveCleaningFromTriggerMatching.getDefaultParameters (   self)

Definition at line 743 of file trigTools.py.

References trigTools.RemoveCleaningFromTriggerMatching.__call__(), electronTools.AddElectronUserIsolation._defaultParameters, photonTools.AddPhotonUserIsolation._defaultParameters, metTools.AddTcMET._defaultParameters, python.editorTools.UserCodeTool._defaultParameters, muonTools.AddMuonUserIsolation._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, jetTools.RunBTagging._defaultParameters, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, python.editorTools.ChangeSource._defaultParameters, metTools.AddPfMET._defaultParameters, coreTools.RunOnData._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, cmsswVersionTools.RunBTagging35X._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.AddJetCollection._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, cmsswVersionTools.AddJetCollection35X._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, cmsswVersionTools.SwitchJetCollection35X._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, trigTools.RemoveCleaningFromTriggerMatching._defaultParameters, jetTools.SwitchJetCorrLevels._defaultParameters, and cmsswVersionTools.PickRelValInputFiles._defaultParameters.

744  def getDefaultParameters( self ):
745  return self._defaultParameters
def trigTools.RemoveCleaningFromTriggerMatching.toolCode (   self,
  process 
)

Definition at line 758 of file trigTools.py.

References electronTools.AddElectronUserIsolation._label, photonTools.AddPhotonUserIsolation._label, metTools.AddTcMET._label, python.editorTools.UserCodeTool._label, muonTools.AddMuonUserIsolation._label, trackTools.MakeAODTrackCandidates._label, heavyIonTools.ConfigureHeavyIons._label, coreTools.RestrictInputToAOD._label, MagneticFieldMapESProducer._label, TrackerInteractionGeometryESProducer._label, jetTools.RunBTagging._label, python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._label, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._label, heavyIonTools.ProductionDefaults._label, python.ConfigToolBase.ConfigToolBase._label, python.editorTools.ChangeSource._label, metTools.AddPfMET._label, coreTools.RunOnData._label, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool._label, trackTools.MakePATTrackCandidates._label, trigTools.SwitchOnTrigger._label, coreTools.RemoveMCMatching._label, cmsswVersionTools.RunBTagging35X._label, heavyIonTools.SelectionDefaults._label, heavyIonTools.DisbaleMonteCarloDeps._label, jetTools.AddJetCollection._label, coreTools.RemoveAllPATObjectsBut._label, trigTools.SwitchOnTriggerStandAlone._label, trackTools.MakeTrackCandidates._label, coreTools.RemoveSpecificPATObjects._label, cmsswVersionTools.AddJetCollection35X._label, tauTools.AddTauCollection._label, trigTools.SwitchOnTriggerMatching._label, coreTools.RemoveCleaning._label, coreTools.AddCleaning._label, jetTools.SwitchJetCollection._label, trigTools.SwitchOnTriggerMatchingStandAlone._label, cmsswVersionTools.SwitchJetCollection35X._label, trigTools.SwitchOnTriggerMatchEmbedding._label, jetTools.AddJetID._label, jetTools.SetTagInfos._label, trigTools.RemoveCleaningFromTriggerMatching._label, jetTools.SwitchJetCorrLevels._label, cmsswVersionTools.PickRelValInputFiles._label, python.Vispa.Views.LineDecayView.DecayLine._label, trigTools._modulesInSequence(), photonTools.AddPhotonUserIsolation._parameters, python.editorTools.UserCodeTool._parameters, electronTools.AddElectronUserIsolation._parameters, muonTools.AddMuonUserIsolation._parameters, heavyIonTools.ConfigureHeavyIons._parameters, metTools.AddTcMET._parameters, coreTools.RestrictInputToAOD._parameters, trackTools.MakeAODTrackCandidates._parameters, python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, jetTools.RunBTagging._parameters, python.Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, python.ConfigToolBase.ConfigToolBase._parameters, python.editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, metTools.AddPfMET._parameters, TAbsFitParticle._parameters, coreTools.RunOnData._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.RunBTagging35X._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, jetTools.AddJetCollection._parameters, coreTools.RemoveAllPATObjectsBut._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, coreTools.RemoveSpecificPATObjects._parameters, cmsswVersionTools.AddJetCollection35X._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, coreTools.RemoveCleaning._parameters, coreTools.AddCleaning._parameters, jetTools.SwitchJetCollection._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, cmsswVersionTools.SwitchJetCollection35X._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, trigTools.RemoveCleaningFromTriggerMatching._parameters, jetTools.SwitchJetCorrLevels._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, trigTools.RemoveCleaningFromTriggerMatching._renameMatchers(), and python.rootplot.root2matplotlib.replace().

759  def toolCode( self, process ):
760  sequence = self._parameters[ 'sequence' ].value
761  outputModule = self._parameters[ 'outputModule' ].value
762 
763  # Maintain configurations
764  listMatchers = [ 'PATTriggerMatcherDRLessByR'
765  , 'PATTriggerMatcherDRDPtLessByR'
766  , 'PATTriggerMatcherDRLessByPt'
767  , 'PATTriggerMatcherDRDPtLessByPt'
768  , 'PATTriggerMatcherDEtaLessByDR'
769  , 'PATTriggerMatcherDEtaLessByDEta'
770  ]
771  listEmbedders = [ 'PATTriggerMatchPhotonEmbedder'
772  , 'PATTriggerMatchElectronEmbedder'
773  , 'PATTriggerMatchMuonEmbedder'
774  , 'PATTriggerMatchTauEmbedder'
775  , 'PATTriggerMatchJetEmbedder'
776  , 'PATTriggerMatchMETEmbedder'
777  ]
778  modules = _modulesInSequence( process, sequence )
779  oldModules = []
780  oldSources = []
781  # input source labels
782  for module in modules:
783  if hasattr( process, module ):
784  trigMod = getattr( process, module )
785  if trigMod.type_() in listMatchers:
786  if trigMod.src.value()[ : 8 ] == 'cleanPat':
787  trigMod.src = trigMod.src.value().replace( 'cleanPat', 'selectedPat' )
788  if trigMod.label()[ : 5 ] == 'clean':
789  oldModules += [ trigMod.label() ]
790  setattr( process, trigMod.label().replace( 'clean', 'selected' ), trigMod )
791  if trigMod.type_() in listEmbedders:
792  if trigMod.src.value()[ : 8 ] == 'cleanPat':
793  oldSources += [ trigMod.src.getModuleLabel() ]
794  trigMod.src = trigMod.src.value().replace( 'cleanPat', 'selectedPat' )
795  if trigMod.label()[ : 5 ] == 'clean':
796  oldModules += [ trigMod.label() ]
797  setattr( process, trigMod.label().replace( 'clean', 'selected' ), trigMod )
798  # matcher labels
799  for module in modules:
800  if hasattr( process, module ):
801  trigMod = getattr( process, module )
802  if trigMod.type_() == 'PATTriggerEventProducer':
803  matchers = getattr( trigMod, 'patTriggerMatches' )
804  matchers = self._renameMatchers( matchers, oldModules )
805  elif trigMod.type_() in listEmbedders:
806  matchers = getattr( trigMod, 'matches' )
807  matchers = self._renameMatchers( matchers, oldModules )
808 
809  # Maintain event content
810  if outputModule is not '':
811  patTriggerEventContent = getattr( process, outputModule ).outputCommands
812  for statement in range( len( patTriggerEventContent ) ):
813  for module in oldModules:
814  if module in patTriggerEventContent[ statement ]:
815  patTriggerEventContent[ statement ] = patTriggerEventContent[ statement ].replace( 'clean', 'selected' )
816  for source in oldSources:
817  if source in patTriggerEventContent[ statement ] and 'drop' in patTriggerEventContent[ statement ]:
818  patTriggerEventContent[ statement ] = patTriggerEventContent[ statement ].replace( 'clean', 'selected' )
819  print '%s():'%( self._label )
820  print ' Input from cleaning has been switched to input from selection;'
821  print ' matcher and embedder modules have been renamed accordingly.'
822  print _longLine
def _modulesInSequence
Definition: trigTools.py:34

Member Data Documentation

trigTools.RemoveCleaningFromTriggerMatching._comment
private

Definition at line 741 of file trigTools.py.

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

Definition at line 734 of file trigTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), HiCoreTools.RemoveMCMatching.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.RemoveCleaningFromTriggerMatching.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), HiCoreTools.RemoveMCMatching.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.RemoveCleaningFromTriggerMatching.__init__(), python.ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.RemoveCleaningFromTriggerMatching.getDefaultParameters(), python.ConfigToolBase.ConfigToolBase.reset(), and python.ConfigToolBase.ConfigToolBase.setParameter().

string trigTools.RemoveCleaningFromTriggerMatching._label = 'removeCleaningFromTriggerMatching'
staticprivate

Definition at line 733 of file trigTools.py.

Referenced by trigTools.RemoveCleaningFromTriggerMatching.toolCode().

trigTools.RemoveCleaningFromTriggerMatching._parameters
private

Definition at line 740 of file trigTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), HiCoreTools.AddCleaning.toolCode(), and trigTools.RemoveCleaningFromTriggerMatching.toolCode().