CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 60 of file trigTools.py.

Constructor & Destructor Documentation

def trigTools.SwitchOnTrigger.__init__ (   self)

Definition at line 80 of file trigTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._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(), Python11ParameterSet.addParameter(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

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

Member Function Documentation

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

Definition at line 99 of file trigTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, trackTools.MakeTrackCandidates._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(), SurveyParameters.apply(), DummyOOTPileupCorrection.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), RigidBodyAlignmentParameters.apply(), BeamSpotAlignmentParameters.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< Accumulator >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), Config.ProcessModifier.apply(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by trigTools.SwitchOnTrigger.getDefaultParameters().

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

Definition at line 90 of file trigTools.py.

References trigTools.SwitchOnTrigger.__call__(), heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

90 
91  def getDefaultParameters( self ):
92  return self._defaultParameters
def trigTools.SwitchOnTrigger.toolCode (   self,
  process 
)

Definition at line 117 of file trigTools.py.

References trigTools._addEventContent(), metTools.AddMETCollection._label, trackTools.MakeAODTrackCandidates._label, heavyIonTools.ConfigureHeavyIons._label, coreTools.RunOnData._label, MagneticFieldMapESProducer._label, TrackerInteractionGeometryESProducer._label, heavyIonTools.ProductionDefaults._label, ConfigToolBase.ConfigToolBase._label, LHECOMWeightProducer._label, cmsswVersionTools.PickRelValInputFiles._label, coreTools.RemoveMCMatching._label, trackTools.MakePATTrackCandidates._label, trigTools.SwitchOnTrigger._label, heavyIonTools.SelectionDefaults._label, heavyIonTools.DisbaleMonteCarloDeps._label, tauTools.AddTauCollection._label, trackTools.MakeTrackCandidates._label, jetTools.AddJetCollection._label, jetTools.SwitchJetCollection._label, jetTools.UpdateJetCollection._label, jetTools.AddJetID._label, jetTools.SetTagInfos._label, trigTools._modulesInPath(), heavyIonTools.ConfigureHeavyIons._parameters, trackTools.MakeAODTrackCandidates._parameters, coreTools.RunOnData._parameters, metTools.AddMETCollection._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, tauTools.AddTauCollection._parameters, trackTools.MakeTrackCandidates._parameters, jetTools.AddJetCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.UpdateJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, helpers.addToProcessAndTask(), helpers.getPatAlgosToolsTask(), and print().

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

Member Data Documentation

trigTools.SwitchOnTrigger._comment
private

Definition at line 88 of file trigTools.py.

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

Definition at line 78 of file trigTools.py.

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

string trigTools.SwitchOnTrigger._label = 'switchOnTrigger'
staticprivate

Definition at line 77 of file trigTools.py.

Referenced by validation.SimpleSample.digest(), validation.SimpleSample.label(), trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

trigTools.SwitchOnTrigger._parameters
private

Definition at line 87 of file trigTools.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(), runJetUncertainties.RunJetUncertainties.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().