Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-01 22:52:10

0001 from __future__ import print_function
0002 #
0003 # L1 Pattern Generator
0004 # ====================
0005 #
0006 # Generate a pattern file from RAW data by
0007 #  - extracting the GT inputs from the GCT and GT readout
0008 #  - Re-running the GT emulator with a different trigger menu
0009 # 
0010 
0011 import FWCore.ParameterSet.Config as cms
0012 import sys
0013 
0014 # 
0015 processName = "L1GtPatternGenerator"
0016 process = cms.Process(processName)
0017 
0018 
0019 # choose one (and only one) of the following source
0020 # usually the global tag must be used
0021 
0022 # data or RelVal
0023 useRelValSample = True
0024 useRelValSample = False
0025 
0026 # Frontier GlobalTag to use for EventSetup, should match source data
0027 
0028 if useRelValSample == True :
0029     globalTag = 'auto:startup'
0030 else :
0031     globalTag = 'auto:com10'        # GR_R_*
0032 
0033 
0034 # L1 menu selection via L1Trigger_custom  - if True, modify correspondingly L1Trigger_custom
0035 
0036 customL1Menu = True
0037 customL1Menu = False
0038 
0039 if customL1Menu == True :
0040     from L1Trigger.Configuration.L1Trigger_custom import customiseL1Menu
0041     process=customiseL1Menu(process)
0042 
0043 # reset all prescale factors and masks
0044 from L1Trigger.Configuration.L1Trigger_custom import customiseResetPrescalesAndMasks
0045 process = customiseResetPrescalesAndMasks(process)
0046 
0047 
0048 # Input files
0049 
0050 # initialize list of selected events and luminosity segments
0051 selectedEvents = cms.untracked.VEventRange()
0052 selectedLumis= cms.untracked.VLuminosityBlockRange()
0053 
0054 if useRelValSample == True :
0055     
0056     dataFiles = [
0057        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/0ABED808-FE79-E111-A8CB-003048FFCBFC.root',
0058        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/1ED8ACDC-FF79-E111-BEB8-0018F3D096C6.root',
0059        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/38A7298B-FF79-E111-8E7D-003048FFD736.root',
0060        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/48D6CA06-FE79-E111-8A08-001A92811716.root',
0061        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/521004DD-FF79-E111-860D-003048679150.root',
0062        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/52389B0B-FE79-E111-81E4-003048FFCBA4.root',
0063        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/54738A02-FE79-E111-B495-0030486790B0.root',
0064        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/5A921406-007A-E111-BFE5-003048FFD736.root',
0065        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/5E86D805-FE79-E111-9EC4-003048FFD7A2.root',
0066        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/66FCF29D-FF79-E111-9DCE-0018F3D096C6.root',
0067        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/6C7BB304-FE79-E111-8FAC-001A92810AEE.root',
0068        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/784AC1AB-FF79-E111-9C08-003048679150.root',
0069        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/929ACBC3-FF79-E111-805A-003048FFD736.root',
0070        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/A0D7350B-FE79-E111-8E0D-003048FFCC2C.root',
0071        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/C268AF61-FD79-E111-AB3D-00261894397D.root',
0072        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/D237D303-FE79-E111-B38B-001BFCDBD100.root',
0073        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/D428BF06-FE79-E111-8445-003048678FEA.root',
0074        '/store/relval/CMSSW_5_2_3/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/START52_V5-v1/0043/EEB8C84A-FC79-E111-9BBB-002618943985.root' ]
0075 
0076 
0077 else :
0078     # run 143657
0079     
0080     #dataType = 'RAW'
0081     #dataFiles = [
0082     #        '/store/data/Run2010A/MinimumBias/RAW/v1/000/143/657/00FB1636-91AE-DF11-B177-001D09F248F8.root',
0083     #        '/store/data/Run2010A/MinimumBias/RAW/v1/000/143/657/023EB128-51AE-DF11-96D3-001D09F24682.root'                 
0084     #        ]
0085     
0086     # run 160413
0087     #dataType = 'RAW'
0088     #dataFiles = [
0089     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/FE56EB13-BD4D-E011-B853-0030487C90D4.root',
0090     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/FCE828F2-AC4D-E011-B38A-0030487CD6B4.root',
0091     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/FC956724-CB4D-E011-8EC8-0030487CAF5E.root',
0092     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/FC8C6308-C24D-E011-85E8-0030487C7392.root',
0093     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/F8D4B148-B34D-E011-83DF-0030487CD812.root',
0094     #        '/store/data/Run2011A/MinimumBias/RAW/v1/000/160/413/F6F1F3D7-CB4D-E011-BAA7-0030487A195C.root'
0095     #        ]
0096 
0097 #    # run 165514
0098 #    dataType = 'RAW'
0099 #    dataFiles = [
0100 #                 '/store/data/Run2011A/MinimumBias/RAW/v1/000/165/514/28C65E11-E584-E011-AED9-0030487CD700.root',
0101 #                 '/store/data/Run2011A/MinimumBias/RAW/v1/000/165/514/44C0FC26-EE84-E011-B657-003048F1C424.root',
0102 #                 '/store/data/Run2011A/MinimumBias/RAW/v1/000/165/514/48379944-F084-E011-8022-0030487CD178.root',
0103 #                 '/store/data/Run2011A/MinimumBias/RAW/v1/000/165/514/4A1297CC-EC84-E011-BCF8-0030487CD6E6.root'
0104 #                 ]
0105     
0106     # sample '205666.A.storageManager'
0107     dataType = 'StreamFile'
0108     dataFiles = [
0109 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0001.A.storageManager.00.0000.dat',
0110 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0021.A.storageManager.01.0000.dat',
0111 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0041.A.storageManager.02.0000.dat',
0112 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0061.A.storageManager.03.0000.dat',
0113 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0081.A.storageManager.04.0000.dat',
0114             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0101.A.storageManager.05.0000.dat',
0115 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0121.A.storageManager.06.0000.dat',
0116 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0141.A.storageManager.07.0000.dat',
0117             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0161.A.storageManager.08.0000.dat',
0118 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0181.A.storageManager.09.0000.dat',                   
0119 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0201.A.storageManager.10.0000.dat',                   
0120 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0221.A.storageManager.11.0000.dat',                   
0121 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0241.A.storageManager.12.0000.dat',                   
0122 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0261.A.storageManager.13.0000.dat',
0123             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0281.A.storageManager.14.0000.dat',
0124 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0301.A.storageManager.15.0000.dat',
0125 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0321.A.storageManager.00.0000.dat',
0126             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0341.A.storageManager.01.0000.dat',
0127             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0361.A.storageManager.02.0000.dat',
0128 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0381.A.storageManager.03.0000.dat',
0129 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0401.A.storageManager.04.0000.dat',
0130 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0421.A.storageManager.05.0000.dat',
0131 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0441.A.storageManager.06.0000.dat',
0132 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0461.A.storageManager.07.0000.dat',
0133 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0481.A.storageManager.08.0000.dat',
0134 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0501.A.storageManager.09.0000.dat',
0135 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0521.A.storageManager.10.0000.dat',
0136 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0541.A.storageManager.11.0000.dat',
0137 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0561.A.storageManager.12.0000.dat',
0138 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0581.A.storageManager.13.0000.dat',
0139 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0601.A.storageManager.14.0000.dat',
0140 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0621.A.storageManager.15.0000.dat',
0141 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0641.A.storageManager.00.0000.dat',
0142 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0661.A.storageManager.01.0000.dat',
0143             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0681.A.storageManager.02.0000.dat',
0144             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0701.A.storageManager.03.0000.dat',
0145             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0721.A.storageManager.04.0000.dat'                     
0146                  ]
0147  
0148     selectedEvents = cms.untracked.VEventRange(
0149                                     '205666:101:125069341',
0150                                     '205666:161:238160322',
0151                                     '205666:281:443371795',
0152                                     '205666:341:537654884',
0153                                     '205666:361:567121052', 
0154                                     '205666:361:567121053-205666:721:MAX'
0155                                     )
0156             
0157 
0158 
0159 # FEDRawDataCollection label
0160 fedLabel='rawDataCollector'
0161    
0162 
0163 ###############
0164 # Process setup
0165 ###############
0166 
0167 # Run on one orbit of events at most - more doesn't make sense
0168 # because the pattern file can contain at most 3564 lines.
0169 process.maxEvents = cms.untracked.PSet ( 
0170   input = cms.untracked.int32(3564),
0171 )
0172 
0173 # input source according to data type
0174 if dataType == 'StreamFile' :
0175     process.source = cms.Source("NewEventStreamFileReader", 
0176                                 fileNames=cms.untracked.vstring(dataFiles),
0177                                 lumisToProcess = selectedLumis,
0178                                 eventsToProcess = selectedEvents
0179                                 )
0180 else :        
0181     process.source = cms.Source ('PoolSource', 
0182                                  fileNames=cms.untracked.vstring(dataFiles), 
0183                                  lumisToProcess = selectedLumis,
0184                                  eventsToProcess = selectedEvents
0185                                  )
0186 
0187 
0188 # Load and configure modules via global tag
0189 process.load('Configuration.StandardSequences.GeometryDB_cff')
0190 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0191 
0192 if globalTag.count('auto') :
0193     from Configuration.AlCa.autoCond import autoCond
0194     useGlobalTag = autoCond[globalTag.replace('auto:', '')]
0195 else :
0196     useGlobalTag = globalTag    
0197 process.GlobalTag.globaltag = useGlobalTag
0198 
0199 # Global Trigger unpacker - produce decision & regional muons from readout record
0200 process.load("EventFilter.L1GlobalTriggerRawToDigi.l1GtUnpack_cfi")
0201 process.l1GtUnpack.DaqGtInputTag = cms.InputTag(fedLabel)
0202 
0203 # GCT unpacker - produce egamma objects / jets / etc from readout
0204 process.load("EventFilter.GctRawToDigi.l1GctHwDigis_cfi")
0205 process.l1GctHwDigis.inputLabel = cms.InputTag(fedLabel)
0206 
0207 # Load and configure Pattern Generator
0208 process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtPatternGenerator_cfi")
0209 
0210 # Take GCT and GMT data from unpackers
0211 gctLabel = 'l1GctHwDigis'
0212 gmtLabel = 'l1GtUnpack'
0213 process.l1GtPatternGenerator.GctInputTag = gctLabel
0214 process.l1GtPatternGenerator.GmtInputTag = gmtLabel
0215 process.l1GtPatternGenerator.CscInputTag = cms.InputTag(gmtLabel, "CSC")
0216 process.l1GtPatternGenerator.DtInputTag = cms.InputTag(gmtLabel, "DT")
0217 process.l1GtPatternGenerator.RpcbInputTag = cms.InputTag(gmtLabel, "RPCb")
0218 process.l1GtPatternGenerator.RpcfInputTag = cms.InputTag(gmtLabel, "RPCf")
0219 
0220 ## enable detailed output (event no/bx per line, item tracing)
0221 #process.l1GtPatternGenerator.DebugOutput = cms.bool(True)
0222 
0223 # Global Trigger emulator - take input data from 
0224 # the same sources as the pattern writer
0225 process.load("L1Trigger.GlobalTrigger.gtDigis_cfi")
0226 process.gtDigis.GmtInputTag = gmtLabel
0227 process.gtDigis.GctInputTag = gctLabel
0228 process.gtDigis.ProduceL1GtEvmRecord = False
0229 process.gtDigis.ProduceL1GtObjectMapRecord = False
0230 process.gtDigis.WritePsbL1GtDaqRecord = False
0231 process.gtDigis.EmulateBxInEvent = -1
0232 
0233 # temporary fix for L1 GT emulator configuration in hardware validation
0234 process.gtDigis.RecordLength = cms.vint32(3, 5)
0235 process.gtDigis.AlternativeNrBxBoardDaq = 0x101
0236 process.gtDigis.AlternativeNrBxBoardEvm = 0x2
0237 
0238 # switch on verbosity in L1 GT emulator
0239 #process.gtDigis.Verbosity = cms.untracked.int32(1)
0240 
0241 
0242 
0243 # Global Trigger report (emulator)
0244 import L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi
0245 process.l1GtTrigReportEmul = L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi.l1GtTrigReport.clone()
0246 process.l1GtTrigReportEmul.L1GtRecordInputTag = 'gtDigis'
0247 # Report pass/fail for each trigger
0248 process.l1GtTrigReportEmul.PrintVerbosity = 10
0249 
0250 # path to be run
0251 # - the pattern generator depends on the decision records produced by the GT emulator
0252 process.p = cms.Path(process.l1GtUnpack * process.l1GctHwDigis * process.gtDigis * process.l1GtPatternGenerator * process.l1GtTrigReportEmul)
0253 
0254 # services
0255 
0256 # Message Logger
0257 process.load('FWCore.MessageService.MessageLogger_cfi')
0258 process.MessageLogger.debugModules = ['l1GtPatternGenerator', 'gtDigis']
0259 
0260 process.MessageLogger.cerr.enable = False
0261 process.MessageLogger.cerr.default.limit = 0
0262 process.MessageLogger.cerr.FwkReport.limit = 0
0263 process.MessageLogger.cerr.FwkSummary.limit = 0
0264 
0265 process.MessageLogger.files.L1GtPatternGenerator_debug = cms.untracked.PSet( 
0266         threshold = cms.untracked.string('DEBUG'),
0267         DEBUG = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0268         INFO = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0269         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0270         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0271         L1GtPatternGenerator = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0272         L1GtTrigReport = cms.untracked.PSet( limit = cms.untracked.int32(0) ) 
0273         )
0274 
0275 process.MessageLogger.files.L1GtPatternGenerator_info = cms.untracked.PSet( 
0276         threshold = cms.untracked.string('INFO'),
0277         INFO = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0278         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0279         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0280         L1GtPatternGenerator = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0281         L1GtTrigReport = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0282         )
0283 
0284 process.MessageLogger.files.L1GtPatternGenerator_warning = cms.untracked.PSet( 
0285         threshold = cms.untracked.string('WARNING'),
0286         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0287         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0288         L1GtPatternGenerator = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0289         L1GtTrigReport = cms.untracked.PSet( limit = cms.untracked.int32(0) ) 
0290         )
0291 
0292 process.MessageLogger.files.L1GtPatternGenerator_error = cms.untracked.PSet( 
0293         threshold = cms.untracked.string('ERROR'),
0294         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0295         L1GtPatternGenerator = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0296         L1GtTrigReport = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0297        )
0298 
0299 print("Setup complete.")
0300 
0301 ## output - disabled by default, the pattern generator writes to a text file
0302 #process.outputL1GtPatternGen = cms.OutputModule("PoolOutputModule",
0303 #    fileName = cms.untracked.string('testGt_PatternGenerator_output.root')
0304 #)
0305 
0306 #process.outpath = cms.EndPath(process.outputL1GtPatternGen)