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

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

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

Detailed Description

Enables trigger information in PAT
SwitchOnTrigger( [cms.Process], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out' )
- [cms.Process]       : the 'cms.Process'
- triggerProducer     : PATTriggerProducer module label;
                        optional, default: 'patTrigger'
- triggerEventProducer: PATTriggerEventProducer module label;
                        optional, default: 'patTriggerEvent'
- 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'
Using None as any argument restores its default value.

Definition at line 58 of file trigTools.py.

Constructor & Destructor Documentation

def trigTools.SwitchOnTrigger.__init__ (   self)

Definition at line 78 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, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._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().

78 
79  def __init__( self ):
80  ConfigToolBase.__init__( self )
81  self.addParameter( self._defaultParameters, 'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
82  self.addParameter( self._defaultParameters, 'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
83  self.addParameter( self._defaultParameters, 'path' , _defaultPath , _defaultPathComment )
84  self.addParameter( self._defaultParameters, 'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
85  self.addParameter( self._defaultParameters, 'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
86  self._parameters = copy.deepcopy( self._defaultParameters )
87  self._comment = ""

Member Function Documentation

def trigTools.SwitchOnTrigger.__call__ (   self,
  process,
  triggerProducer = None,
  triggerEventProducer = None,
  path = None,
  hltProcess = None,
  outputModule = None 
)

Definition at line 97 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, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._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(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.apply(), ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), AlignmentParameters.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(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Numeric, Len, Dim >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), npstat::ArrayND< Numeric >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.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 trigTools.SwitchOnTrigger.getDefaultParameters().

97 
98  ):
99  if triggerProducer is None:
100  triggerProducer = self._defaultParameters[ 'triggerProducer' ].value
101  if triggerEventProducer is None:
102  triggerEventProducer = self._defaultParameters[ 'triggerEventProducer' ].value
103  if path is None:
104  path = self._defaultParameters[ 'path' ].value
105  if hltProcess is None:
106  hltProcess = self._defaultParameters[ 'hltProcess' ].value
107  if outputModule is None:
108  outputModule = self._defaultParameters[ 'outputModule' ].value
109  self.setParameter( 'triggerProducer' , triggerProducer )
110  self.setParameter( 'triggerEventProducer', triggerEventProducer )
111  self.setParameter( 'path' , path )
112  self.setParameter( 'hltProcess' , hltProcess )
113  self.setParameter( 'outputModule' , outputModule )
114  self.apply( process )
def trigTools.SwitchOnTrigger.getDefaultParameters (   self)

Definition at line 88 of file trigTools.py.

References trigTools.SwitchOnTrigger.__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, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

88 
89  def getDefaultParameters( self ):
90  return self._defaultParameters
def trigTools.SwitchOnTrigger.toolCode (   self,
  process 
)

Definition at line 115 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, ConfigToolBase.ConfigToolBase._label, editorTools.ChangeSource._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, trackTools.MakeTrackCandidates._label, tauTools.AddTauCollection._label, jetTools.SwitchJetCollection._label, jetTools.AddJetID._label, jetTools.SetTagInfos._label, Vispa.Views.LineDecayView.DecayLine._label, trigTools._modulesInPath(), 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, jetTools.AddJetCollection._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, and jetTools.SetTagInfos._parameters.

116  def toolCode( self, process ):
117  triggerProducer = self._parameters[ 'triggerProducer' ].value
118  triggerEventProducer = self._parameters[ 'triggerEventProducer' ].value
119  path = self._parameters[ 'path' ].value
120  hltProcess = self._parameters[ 'hltProcess' ].value
121  outputModule = self._parameters[ 'outputModule' ].value
122 
123  # Load default producers from existing config files, if needed
124  if not hasattr( process, triggerProducer ):
126  setattr( process, triggerProducer, patTrigger.clone() )
127  else:
128  print '%s():'%( self._label )
129  print ' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
130  print ' ==> entry re-used'
131  print _longLine
132  if not hasattr( process, triggerEventProducer ):
134  setattr( process, triggerEventProducer, patTriggerEvent.clone() )
135  else:
136  print '%s():'%( self._label )
137  print ' PATTriggerEventProducer module \'%s\' exists already in process'%( triggerEventProducer )
138  print ' ==> entry re-used'
139  print _longLine
140 
141  # Maintain configurations
142  trigProdMod = getattr( process, triggerProducer )
143  trigProdMod.processName = hltProcess
144  if trigProdMod.onlyStandAlone.value() is True:
145  trigProdMod.onlyStandAlone = False
146  print ' configuration parameter automatically changed'
147  print ' PATTriggerProducer %s.onlyStandAlone --> %s'%( triggerProducer, trigProdMod.onlyStandAlone )
148  print _longLine
149  trigEvtProdMod = getattr( process, triggerEventProducer )
150  trigEvtProdMod.processName = hltProcess
151  trigEvtProdMod.patTriggerProducer = cms.InputTag( triggerProducer )
152  if not path is '':
153  if not hasattr( process, path ):
154  prodPath = cms.Path( trigProdMod + trigEvtProdMod )
155  setattr( process, path, prodPath )
156  print '%s():'%( self._label )
157  print ' Path \'%s\' does not exist in process'%( path )
158  print ' ==> created'
159  print _longLine
160  # Try to get the order right, but cannot deal with all possible cases.
161  # Simply rely on the exclusive usage of these tools without manual intervention.
162  else:
163  if not triggerProducer in _modulesInPath( process, path ):
164  prodPath = getattr( process, path )
165  prodPath += trigProdMod
166  if not triggerEventProducer in _modulesInPath( process, path ):
167  prodPath = getattr( process, path )
168  prodPath += trigEvtProdMod
169 
170  # Add event content
171  if outputModule is not '':
172  patTriggerEventContent = [ 'keep patTriggerObjects_%s_*_%s'%( triggerProducer, process.name_() )
173  , 'keep patTriggerFilters_%s_*_%s'%( triggerProducer, process.name_() )
174  , 'keep patTriggerPaths_%s_*_%s'%( triggerProducer, process.name_() )
175  , 'keep patTriggerEvent_%s_*_%s'%( triggerEventProducer, process.name_() )
176  ]
177  if ( hasattr( trigProdMod, 'addL1Algos' ) and trigProdMod.addL1Algos.value() is True ):
178  patTriggerEventContent += [ 'keep patTriggerConditions_%s_*_%s'%( triggerProducer, process.name_() )
179  , 'keep patTriggerAlgorithms_%s_*_%s'%( triggerProducer, process.name_() )
180  ]
181  if ( hasattr( trigProdMod, 'saveL1Refs' ) and trigProdMod.saveL1Refs.value() is True ):
182  patTriggerEventContent += patTriggerL1RefsEventContent
183  getattr( process, outputModule ).outputCommands = _addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
def _modulesInPath
Definition: trigTools.py:25
def _addEventContent
Definition: trigTools.py:29

Member Data Documentation

trigTools.SwitchOnTrigger._comment
private

Definition at line 86 of file trigTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__init__(), jmeUncertaintyTools.JetMEtUncertaintyTools.__init__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__init__(), runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__(), and runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__init__().

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

Definition at line 76 of file trigTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trigTools.SwitchOnTrigger.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), jmeUncertaintyTools.JetMEtUncertaintyTools.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__call__(), HiCoreTools.AddCleaning.__call__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__init__(), jmeUncertaintyTools.JetMEtUncertaintyTools.__init__(), runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__init__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), jmeUncertaintyTools.JetMEtUncertaintyTools._initializeInputTag(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), jmeUncertaintyTools.JetMEtUncertaintyTools.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string trigTools.SwitchOnTrigger._label = 'switchOnTrigger'
staticprivate

Definition at line 75 of file trigTools.py.

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

trigTools.SwitchOnTrigger._parameters
private

Definition at line 85 of file trigTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__init__(), runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__init__(), jmeUncertaintyTools.JetMEtUncertaintyTools.__init__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__init__(), HiCoreTools.RestrictInputToAOD.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trigTools.SwitchOnTrigger.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), runMVAMEtUncertainties.RunMVAMEtUncertainties.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.toolCode(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().