Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:16:31

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process( "TEST" )
0004 
0005 ## MessageLogger
0006 process.load( "FWCore.MessageLogger.MessageLogger_cfi" )
0007 
0008 ## Options and Output Report
0009 process.options = cms.untracked.PSet(
0010   wantSummary = cms.untracked.bool( False )
0011 )
0012 
0013 ## Source
0014 from PhysicsTools.PatAlgos.tools.cmsswVersionTools import pickRelValInputFiles
0015 process.source = cms.Source(
0016   "PoolSource"
0017 , fileNames = cms.untracked.vstring(
0018     pickRelValInputFiles( cmsswVersion = 'CMSSW_12_5_0_pre3'
0019                         , globalTag    = 'phase1_2022_realistic'
0020                         )
0021   )
0022 )
0023 ## Maximal Number of Events
0024 process.maxEvents = cms.untracked.PSet(
0025   input = cms.untracked.int32( 1000 ) # reduce number of events for testing
0026 )
0027 
0028 ## Geometry and Detector Conditions (needed for a few patTuple production steps)
0029 process.load("Configuration.StandardSequences.GeometryDB_cff")
0030 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0031 from Configuration.AlCa.autoCond import autoCond
0032 process.GlobalTag.globaltag = cms.string( autoCond[ 'startup' ] )
0033 process.load("Configuration.StandardSequences.MagneticField_cff")
0034 
0035 ## Standard PAT Configuration File
0036 process.load("PhysicsTools.PatAlgos.patSequences_cff")
0037 process.patJetCorrFactors.useRho = False
0038 
0039 process.selectedPatMuons.cut = 'isTrackerMuon=1 & isGlobalMuon=1 & innerTrack.numberOfValidHits>=11 & globalTrack.normalizedChi2<10.0  & globalTrack.hitPattern.numberOfValidMuonHits>0 & abs(dB)<0.02 & (trackIso+caloIso)/pt<0.05'
0040 
0041 ## ---
0042 ## Define the path
0043 ## ---
0044 process.p = cms.Path(
0045   process.patDefaultSequence
0046 )
0047 
0048 ### ========
0049 ### Plug-ins
0050 ### ========
0051 
0052 ## ---
0053 ## PAT trigger matching
0054 ## --
0055 process.muonTriggerMatchHLTMuons = cms.EDProducer(
0056   # matching in DeltaR, sorting by best DeltaR
0057   "PATTriggerMatcherDRLessByR"
0058   # matcher input collections
0059 , src     = cms.InputTag( 'cleanPatMuons' )
0060 , matched = cms.InputTag( 'patTrigger' )
0061   # selections of trigger objects
0062 , matchedCuts = cms.string( 'type( "TriggerMuon" ) && path( "HLT_Mu24_v*", 1, 0 )' ) # input does not yet have the 'saveTags' parameter in HLT
0063   # selection of matches
0064 , maxDPtRel   = cms.double( 0.5 ) # no effect here
0065 , maxDeltaR   = cms.double( 0.5 )
0066 , maxDeltaEta = cms.double( 0.2 ) # no effect here
0067   # definition of matcher output
0068 , resolveAmbiguities    = cms.bool( True )
0069 , resolveByMatchQuality = cms.bool( True )
0070 )
0071 
0072 ### ============
0073 ### Python tools
0074 ### ============
0075 
0076 ## --
0077 ## Switch to selected PAT objects in the main work flow
0078 ## --
0079 from PhysicsTools.PatAlgos.tools.coreTools import removeCleaning
0080 removeCleaning( process, outputInProcess = False )
0081 
0082 ## --
0083 ## Switch on PAT trigger
0084 ## --
0085 from PhysicsTools.PatAlgos.tools.trigTools import *
0086 switchOnTriggerMatching( process, triggerMatchers = [ 'muonTriggerMatchHLTMuons' ], outputModule = '' )
0087 # Switch to selected PAT objects in the trigger matching
0088 removeCleaningFromTriggerMatching( process, outputModule = '' )
0089 
0090 ## ---
0091 ## Add analysis
0092 ## ---
0093 process.TFileService = cms.Service( "TFileService",
0094     fileName = cms.string( 'analyzePatTrigger_onTheFly.root' )
0095 )
0096 process.triggerAnalysis = cms.EDAnalyzer( "PatTriggerAnalyzer",
0097     trigger      = cms.InputTag( "patTrigger" ),
0098     triggerEvent = cms.InputTag( "patTriggerEvent" ),
0099     muons        = cms.InputTag( "selectedPatMuons" ),
0100     muonMatch    = cms.string( 'muonTriggerMatchHLTMuons' ),
0101     minID = cms.uint32( 81 ),
0102     maxID = cms.uint32( 96 )
0103 )
0104 process.p += process.triggerAnalysis