Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:17:56

0001 ## 11.02.16: Copied from https://raw.githubusercontent.com/dcurry09/EMTF8/master/L1Trigger/L1TMuonEndCap/test/runMuonEndCap.py
0002 
0003 import FWCore.ParameterSet.Config as cms
0004 import os
0005 import sys
0006 import subprocess
0007 
0008 process = cms.Process('L1TMuonEmulation')
0009 
0010 process.add_(cms.Service("PrintLoadingPlugins"))
0011 
0012 ## Import standard configurations
0013 process.load('Configuration.StandardSequences.Services_cff')
0014 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0015 process.load('FWCore.MessageService.MessageLogger_cfi')
0016 process.load('Configuration.EventContent.EventContent_cff')
0017 process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') ## Is this appropriate for 2015 data/MC? - AWB 18.04.16
0018 process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') ## Will this work on 0T data? - AWB 18.04.16
0019 process.load('Configuration.StandardSequences.RawToDigi_Data_cff') ## Will this work for MC? - AWB 18.04.16
0020 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0021 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0022 
0023 # ## Extra tools
0024 # process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
0025 #                                         ignoreTotal = cms.untracked.int32(1),
0026 #                                         monitorPssAndPrivate = cms.untracked.bool(True))
0027 
0028 ## CSCTF digis, phi / pT LUTs?
0029 process.load("L1TriggerConfig.L1ScalesProducers.L1MuTriggerScalesConfig_cff")
0030 process.load("L1TriggerConfig.L1ScalesProducers.L1MuTriggerPtScaleConfig_cff")
0031 
0032 ## Import RECO muon configurations
0033 process.load("RecoMuon.TrackingTools.MuonServiceProxy_cff")
0034 process.load("RecoMuon.TrackingTools.MuonTrackLoader_cff")
0035 
0036 ## Lumi JSON tools
0037 import FWCore.PythonUtilities.LumiList as LumiList
0038 # process.source.lumisToProcess = LumiList.LumiList(filename = 'goodList.json').getVLuminosityBlockRange()
0039 
0040 ## Message Logger and Event range
0041 process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100)
0042 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(100000) )
0043 process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(False))
0044 
0045 process.options = cms.untracked.PSet(
0046     # SkipEvent = cms.untracked.vstring('ProductNotFound')
0047 )
0048 
0049 ## Global Tags
0050 from Configuration.AlCa.GlobalTag import GlobalTag
0051 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0052 
0053 ## Default parameters for firmware version, pT LUT XMLs, and coordinate conversion LUTs
0054 process.load('L1Trigger.L1TMuonEndCap.fakeEmtfParams_cff') 
0055 # process.load('L1Trigger.L1TMuonEndCap.fakeEmtfParams_2016_data_cff') 
0056 
0057 # ## Un-comment out this line to choose the GlobalTag settings rather than fakeEmtfParams settings
0058 # ## Comment out this line to use default FW version rather than true FW version in data
0059 # process.es_prefer_GlobalTag = cms.ESPrefer("PoolDBESSource","GlobalTag")
0060 # process.es_prefer_GlobalTag = cms.ESPrefer("PoolDBESSource","emtfParamsSource")
0061 
0062 
0063 readFiles = cms.untracked.vstring()
0064 secFiles  = cms.untracked.vstring()
0065 process.source = cms.Source(
0066     'PoolSource',
0067     fileNames = readFiles,
0068     secondaryFileNames= secFiles
0069     #, eventsToProcess = cms.untracked.VEventRange('201196:265380261')
0070     )
0071 
0072 eos_cmd = '/afs/cern.ch/project/eos/installation/ams/bin/eos.select'
0073 
0074 ## 2017 Collisions, with RPC!
0075 # in_dir_name = '/eos/cms/tier0/store/data/Commissioning2017/L1Accept/RAW/v1/000/293/765/00000/'
0076 # in_dir_name = '/eos/cms/tier0/store/data/Commissioning2017/MinimumBias/RAW/v1/000/293/765/00000/'
0077 # in_dir_name = '/eos/cms/tier0/store/data/Run2017A/ZeroBias1/RAW/v1/000/295/128/00000/'
0078 # in_dir_name = '/eos/cms/tier0/store/data/Run2017A/Commissioning1/RAW/v1/000/295/317/00000/'
0079 # in_dir_name = '/eos/cms/tier0/store/data/Run2017A/ZeroBias1/RAW/v1/000/295/603/00000/'
0080 # in_dir_name = '/eos/cms/tier0/store/data/Run2017A/ZeroBias/RAW/v1/000/296/677/00000/'
0081 in_dir_name = '/eos/cms/tier0/store/data/Run2017D/DoubleMuon/RAW/v1/000/302/663/00000/'
0082 
0083 # ## 2017 Cosmics, with RPC!
0084 # in_dir_name = '/store/express/Commissioning2017/ExpressCosmics/FEVT/Express-v1/000/291/622/ 00000/'
0085 
0086 # ## ZeroBias, IsolatedBunch data
0087 # in_dir_name = '/store/data/Run2016H/ZeroBiasIsolatedBunch0/RAW/v1/000/282/650/00000/'
0088 
0089 # ## SingleMu, Z-->mumu, high pT RECO muon
0090 # in_dir_name = '/store/group/dpg_trigger/comm_trigger/L1Trigger/Data/Collisions/SingleMuon/Skims/200-pt-muon-skim_from-zmumu-skim-cmssw-8013/SingleMuon/'
0091 # in_dir_name = in_dir_name+'crab_200-pt-muon-skim_from-zmumu-skim-cmssw-8013__SingleMuon_ZMu-2016B_v1/160710_225040/0000/'
0092 # # in_dir_name = in_dir_name+'crab_200-pt-muon-skim_from-zmumu-skim-cmssw-8013__SingleMuon_ZMu-2016B_v2/160710_225006/0000/'
0093 # # in_dir_name = in_dir_name+'crab_200-pt-muon-skim_from-zmumu-skim-cmssw-8013__SingleMuon_ZMu-2016C_v2/160710_225057/0000/'
0094 # # in_dir_name = in_dir_name+'crab_200-pt-muon-skim_from-zmumu-skim-cmssw-8013__SingleMuon_ZMu-2016C_v2/160710_225057/0001/'
0095 # # in_dir_name = in_dir_name+'crab_200-pt-muon-skim_from-zmumu-skim-cmssw-8013__SingleMuon_ZMu-2016D_v2/160710_225023/0000/'
0096 
0097 iFile = 0
0098 for in_file_name in subprocess.check_output([eos_cmd, 'ls', in_dir_name]).splitlines():
0099     if not ('.root' in in_file_name): continue
0100     print(in_file_name)
0101     iFile += 1
0102     if iFile > 1: break  ## Just test on one file
0103     # readFiles.extend( cms.untracked.vstring(in_dir_name+in_file_name) )
0104     in_dir_name_T0 = in_dir_name.replace('/eos/cms/tier0/', 'root://cms-xrd-tzero.cern.ch//')
0105     readFiles.extend( cms.untracked.vstring(in_dir_name_T0+in_file_name) )
0106 
0107 # readFiles.extend([
0108 #         #'file:/afs/cern.ch/work/a/abrinke1/public/EMTF/Run2016G/RAW/279024/52622B4D-B265-E611-8099-FA163E326094.root'
0109 #         ])
0110 
0111 # secFiles.extend([
0112 #         'root://eoscms.cern.ch//eoscms//eos/cms/store/data/Run2015B/SingleMuon/RAW/v1/000/251/168/00000/382EE8DB-2825-E511-B3E0-02163E013597.root'
0113 #         ])
0114 
0115 
0116 process.content = cms.EDAnalyzer("EventContentAnalyzer")
0117 process.dumpED = cms.EDAnalyzer("EventContentAnalyzer")
0118 process.dumpES = cms.EDAnalyzer("PrintEventSetupContent")
0119 
0120 # ## EMTF Emulator
0121 process.load('EventFilter.L1TRawToDigi.emtfStage2Digis_cfi')
0122 process.load('L1Trigger.L1TMuonEndCap.simEmtfDigis_cfi')
0123 
0124 process.simEmtfDigis.verbosity = cms.untracked.int32(0)
0125 process.simEmtfDigis.CSCInput  = cms.InputTag('emtfStage2Digis')
0126 process.simEmtfDigis.RPCInput  = cms.InputTag('muonRPCDigis')
0127 
0128 
0129 ##############################################
0130 ###  Settings for 2016 vs. 2017 emulation  ###
0131 ##############################################
0132 
0133 # ## *** 2016 ***
0134 # ## From python/fakeEmtfParams_cff.py
0135 # process.emtfParams.PtAssignVersion = cms.int32(5)
0136 # process.emtfParams.FirmwareVersion = cms.int32(49999) ## Settings as of end-of-year 2016
0137 # process.emtfParams.PrimConvVersion = cms.int32(0)
0138 # process.emtfForestsDB.toGet = cms.VPSet(
0139 #     cms.PSet(
0140 #         record = cms.string("L1TMuonEndCapForestRcd"),
0141 #         tag = cms.string("L1TMuonEndCapForest_static_2016_mc")
0142 #         )
0143 #     )
0144 
0145 # ## From python/simEmtfDigis_cfi.py
0146 # process.simEmtfDigis.RPCEnable                 = cms.bool(False)
0147 # process.simEmtfDigis.spTBParams16.ThetaWindow  = cms.int32(4)
0148 # process.simEmtfDigis.spPCParams16.FixME11Edges = cms.bool(False)
0149 # process.simEmtfDigis.spPAParams16.PtLUTVersion = cms.int32(5)
0150 # process.simEmtfDigis.spPAParams16.BugGMTPhi    = cms.bool(True)
0151 
0152 # ## *** 2017 ***
0153 # ## From python/fakeEmtfParams_cff.py
0154 # process.emtfParams.PtAssignVersion = cms.int32(7)
0155 # process.emtfParams.FirmwareVersion = cms.int32(50001) ## Settings as of beginning-of-year 2017
0156 # process.emtfParams.PrimConvVersion = cms.int32(1)
0157 # process.emtfForestsDB.toGet = cms.VPSet(
0158 #     cms.PSet(
0159 #         record = cms.string("L1TMuonEndCapForestRcd"),
0160 #         tag = cms.string("L1TMuonEndCapForest_static_Sq_20170523_mc")
0161 #         )
0162 #     )
0163 
0164 # ## From python/simEmtfDigis_cfi.py
0165 # process.simEmtfDigis.RPCEnable                 = cms.bool(True)
0166 # process.simEmtfDigis.spTBParams16.ThetaWindow  = cms.int32(8)
0167 # process.simEmtfDigis.spPCParams16.FixME11Edges = cms.bool(True)
0168 # process.simEmtfDigis.spPAParams16.PtLUTVersion = cms.int32(7)
0169 # process.simEmtfDigis.spPAParams16.BugGMTPhi    = cms.bool(False)
0170 
0171 
0172 
0173 process.L1TMuonSeq = cms.Sequence(
0174     process.muonCSCDigis + ## Unpacked CSC LCTs from TMB
0175     process.csctfDigis + ## Necessary for legacy studies, or if you use csctfDigis as input
0176     process.muonRPCDigis +
0177     ## process.esProd + ## What do we loose by not having this? - AWB 18.04.16
0178     process.emtfStage2Digis +
0179     process.simEmtfDigis
0180     ## process.ntuple
0181     )
0182 
0183 process.L1TMuonPath = cms.Path(
0184     process.L1TMuonSeq
0185     )
0186 
0187 # outCommands = cms.untracked.vstring('keep *')
0188 outCommands = cms.untracked.vstring(
0189 
0190     'keep *_*emtf*_*_*',
0191     'keep *_*Emtf*_*_*',
0192     'keep *_*EMTF*_*_*',
0193 
0194     'keep recoMuons_muons__*',
0195     'keep CSCDetIdCSCCorrelatedLCTDigiMuonDigiCollection_*_*_*',
0196     'keep *_csctfDigis_*_*',
0197     'keep *_emtfStage2Digis_*_*',
0198     'keep *_simEmtfDigis_*_*',
0199     'keep *_gmtStage2Digis_*_*',
0200     'keep *_simGmtStage2Digis_*_*',
0201 
0202     )
0203 
0204 # out_dir = "/afs/cern.ch/work/a/abrinke1/public/EMTF/Commissioning/2017/"
0205 out_dir = "./"
0206 
0207 process.out = cms.OutputModule("PoolOutputModule",
0208                                # fileName = cms.untracked.string("EMTF_Tree_highPt200MuonSkim_2016D_emu16_noGT_10k.root"),
0209                                # fileName = cms.untracked.string(out_dir+"EMTF_Tree_ZeroBias_IsoBunch_282650_emul16_noGT_test.root"),
0210                                # fileName = cms.untracked.string("EMTF_Tree_Cosmics_291622_RPC_test.root"),
0211                                # fileName = cms.untracked.string(out_dir+"EMTF_Tree_Collisions_295665_exact_emul_500k.root"),
0212                                fileName = cms.untracked.string(out_dir+"EMTF_Tree_DoubleMu_302663_emul17_test.root"),
0213                                outputCommands = outCommands
0214                                )
0215 
0216 process.output_step = cms.EndPath(process.out)
0217 
0218 process.schedule = cms.Schedule(process.L1TMuonPath)
0219 
0220 process.schedule.extend([process.output_step])
0221 
0222 ## What does this do? Necessary? - AWB 29.04.16
0223 from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_PostLS1
0224 process = customise_csc_PostLS1(process)