Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-03 01:58:10

0001 from __future__ import print_function
0002 import os
0003 import FWCore.ParameterSet.Config as cms
0004 
0005 import EventFilter.L1TXRawToDigi.util as util
0006 
0007 from FWCore.ParameterSet.VarParsing import VarParsing
0008 
0009 options = VarParsing()
0010 options.register('runNumber', 0, VarParsing.multiplicity.singleton, VarParsing.varType.int, 'Run to analyze')
0011 options.register('lumis', '1-max', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Lumis')
0012 options.register('dataStream', '/ExpressPhysics/Run2015D-Express-v4/FEVT', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Dataset to look for run in')
0013 options.register('inputFiles', [], VarParsing.multiplicity.list, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0014 options.register('inputFileList', '', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0015 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')
0016 options.parseArguments()
0017 
0018 def formatLumis(lumistring, run) :
0019     lumis = (lrange.split('-') for lrange in lumistring.split(','))
0020     runlumis = (['%d:%s' % (run,lumi) for lumi in lrange] for lrange in lumis)
0021     return ['-'.join(l) for l in runlumis]
0022 
0023 print('Getting files for run %d...' % options.runNumber)
0024 if len(options.inputFiles) is 0 and options.inputFileList is '' :
0025     inputFiles = util.getFilesForRun(options.runNumber, options.dataStream)
0026 elif len(options.inputFileList) > 0 :
0027     with open(options.inputFileList) as f :
0028         inputFiles = list((line.strip() for line in f))
0029 else :
0030     inputFiles = cms.untracked.vstring(options.inputFiles)
0031 if len(inputFiles) is 0 :
0032     raise Exception('No files found for dataset %s run %d' % (options.dataStream, options.runNumber))
0033 print('Ok, time to analyze')
0034 
0035 process = cms.Process("L1TCaloLayer1Test")
0036 
0037 # import of standard configurations
0038 process.load('Configuration.StandardSequences.Services_cff')
0039 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0040 process.load('FWCore.MessageService.MessageLogger_cfi')
0041 process.load('Configuration.EventContent.EventContent_cff')
0042 process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0043 process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
0044 process.load('Configuration.StandardSequences.RawToDigi_Data_cff')
0045 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0046 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0047 from Configuration.AlCa.GlobalTag import GlobalTag
0048 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0049 #process.GlobalTag = GlobalTag(process.GlobalTag, '80X_dataRun2_HLT_v8', '')
0050 #process.load('L1Trigger.Configuration.SimL1Emulator_cff')
0051 #process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff')
0052 
0053 # To get L1 CaloParams
0054 process.load('L1Trigger.L1TCalorimeter.caloStage2Params_2016_v2_1_cfi')
0055 # To get CaloTPGTranscoder
0056 process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff')
0057 
0058 process.HcalTPGCoderULUT.LUTGenerationMode = cms.bool(False)
0059 
0060 process.load("Configuration.Geometry.GeometryExtended2016Reco_cff")
0061 
0062 process.es_pool = cms.ESSource("PoolDBESSource",
0063      process.CondDBSetup,
0064      timetype = cms.string('runnumber'),
0065      toGet = cms.VPSet(
0066          cms.PSet(record = cms.string("HcalLutMetadataRcd"),
0067              tag = cms.string("HcalLutMetadata_HFTP_1x1")
0068              ),
0069          cms.PSet(record = cms.string("HcalElectronicsMapRcd"),
0070              tag = cms.string("HcalElectronicsMap_HFTP_1x1")
0071              )
0072          ),
0073      connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
0074      authenticationMethod = cms.untracked.uint32(0)
0075      )
0076 process.es_prefer_es_pool = cms.ESPrefer( "PoolDBESSource", "es_pool" )
0077 
0078 process.load('EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi')
0079 
0080 process.load('L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Digis_cfi')
0081 process.simCaloStage2Layer1Digis.useECALLUT = cms.bool(True)
0082 process.simCaloStage2Layer1Digis.useHCALLUT = cms.bool(True)
0083 process.simCaloStage2Layer1Digis.useHFLUT = cms.bool(True)
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)