Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:53:06

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process('HLT')
0004 
0005 process.options.wantSummary = True
0006 
0007 process.load('FWCore.MessageService.MessageLogger_cfi')
0008 process.MessageLogger.cerr.FwkReport.reportEvery = 100 # only report every 100th event start
0009 process.MessageLogger.cerr.enableStatistics = False # enable "MessageLogger Summary" message
0010 process.MessageLogger.cerr.threshold = 'INFO' # change to 'WARNING' not to show INFO-level messages
0011 ## enable reporting of INFO-level messages (default is limit=0, i.e. no messages reported)
0012 #process.MessageLogger.cerr.INFO = cms.untracked.PSet(
0013 #    reportEvery = cms.untracked.int32(1), # every event!
0014 #    limit = cms.untracked.int32(-1)       # no limit!
0015 #)
0016 
0017 # define the Prescaler service, and set the scale factors
0018 process.PrescaleService = cms.Service('PrescaleService',
0019     prescaleTable = cms.VPSet(
0020         cms.PSet(
0021             pathName  = cms.string('Path_1'),
0022             prescales = cms.vuint32( 2 )
0023         ),
0024         cms.PSet(
0025             pathName  = cms.string('Path_2'),
0026             prescales = cms.vuint32( 3 )
0027         ),
0028         cms.PSet(
0029             pathName  = cms.string('Path_3'),
0030             prescales = cms.vuint32( 5 )
0031         )
0032     ),
0033     lvl1Labels = cms.vstring('any'),
0034     lvl1DefaultLabel = cms.string('any')
0035 )    
0036 
0037 # define an empty source, and ask for 1000 events
0038 process.source = cms.Source('EmptySource')
0039 process.maxEvents.input = 1000
0040 
0041 # define 3 prescalers, one per path
0042 process.scale_1 = cms.EDFilter('HLTPrescaler')
0043 process.scale_2 = cms.EDFilter('HLTPrescaler')
0044 process.scale_3 = cms.EDFilter('HLTPrescaler')
0045 process.fail    = cms.EDFilter('HLTBool', result = cms.bool(False))
0046 process.success = cms.EDFilter('HLTBool', result = cms.bool(True))
0047 
0048 process.Path_1  = cms.Path(process.scale_1)
0049 process.Path_2  = cms.Path(process.scale_2)
0050 process.Path_3  = cms.Path(process.scale_3)
0051 process.L1_Path = cms.Path(process.success)
0052 # Path names containing a special keyword (TRUE, FALSE, AND, OR, NOT)
0053 process.AlwaysNOTFalse = cms.Path(process.success)
0054 process.AlwaysFALSE    = cms.Path(process.fail)
0055 
0056 # define the TriggerResultsFilters based on the status of the previous paths
0057 from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter as _trigResFilter
0058 _triggerResultsFilter = _trigResFilter.clone(
0059   usePathStatus = True,
0060   hltResults = '',
0061   l1tResults = ''
0062 )
0063 
0064 # accept if 'Path_1' succeeds
0065 process.filter_1 = _triggerResultsFilter.clone(
0066     triggerConditions =  ( 'Path_1', )
0067 )
0068 
0069 # accept if 'Path_2' succeeds
0070 process.filter_2 = _triggerResultsFilter.clone(
0071     triggerConditions = ( 'Path_2', )
0072 )
0073 
0074 # accept if 'Path_3' succeeds
0075 process.filter_3 = _triggerResultsFilter.clone(
0076     triggerConditions = ( 'Path_3', )
0077 )
0078 
0079 # accept if any path succeeds (explicit OR)
0080 process.filter_any_or = _triggerResultsFilter.clone(
0081     triggerConditions = ( 'Path_1', 'Path_2', 'Path_3' )
0082 )
0083 
0084 # accept if 'Path_1' succeeds, prescaled by 15
0085 process.filter_1_pre = _triggerResultsFilter.clone(
0086     triggerConditions =  ( '(Path_1) / 15', )
0087 )
0088 
0089 # accept if 'Path_1' succeeds, prescaled by 15
0090 # masking Path_2 (equivalent to filter_1_pre)
0091 process.filter_1_pre_with_masks1 = _triggerResultsFilter.clone(
0092     triggerConditions =  ( '(Path_1 / 15 OR Path_2) MASKING Path_2', )
0093 )
0094 
0095 # accept if 'Path_1' succeeds, prescaled by 15
0096 # masking Path_2 and Path_3 (equivalent to filter_1_pre)
0097 process.filter_1_pre_with_masks2 = _triggerResultsFilter.clone(
0098     triggerConditions =  ( '(Path_? / 15) MASKING Path_2 MASKING Path_3', )
0099 )
0100 
0101 # accept if 'Path_1' prescaled by 15 does not succeed
0102 process.filter_not_1_pre = _triggerResultsFilter.clone(
0103     triggerConditions =  ( 'NOT (Path_1 / 15)', )
0104 )
0105 
0106 # accept if 'Path_2' succeeds, prescaled by 10
0107 process.filter_2_pre = _triggerResultsFilter.clone(
0108     triggerConditions = ( '(Path_2 / 10)', )
0109 )
0110 
0111 # accept if any path succeeds, with different prescales (explicit OR, prescaled)
0112 process.filter_any_pre = _triggerResultsFilter.clone(
0113     triggerConditions = ( 'Path_1 / 15', 'Path_2 / 10', 'Path_3 / 6', )
0114 )
0115 
0116 # equivalent of filter_any_pre using NOT operator twice
0117 process.filter_any_pre_doubleNOT = _triggerResultsFilter.clone(
0118     triggerConditions = ( 'NOT NOT (Path_1 / 15 OR Path_2 / 10 OR Path_3 / 6)', )
0119 )
0120 
0121 # opposite of filter_any_pre without whitespaces where possible
0122 process.filter_not_any_pre = _triggerResultsFilter.clone(
0123     triggerConditions = ( 'NOT(Path_1/15)AND(NOT Path_2/10)AND(NOT Path_3/6)', )
0124 )
0125 
0126 # accept if Path_1 and Path_2 have different results (XOR) without using XOR operator
0127 process.filter_1xor2_withoutXOR = _triggerResultsFilter.clone(
0128     triggerConditions = ( 'Path_1 AND NOT Path_2', 'NOT Path_1 AND Path_2', )
0129 )
0130 
0131 # accept if Path_1 and Path_2 have different results (XOR) using XOR operator
0132 process.filter_1xor2_withXOR = _triggerResultsFilter.clone(
0133     triggerConditions = ( 'Path_1 XOR Path_2', )
0134 )
0135 
0136 # accept if any path succeeds (wildcard, '*')
0137 process.filter_any_star = _triggerResultsFilter.clone(
0138     triggerConditions = ( 'Path_*', )
0139 )
0140 
0141 # accept if any path succeeds (wildcard, '?')
0142 process.filter_any_question = _triggerResultsFilter.clone(
0143     triggerConditions = ( 'Path_?', )
0144 )
0145 
0146 # accept if any path succeeds (double wildcard, '*_?')
0147 process.filter_any_starquestion = _triggerResultsFilter.clone(
0148     triggerConditions = ( '*_?', )
0149 )
0150 
0151 # accept if all path succeed (explicit AND)
0152 process.filter_all_explicit = _triggerResultsFilter.clone(
0153     triggerConditions = ( 'Path_1 AND Path_2 AND Path_3', )
0154 )
0155 
0156 # wrong path name (explicit)
0157 process.filter_wrong_name = _triggerResultsFilter.clone(
0158     triggerConditions = ( 'Wrong', ),
0159     throw = False # do not throw, and return False for every event
0160 )
0161 
0162 # wrong path name (wildcard)
0163 process.filter_wrong_pattern = _triggerResultsFilter.clone(
0164     triggerConditions = ( '*_Wrong', ),
0165     throw = False # do not throw, and return False for every event
0166 )
0167 
0168 # empty path list
0169 process.filter_empty_pattern = _triggerResultsFilter.clone(
0170     triggerConditions = ( )
0171 )
0172 
0173 # L1-like path name
0174 process.filter_l1path_pattern = _triggerResultsFilter.clone(
0175     # if usePathStatus=True, this returns False for every event without throwing exceptions,
0176     # because patterns starting with "L1_" are used exclusively to check the L1-Trigger decisions
0177     triggerConditions = ( 'L1_Path', )
0178 )
0179 
0180 # real L1 trigger
0181 process.filter_l1singlemuopen_pattern = _triggerResultsFilter.clone(
0182     # if usePathStatus=True, this returns False for every event without throwing exceptions,
0183     # because patterns starting with "L1_" are used exclusively to check the L1-Trigger decisions
0184     triggerConditions = ( 'L1_SingleMuOpen', )
0185 )
0186 
0187 # TRUE
0188 process.filter_true_pattern = _triggerResultsFilter.clone(
0189     triggerConditions = ( 'TRUE', )
0190 )
0191 
0192 # FALSE
0193 process.filter_false_pattern = _triggerResultsFilter.clone(
0194     triggerConditions = ( 'FALSE', )
0195 )
0196 
0197 # Path name containing special keyword NOT
0198 process.filter_AlwaysNOTFalse_pattern = _triggerResultsFilter.clone(
0199     triggerConditions = ( 'AlwaysNOTFalse', )
0200 )
0201 
0202 # Path name containing special keyword FALSE
0203 process.filter_NOTAlwaysFALSE_pattern = _triggerResultsFilter.clone(
0204     triggerConditions = ( 'NOT AlwaysFALSE', )
0205 )
0206 
0207 
0208 process.Check_1 = cms.Path( process.filter_1 )
0209 process.Check_2 = cms.Path( process.filter_2 )
0210 process.Check_3 = cms.Path( process.filter_3 )
0211 
0212 process.Check_All_Explicit = cms.Path( process.filter_all_explicit )
0213 
0214 process.Check_Any_Or   = cms.Path( process.filter_any_or )
0215 process.Check_Any_Star = cms.Path( process.filter_any_star )
0216 
0217 process.Check_1_Pre             = cms.Path( process.filter_1_pre )
0218 process.Check_1_Pre_With_Masks1 = cms.Path( process.filter_1_pre_with_masks1 )
0219 process.Check_1_Pre_With_Masks2 = cms.Path( process.filter_1_pre_with_masks2 )
0220 process.Check_NOT_1_Pre         = cms.Path( process.filter_not_1_pre )
0221 process.Check_2_Pre             = cms.Path( process.filter_2_pre )
0222 process.Check_Any_Pre           = cms.Path( process.filter_any_pre )
0223 process.Check_Any_Pre_DoubleNOT = cms.Path( process.filter_any_pre_doubleNOT )
0224 process.Check_Not_Any_Pre       = cms.Path( process.filter_not_any_pre )
0225 process.Check_1xor2_withoutXOR  = cms.Path( process.filter_1xor2_withoutXOR )
0226 process.Check_1xor2_withXOR     = cms.Path( process.filter_1xor2_withXOR )
0227 
0228 process.Check_Any_Question           = cms.Path( process.filter_any_question )
0229 process.Check_Any_StarQuestion       = cms.Path( process.filter_any_starquestion )
0230 process.Check_Wrong_Name             = cms.Path( process.filter_wrong_name )
0231 process.Check_Wrong_Pattern          = cms.Path( process.filter_wrong_pattern )
0232 process.Check_Not_Wrong_Pattern      = cms.Path( ~ process.filter_wrong_pattern )
0233 process.Check_Empty_Pattern          = cms.Path( process.filter_empty_pattern )
0234 process.Check_L1Path_Pattern         = cms.Path( process.filter_l1path_pattern )
0235 process.Check_L1Singlemuopen_Pattern = cms.Path( process.filter_l1singlemuopen_pattern )
0236 process.Check_True_Pattern           = cms.Path( process.filter_true_pattern )
0237 process.Check_False_Pattern          = cms.Path( process.filter_false_pattern )
0238 process.Check_AlwaysNOTFalse_Pattern = cms.Path( process.filter_AlwaysNOTFalse_pattern )
0239 process.Check_NOTAlwaysFALSE_Pattern = cms.Path( process.filter_NOTAlwaysFALSE_pattern )
0240 
0241 # define an EndPath to analyze all other path results
0242 process.hltTrigReport = cms.EDAnalyzer( 'HLTrigReport',
0243     HLTriggerResults = cms.InputTag( 'TriggerResults', '', '@currentProcess' )
0244 )
0245 process.HLTAnalyzerEndpath = cms.EndPath( process.hltTrigReport )