Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:00

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