Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 import EventFilter.L1TXRawToDigi.util as util
0005 
0006 from FWCore.ParameterSet.VarParsing import VarParsing
0007 
0008 options = VarParsing()
0009 options.register('runNumber', 0, VarParsing.multiplicity.singleton, VarParsing.varType.int, 'Run to analyze')
0010 options.register('lumis', '1-max', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Lumis')
0011 options.register('dataStream', '/ExpressPhysics/Run2015D-Express-v4/FEVT', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Dataset to look for run in')
0012 options.register('inputFiles', [], VarParsing.multiplicity.list, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0013 options.register('inputFileList', '', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0014 options.register('useORCON', False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, 'Use ORCON for conditions.  This is necessary for very recent runs where conditions have not propogated to Frontier')
0015 options.parseArguments()
0016 
0017 def formatLumis(lumistring, run) :
0018     lumis = (lrange.split('-') for lrange in lumistring.split(','))
0019     runlumis = (['%d:%s' % (run,lumi) for lumi in lrange] for lrange in lumis)
0020     return ['-'.join(l) for l in runlumis]
0021 
0022 print('Getting files for run %d...' % options.runNumber)
0023 if len(options.inputFiles) is 0 and options.inputFileList is '' :
0024     inputFiles = util.getFilesForRun(options.runNumber, options.dataStream)
0025 elif len(options.inputFileList) > 0 :
0026     with open(options.inputFileList) as f :
0027         inputFiles = list((line.strip() for line in f))
0028 else :
0029     inputFiles = cms.untracked.vstring(options.inputFiles)
0030 if len(inputFiles) is 0 :
0031     raise Exception('No files found for dataset %s run %d' % (options.dataStream, options.runNumber))
0032 print('Ok, time to analyze')
0033 
0034 process = cms.Process("L1TCaloLayer1Test")
0035 
0036 # import of standard configurations
0037 process.load('Configuration.StandardSequences.Services_cff')
0038 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0039 process.load('FWCore.MessageService.MessageLogger_cfi')
0040 process.load('Configuration.EventContent.EventContent_cff')
0041 process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0042 process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
0043 process.load('Configuration.StandardSequences.RawToDigi_Data_cff')
0044 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0045 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0046 from Configuration.AlCa.GlobalTag import GlobalTag
0047 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0048 #process.GlobalTag = GlobalTag(process.GlobalTag, '80X_dataRun2_HLT_v8', '')
0049 #process.load('L1Trigger.Configuration.SimL1Emulator_cff')
0050 #process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
0051 
0052 # To get L1 CaloParams
0053 process.load('L1Trigger.L1TCalorimeter.caloStage2Params_2016_v2_1_cfi')
0054 # To get CaloTPGTranscoder
0055 process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff')
0056 
0057 process.HcalTPGCoderULUT.LUTGenerationMode = cms.bool(False)
0058 
0059 process.load("Configuration.Geometry.GeometryExtended2016Reco_cff")
0060 
0061 process.es_pool = cms.ESSource("PoolDBESSource",
0062      process.CondDBSetup,
0063      timetype = cms.string('runnumber'),
0064      toGet = cms.VPSet(
0065          cms.PSet(record = cms.string("HcalLutMetadataRcd"),
0066              tag = cms.string("HcalLutMetadata_HFTP_1x1")
0067              ),
0068          cms.PSet(record = cms.string("HcalElectronicsMapRcd"),
0069              tag = cms.string("HcalElectronicsMap_HFTP_1x1")
0070              )
0071          ),
0072      connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
0073      authenticationMethod = cms.untracked.uint32(0)
0074      )
0075 process.es_prefer_es_pool = cms.ESPrefer( "PoolDBESSource", "es_pool" )
0076 
0077 process.load('EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi')
0078 
0079 process.load('L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Digis_cfi')
0080 process.simCaloStage2Layer1Digis.useECALLUT = cms.bool(True)
0081 process.simCaloStage2Layer1Digis.useHCALLUT = cms.bool(True)
0082 process.simCaloStage2Layer1Digis.useHFLUT = cms.bool(True)
0083 process.simCaloStage2Layer1Digis.useHCALFBLUT = cms.bool(False),
0084 process.simCaloStage2Layer1Digis.useLSB = cms.bool(True)
0085 process.simCaloStage2Layer1Digis.verbose = cms.bool(True)
0086 process.simCaloStage2Layer1Digis.ecalToken = cms.InputTag("simEcalTriggerPrimitiveDigis"),
0087 process.simCaloStage2Layer1Digis.hcalToken = cms.InputTag("simHcalTriggerPrimitiveDigis"),
0088 
0089 process.load('L1Trigger.L1TCaloLayer1.layer1Validator_cfi')
0090 process.layer1Validator.testRegionToken = cms.InputTag("simEcalTriggerPrimitiveDigis"),
0091 process.layer1Validator.emulRegionToken = cms.InputTag("simCaloStage2Layer1Digis")
0092 process.layer1Validator.emulTowerToken = cms.InputTag("simCaloStage2Layer1Digis")
0093 process.layer1Validator.validateTowers = cms.bool(False)
0094 process.layer1Validator.validateRegions = cms.bool(True)
0095 process.layer1Validator.verbose = cms.bool(True)
0096 
0097 process.load('EventFilter.RctRawToDigi.l1RctHwDigis_cfi')
0098 
0099 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) )
0100 
0101 process.source = cms.Source("PoolSource",
0102     fileNames = cms.untracked.vstring(inputFiles)
0103 )
0104 
0105 outputFile = '/data/' + os.environ['USER'] + '/l1tCaloLayer1-' + str(options.runNumber) + '.root'
0106 
0107 process.out = cms.OutputModule("PoolOutputModule",
0108     fileName = cms.untracked.string(outputFile),
0109     outputCommands = cms.untracked.vstring('drop *', 'keep *_*_*_L1TCaloLayer1Test')
0110 )
0111 
0112 process.p = cms.Path(process.l1tCaloLayer1Digis*process.simCaloStage2Layer1Digis*process.layer1Validator) #*process.rctDigis
0113 
0114 process.e = cms.EndPath(process.out)