Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:13:06

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 def getHeterogeneousRecHitsSource(pu):
0008     indir = '/eos/user/b/bfontana/Samples/' #indir = '/home/bfontana/'
0009     filename_suff = 'step3_ttbar_PU' + str(pu) #filename_suff = 'hadd_out_PU' + str(pu)
0010     fNames = [ 'file:' + x for x in glob.glob(os.path.join(indir, filename_suff + '*.root')) ]
0011     print(indir, filename_suff, pu, fNames)
0012     for _ in range(4):
0013         fNames.extend(fNames)
0014     if len(fNames)==0:
0015         print('Used globbing: ', glob.glob(os.path.join(indir, filename_suff + '*.root')))
0016         raise ValueError('No input files!')
0017 
0018     keep = 'keep *'
0019     drop1 = 'drop CSCDetIdCSCALCTPreTriggerDigiMuonDigiCollection_simCscTriggerPrimitiveDigis__HLT'
0020     drop2 = 'drop HGCRecHitsSorted_HGCalRecHit_HGC*E*RecHits_*'
0021     return cms.Source("PoolSource",
0022                       fileNames = cms.untracked.vstring(fNames),
0023                       inputCommands = cms.untracked.vstring(keep, drop1, drop2),
0024                       duplicateCheckMode = cms.untracked.string("noDuplicateCheck"))
0025 
0026 #arguments parsing
0027 from FWCore.ParameterSet.VarParsing import VarParsing
0028 F = VarParsing('analysis')
0029 F.register('PU',
0030            1,
0031            F.multiplicity.singleton,
0032            F.varType.int,
0033            "Pileup to consider.")
0034 F.parseArguments()
0035 
0036 #package loading
0037 process = cms.Process("gpuValidation", gpu) 
0038 process.load('FWCore.MessageService.MessageLogger_cfi')
0039 process.load('Configuration.StandardSequences.Services_cff')
0040 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0041 process.load('Configuration.StandardSequences.MagneticField_cff')
0042 #process.load('Configuration.EventContent.EventContent_cff')
0043 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0044 process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
0045 process.load('HeterogeneousCore.CUDACore.ProcessAcceleratorCUDA_cfi')
0046 process.load('RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi')
0047 process.load('SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi')
0048 
0049 from Configuration.AlCa.GlobalTag import GlobalTag
0050 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '')
0051 
0052 #TFileService
0053 
0054 dirName = '/eos/user/b/bfontana/Samples/'
0055 fileName = 'validation' + str(F.PU) + '.root'
0056 process.TFileService = cms.Service("TFileService", 
0057                                    fileName = cms.string( os.path.join(dirName,fileName) ),
0058                                    closeFileFast = cms.untracked.bool(True)
0059                                )
0060 
0061 process.source = getHeterogeneousRecHitsSource(F.PU)
0062 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )
0063 process.options = cms.untracked.PSet(
0064     wantSummary = cms.untracked.bool( False )) #add option for edmStreams
0065 
0066 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPU_cfi')
0067 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPUtoSoA_cfi')
0068 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitFromSoA_cfi')
0069 
0070 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPU_cfi')
0071 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPUtoSoA_cfi')
0072 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitFromSoA_cfi')
0073 
0074 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPU_cfi')
0075 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPUtoSoA_cfi')
0076 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitFromSoA_cfi')
0077 
0078 process.HGCalRecHits = HGCalRecHit.clone()
0079 
0080 process.valid = cms.EDAnalyzer( 'HeterogeneousHGCalRecHitsValidator',
0081                                 cpuRecHitsEEToken = cms.InputTag('HGCalRecHits', 'HGCEERecHits'),
0082                                 gpuRecHitsEEToken = cms.InputTag('EERecHitFromSoAProd'),
0083                                 cpuRecHitsHSiToken = cms.InputTag('HGCalRecHits', 'HGCHEFRecHits'),
0084                                 gpuRecHitsHSiToken = cms.InputTag('HEFRecHitFromSoAProd'),
0085                                 cpuRecHitsHSciToken = cms.InputTag('HGCalRecHits', 'HGCHEBRecHits'),
0086                                 gpuRecHitsHSciToken = cms.InputTag('HEBRecHitFromSoAProd')
0087 )
0088 
0089 process.ee_t = cms.Task( process.EERecHitGPUProd, process.EERecHitGPUtoSoAProd, process.EERecHitFromSoAProd )
0090 process.hef_t = cms.Task( process.HEFRecHitGPUProd, process.HEFRecHitGPUtoSoAProd, process.HEFRecHitFromSoAProd )
0091 process.heb_t = cms.Task( process.HEBRecHitGPUProd, process.HEBRecHitGPUtoSoAProd, process.HEBRecHitFromSoAProd )
0092 process.gpu_t = cms.Task( process.ee_t, process.hef_t, process.heb_t )
0093 process.cpu_t = cms.Task( process.HGCalRecHits )
0094 process.path = cms.Path( process.valid, process.gpu_t, process.cpu_t )
0095 
0096 
0097 process.out = cms.OutputModule( "PoolOutputModule", 
0098                                 fileName = cms.untracked.string( os.path.join(dirName, 'out.root') ),
0099                                 outputCommands = cms.untracked.vstring('drop *') )
0100 
0101 process.outpath = cms.EndPath(process.out)