Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:12:56

0001 import os, sys, glob
0002 import FWCore.ParameterSet.Config as cms
0003 from Configuration.StandardSequences.Eras import eras
0004 from Configuration.ProcessModifiers.gpu_cff import gpu
0005 from RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi import HGCalRecHit
0006 
0007 PU=0
0008 withGPU=0
0009 
0010 #package loading
0011 process = cms.Process("gpuTiming", gpu) if withGPU else cms.Process("cpuTiming")
0012 process.load('FWCore.MessageService.MessageLogger_cfi')
0013 process.load('Configuration.StandardSequences.Services_cff')
0014 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0015 process.load('Configuration.StandardSequences.MagneticField_cff')
0016 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0017 process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
0018 process.load('HeterogeneousCore.CUDACore.ProcessAcceleratorCUDA_cfi')
0019 process.load('RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi')
0020 process.load('SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi')
0021 process.load( "HLTrigger.Timer.FastTimerService_cfi" )
0022 
0023 from Configuration.AlCa.GlobalTag import GlobalTag
0024 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '')
0025 
0026 indir =  '/home/bfontana/' #'/eos/user/b/bfontana/Samples/'
0027 filename_suff = 'hadd_out_PU' + str(PU) + '_uncompressed' #'step3_ttbar_PU' + str(PU)
0028 fNames = [ 'file:' + x for x in glob.glob(os.path.join(indir, filename_suff + '*.root')) ]
0029 if len(fNames)==0:
0030     print('Used globbing: ', glob.glob(os.path.join(indir, filename_suff + '*.root')))
0031     raise ValueError('No input files!')
0032 print('Input: ', fNames)
0033 keep = 'keep *'
0034 process.source = cms.Source("PoolSource",
0035                             fileNames = cms.untracked.vstring(fNames),
0036                             inputCommands = cms.untracked.vstring(keep),
0037                             duplicateCheckMode = cms.untracked.string("noDuplicateCheck") )
0038 
0039 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0040 wantSummaryFlag = True
0041 process.options = cms.untracked.PSet(
0042     wantSummary = cms.untracked.bool( wantSummaryFlag )) #add option for edmStreams
0043 
0044 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPU_cfi')
0045 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPUtoSoA_cfi')
0046 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitFromSoA_cfi')
0047 
0048 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPU_cfi')
0049 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPUtoSoA_cfi')
0050 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitFromSoA_cfi')
0051 
0052 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPU_cfi')
0053 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPUtoSoA_cfi')
0054 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitFromSoA_cfi')
0055 
0056 process.ThroughputService = cms.Service( "ThroughputService",
0057                                          eventRange = cms.untracked.uint32( 300 ),
0058                                          eventResolution = cms.untracked.uint32( 1 ),
0059                                          printEventSummary = cms.untracked.bool( wantSummaryFlag ),
0060                                          enableDQM = cms.untracked.bool( False )
0061                                          #valid only for enableDQM=True
0062                                          #dqmPath = cms.untracked.string( "HLT/Throughput" ),
0063                                          #timeRange = cms.untracked.double( 60000.0 ),
0064                                          #dqmPathByProcesses = cms.untracked.bool( False ),
0065                                          #timeResolution = cms.untracked.double( 5.828 )
0066 )
0067 
0068 process.FastTimerService.enableDQM = False
0069 process.FastTimerService.writeJSONSummary = True
0070 process.FastTimerService.jsonFileName = 'resources.json'
0071 process.MessageLogger.categories.append('ThroughputService')
0072 
0073 if withGPU:
0074     process.ee_t = cms.Task( process.EERecHitGPUProd, process.EERecHitGPUtoSoAProd, process.EERecHitFromSoAProd )
0075     process.hef_t = cms.Task( process.HEFRecHitGPUProd, process.HEFRecHitGPUtoSoAProd, process.HEFRecHitFromSoAProd )
0076     process.heb_t = cms.Task( process.HEBRecHitGPUProd, process.HEBRecHitGPUtoSoAProd, process.HEBRecHitFromSoAProd )
0077     process.recHitsTask = cms.Task( process.ee_t, process.hef_t, process.heb_t )
0078     outkeeps = ['keep *_EERecHitFromSoAProd_*_*',
0079                 'keep *_HEFRecHitFromSoAProd_*_*',
0080                 'keep *_HEBRecHitFromSoAProd_*_*']
0081 else:
0082     process.recHitsClone = HGCalRecHit.clone()
0083     process.recHitsTask = cms.Task( process.recHitsClone ) #CPU version
0084     outkeeps = ['keep *_*_' + f + '*_*' for f in ['HGCEERecHits', 'HGCHEFRecHits', 'HGCHEBRecHits'] ]
0085 
0086 process.path = cms.Path( process.recHitsTask )
0087 
0088 """
0089 process.consumer = cms.EDAnalyzer("GenericConsumer",                     
0090                                   eventProducts = cms.untracked.vstring('EERecHitGPUProd',
0091                                                                         'HEFRecHitGPUProd',
0092                                                                         'HEBRecHitGPUProd') )
0093 """
0094 """
0095 process.consumer = cms.EDAnalyzer('GenericConsumer',
0096                                   eventProducts = cms.untracked.vstring('recHitsClone') )
0097                                   #eventProducts = cms.untracked.vstring('HGCalUncalibRecHit') ) #uncalib only (to assess reading speed)
0098 """
0099 """
0100 process.consume_step = cms.EndPath(process.consumer)
0101 """
0102 
0103 process.out = cms.OutputModule( "PoolOutputModule", 
0104                                 fileName = cms.untracked.string( '/home/bfontana/out_Timing_PU' + str(PU) + '_' +str(withGPU)+ '.root'),
0105                                 outputCommands = cms.untracked.vstring(outkeeps[0], outkeeps[1], outkeeps[2])
0106 )
0107 process.outpath = cms.EndPath(process.out)
0108 
0109 
0110 #process.schedule.append(process.consume_step) #in case one has multiple Paths or EndPaths to run